Andy Nguyen

What Happens When You Let AI Loose on a 4-Year-Old Gatsby Blog

A few days ago my personal site was running Gatsby v4 with dependencies so old they made npm audit blush. Today it is on Astro v6, all packages are current, zero vulnerabilities, and the build takes about three seconds.

I did not do any of that work myself. I told an AI what I wanted and let it run.

The Setup

This site started as a Gatsby project in 2022. Gatsby is a great framework but its ecosystem moves fast. By 2025 I had fallen several major versions behind. The README still mentioned npm install --force to work around dependency conflicts. The TODO list had items like “Update to Gatsby 5” and “Fix React console errors” that had been sitting there for years.

I had been wanting to clean things up but the scope felt overwhelming. A full framework migration? Dependency audits? Testing infrastructure? It was the kind of project that stays on your backlog forever.

The Migration

I opened a session with my AI coding agent and described what I wanted: move from Gatsby to Astro, keep the existing content, set up tests, update everything. I told it to create a feature branch first so nothing would break irreversibly.

Over the course of a few hours the agent:

The build went from taking over a minute to about three seconds.

The Bugs That Followed

The first build succeeded but two issues slipped through. The Inter font files returned 404s because the SCSS config referenced an old directory name that did not exist in the current package. And code blocks had a doubled background color — Shiki (Astro’s syntax highlighter) was applying one theme while the CSS framework added another on top.

Both were trivial fixes once identified. The font path needed updating from inter-ui/Inter (web) to inter-ui/web. The code blocks needed a CSS override to let the inner <code> inherit the <pre> background instead of applying its own.

I pointed the agent at the dev server output, it investigated both issues, and had fixes committed within minutes.

The Draft That Would Not Load

Later I asked the agent to write this very blog post as a draft. It placed the file in src/content/blog/~drafts/ — the staging area for unpublished posts. But when I tried to preview it, I got a 404.

The content collection found the file just fine. The problem was that Astro uses github-slugger to generate content IDs from file paths, and github-slugger strips the ~ prefix. So ~drafts/what-happens-when-you-let-ai-loose became drafts/what-happens-when-you-let-ai-loose — a path with a slash that could not match the flat [slug] route parameter.

The fix was to handle subdirectory IDs in getStaticPaths. Any ID containing a / now uses only the last path segment as the slug. Drafts are also included in the route generation regardless of published status — they just do not appear on the archive page. You need to know the URL to find them.

The root blog/ directory was also a leftover from Gatsby that duplicated the content. Cleaning it up removed the confusion of having two copies of every post.

Writing the Rules

One of the more interesting parts was creating an AGENTS.md file — essentially giving future AI sessions a playbook for this project. What commands to run, how content is structured, where drafts live, what voice to write in.

The file is only 90 lines but captures things I would otherwise have to re-explain every time. The blog writer persona section records the conventions inferred from seven existing posts: first-person voice, TOC lists at the top, H2 for sections, **NOTE:** for callouts.

Takeaways

AI coding agents are good at large, mechanical migrations. They will not miss a file or forget to update a config. But they still benefit from human oversight on the details — a font path string or a CSS specificity issue.

The real win is compounding. The AGENTS.md I wrote in this session will make every future session faster. And having a modern, tested codebase means I can trust the agent to make changes without breaking things.

Shipping this setup. Next time my blog needs work, I will know exactly what to do — and so will the AI.