I used Claude Sonnet 4 to help a customer import their blog archive in 46 minutes
I'm sure people are starting to get a little tired of hearing about how AI solved this coding problem or that coding problem. If you look at X (urgh, I know - don't) you'll see countless posts about agents 10x-ing productivity alongside tales of people building clones of Big SaaS in a weekend (followed by a cease and desist!). Some of it is totally legit, some of it is probably BS. Either way, it still blows my mind on occasion.
Today I received an email from a new Pagecord customer asking about a feature that would help them import 300 (!) blog posts:
Today I received an email from a new Pagecord customer asking about a feature that would help them import 300 (!) blog posts:
My initial thought was to add a quick feature to show these hidden fields by default, but that would still be a pain for the customer. I asked them whether they had an export of their blog and they sent over a zip file with HTML and images in it (it was a Dreamwidth export). It looked rather fiddly but there was enough structure there to potentially extract the data and import it into Pagecord.
The time was 7:55pm.
Writing an importer would have easily taken me a day of frustrating head scratching and endless bugs. Instead I prompted the Claude Sonnet 4 agent in VS Code to do it for me:
You are to help me import posts to a Pagecord blog. * The data is in a folder with the following structure: ./entries ./images ./userpics * entries consists of many HTML files * the html files reference images and other entries using "..", e.g. "../entries/" and "../userpics". Your job is to write a script that:For each post:
- takes a root folder of the export
- parse each of the HTML files in the "./entries" folder
Write the script in Ruby such that it can be run with the rails runner and save it in the /scripts folder.
- extract the post title from <h3 class="entry-title">
- extract the post date from a <span class="datetime"> that follows the <h3> (both have a parebt <div class="header">)
- extract the content of the post from <div class="entry-content">
- if the content contains images that are relative, load the image and save it in the content as an embedded actiontext image attachment
- extracts a tag list from <div class="tag"><ul><li>. Each li is a tag. Sometimes the tags are hierarchical, e.g. "hobbies: gaming". In this situation, just use the last part (e. g "gaming").
- set post.tag_list to an array of tag strings if tags are present
- save the post
Claude was outstanding! It took it around 3 minutes to write a script, then it wrote some tests to verify what it had done, then it ran the script against the test data that I supplied. It pretty much worked first time, just one bug with importing images. A few more prompts to fix those and I had fully imported the blog to my local environment. One of the posts didn't import which turned out to be a bug in Pagecord, which I fixed myself (Claude made a meal of this), then I did another run through and it worked perfectly.
I deployed it to production, ran the script which worked perfectly, then I emailed the customer to tell them the good news.
It was 8:41pm. The whole thing took 46 minutes. I didn't even look at the script it produced 😅
Of course this isn't some magic, scalable customer support solution. It's just a real-world example of how effective these AI coding agents can be in boring, painful, burdensome situations like this. It really is remarkable!