How to migrate a website off a headless CMS into code and Markdown with Cursor agents
Confirmed by source: Documented production case study: the author (Cursor) migrated the live cursor.com site and publishes the agent-computed cost, token, request and commit figures plus after-effects (lower CDN cost, faster builds). Source page checked live (HTTP 200) on 2026-10-23. The post is dated December 2025 without a day, so the published date is set to the first of the month. (checked 2026-10-23)
The problem
Your marketing site or blog lives in a headless CMS. Every change now means clicking through a separate tool with its own user accounts, draft-preview setup, localisation plugins and usage-priced CDN, and a coding agent can't simply grep and edit the content because it sits behind an API. You want the content back in the repository as code and Markdown, without spending weeks on manual export work.
Tools needed
- Cursor (agent mode, plan mode, subagents and the built-in browser)
- Your existing CMS API key (read access, for exporting content)
- A Next.js / React site in a Git repository
- Object storage for images and videos (instead of the CMS CDN)
Step-by-step recipe
- Ask the agent for a migration plan first (plan mode), and answer its clarifying questions. A good plan uses the CMS API key you already have instead of manual downloads: scripts that export every entry, check the structure, convert it to Markdown/components in the repo, and upload assets to your own object storage.
- Let the agent write and run those export scripts and build the pages from the exported files. Expect the first handful of agent runs to get most of the site across; the last stretch (pages that don't quite match) takes most of the time.
- For every page that differs, run one focused agent task: re-export that page with all its sub-components and images, then use the browser to screenshot local vs. production and keep iterating until they match. Attach both screenshots so the agent knows which is which.
- Once content is in code, simplify while you are there: inline data that used to come from the CMS (navigation, footer), and use subagents to apply an agreed API shape across many call sites in parallel.
- Replace the CMS asset manager with a small upload/manage/delete page on top of your object storage, and remove dependencies you no longer need.
- Ship it through normal pull requests: every content change now gets a preview link anyone can open, and the full history is in Git for both people and agents.
Copyable prompt
The page [ROUTE, e.g. /pricing] in this repo does not yet match production at [PRODUCTION URL]. 1. Look at how we exported CMS data for [ALREADY-MIGRATED PAGE] in [EXPORT SCRIPT PATH] and re-export the complete contents of [ROUTE], including every sub-component, image and background. 2. Store text as Markdown/JSX in [CONTENT FOLDER] and upload media with [UPLOAD SCRIPT] to [OBJECT STORAGE BUCKET]; never hotlink the CMS CDN. 3. Run the dev server, open both versions in the browser and take screenshots. The first attached image is local, the second is production. 4. Keep fixing and re-screenshotting until the local page matches; then run [BUILD/LINT COMMAND] and summarise what changed.
Original template written by our AI agent for AgentRecipes, not copied from the source. Replace the [BRACKETS] and {{variables}} with your own values and test before relying on it.
What the builder reported
Lee Robinson reports migrating cursor.com from a headless CMS to code and Markdown over a long weekend (three days) instead of his own 1-2 week estimate. By the agent-computed tally: $260.32 and 297.4M tokens (mostly cached), 344 agent requests, 66 manual Tab edits and 67 commits (+43K / -322K lines). Afterwards the team moved assets to cheaper object storage (he says this saves thousands of dollars in CDN costs; the CMS CDN had cost $56,848 since September), builds got about 2x faster, and fixes and cross-site features now ship as ordinary pull requests.
These are the source author's own claims. AgentRecipes has not run this recipe itself.
Watch out for
- This only suits teams where everyone who edits content can work through Git (the source added its marketing team to GitHub). If non-technical editors need a GUI and won't use an agent or PRs, a CMS may still be worth its cost.
- Token spend is real: the source's migration used hundreds of agent requests and hundreds of millions of (mostly cached) tokens. Watch usage on a large site.
- Pixel-matching every page is the slow part. Budget for it and check each page yourself; don't trust 'looks identical' without seeing the screenshots.
- A broad refactor at the same time multiplies the diff (the source deleted far more lines than it added). Keep the migration and the cleanup in reviewable commits so you can revert pieces.
- Keep the CMS read-only and online until the new site is verified, so you can re-export anything that was missed.
Source
Original write-up: leerob.com (Lee Robinson) (2025-12-01) ↗
Found via Agent Use Cases: “Migrate a website from a CMS to raw code and Markdown”. This recipe summarises the source in words written by our AI agent; read the original for the full details. Link last checked 2026-10-23.
More engineering & security recipes
New agent recipes in your inbox
A short email with the newest automation recipes, each linked to its real-world source. No spam. Every email has a one-click unsubscribe link.