Better with Kent · draft

AI Agents Rewrote My Entire Website

One prompt · 483 files · production migration

orchestrator
subagents
review loop

Better with Kent

Durable skills for people who ship software

Today: the system behind a 50,000-line production rewrite — not a magic prompt.

Cold open

The artifact

+28,839 lines added
-12,485 lines removed
483 files · PR #813

kentcdodds.com — real users, real data, real production.

Six migrations in one

  • Fly → Cloudflare Workers
  • SQLite/LiteFS → D1 + read replication
  • Prisma → @remix-run/data-table
  • Cloudinary → R2 + Images
  • Mailgun → Cloudflare email
  • OG images → Satori
  • Constraint: total feature parity

The hard part

MDX without server eval

CI compiles MDX ES modules in R2/KV Worker Loader isolates

227/227 posts render-parity verified · content updates without redeploy

Architecture

Parent vs dynamic worker

flowchart LR
  req["Request"] --> parent["Parent worker"]
  parent -->|"cache HIT"| kv["KV HTML"]
  parent -->|"MISS / BYPASS"| dyn["Dynamic worker SSR"]
  dyn --> kvfill["fills page cache"]

Wrong: "every HTML render hits the dynamic worker." Right: parent often serves cached HTML.

Kickoff

Prompt the system

~4,200 characters · one message to start · orchestrator owns the rest

  • Goals + constraints + feature parity
  • Quality bar and exit criteria in the prompt

Five parts of the prompt

Goals Orchestrator Kody CI loop Exit

Composer 2.5 subagents for cost + speed

The closer

One prompt — then hands off

"This is the only prompt you're going to receive from me. This job is yours now."

Orchestration in action

  • 12 Composer 2.5 agents — parity, perf, errors
  • 5 audit + 3 cleanup subagents — cruft sweep
  • Agent shipped site tour + hydration screenshots unprompted

Honest story

Steering ≠ abdication

  • 50 messages over 5 days
  • Hard cutover — no parallel-run cruft
  • "Cloudinary completely out" — said four times

Three-layer review

CI bots Review agents Fix via Kody

Each layer catches a different class of bug

Hard to reverse

What review caught

  • /blog page-cache privacy leak
  • Unauthenticated OG signing → SSRF
  • Image masters one cancellation from gone

Kody closes the loop

  • Scoped CF token · DNS inspection · deploys
  • 300MB image archive to R2 from inside a worker
  • Review agents → working agent — no human relay

The twist setup

Perf scare

60–80ms Fly warm
1.2-2.2s CF cache-miss

"I should definitely not switch."

Verify the verifier

  • Meta-agent: hot Fly vs cold staging — unfair benchmark
  • Warm cache HITs: 18–29ms — beat Fly
  • Real regression: cache-miss dynamic only

2026-07-08

Shipped

  • PR #813 merged · DNS flipped · live on Workers
  • Fly SQLite → D1 · sessions intact
  • Steady state: anonymous traffic → warm KV cache

Post-cutover cleanup

Cloud agent bc-c349545a · spawned via Kody

  • Archive migration tooling · rate-limit rules
  • Destroy Fly / cancel Cloudinary — asks first

Migration ends at DNS flip; teardown is a separate guarded job.

Homework

Before your next merge, spawn one agent: "Flag anything hard to reverse and any gaping security or perf holes."

~20 minutes · works on any open PR diff

Better with Kent

Prompt the system — verify the verifier

Subscribe · comment · get better with me