My CMS is a click and a sentence
How I gave my Astro site a point-and-prompt editor by wiring Claude Code into the dev server, and the prompts that got me there.
Every personal site eventually hits the same wall. The design is done, the deploy pipeline works, and then you want to change a sentence. Do you open the editor, find the file, find the line, save, check the browser? Or do you install a CMS, with its schemas, admin panel and login, for a site with one author?
I wanted neither. I wanted to look at my site, point at the thing that’s wrong, and say what I want instead. This post covers how I built that for my Astro site with Claude Code. It started as a throwaway prototype and ended up as the way I edit the site. At the end I’ll show how I packaged it as a Claude Code plugin so it works on any Astro project.
Where it started: a site that didn’t look like every AI site
The site runs on Astro, deployed to Cloudflare Workers, with Auth0 for a members area and R2 for downloads. The home page was a placeholder that said “Coming soon”.
My first prompt to Claude Code was about design, not tooling:
Create me a prototype home page for my personal site. I want it to look modern. Find me a common theme and typeface, but not the most common. I want something current but not the most common, say in the 25th percentile, if that makes sense. A lot of AI sites look the same.
That “25th percentile” framing worked better than I expected. It ruled out Inter, Geist, Space Grotesk and Instrument Serif without me having to list them, and it still gave me fonts that are maintained, on Google Fonts and look current: Schibsted Grotesk, Newsreader, Spline Sans Mono.
Narrowing down, one decision at a time
Rather than arguing over one design, I asked for options I could flip between:
Can you create about 5 themes that I can work with to get to the right design?
I got five complete looks (Paper, Nocturne, Blueprint, Folio and Moss). Each one was just a block of CSS custom properties for colours, fonts, corner radius and heading style, with a floating switcher and the number keys 1–5 to swap between them. Because only the variables changed, I was comparing like with like.
From there every prompt narrowed one decision:
I like Moss, but I don’t like the full caps menus, they look too harsh.
Can we change the theme switcher for a font switcher?
The colours were now fixed, and the switcher offered five font pairings instead.
The Host theme is good, except for the top nav links. Can we have different themes just for the fonts on the top nav links?
The switcher now changed only the nav links.
Let’s go with the Funnel font for the top nav, remove the theme picker and apply the changes to the main website.
The pattern of colours first, then a font pairing, then the font for one component meant I never judged more than one thing at a time. I ended up with sage paper, moss green, Host Grotesk with Spectral italic accents, and Funnel Display for the nav.
The real idea: edit mode
Once the design was settled, content was the next problem. This was the prompt:
Next I want to sort out the content, so what I want is an edit mode for the site. Then I want to hover over the different components of the site, and to be able to click to select a component and to be able to type a prompt and for Claude to do its stuff. This is going to be a localhost feature only. We also need a page toggle for edit/view mode in the top right that is always there, even when we edit.
Here’s what it does now. A slim bar sits across the top of every page in dev, with a View / Edit
toggle on the right. In Edit mode, hovering outlines elements and labels them with the file and line
they came from, for example h1.disp index.astro:220. Clicking selects an element and opens a prompt
box. I type “make this friendlier” and press Enter. Claude edits the source, the page reloads, and the
result appears in the bar.
How it works
There are three parts, and none of them is clever on its own.
1. Astro already knows where every element came from. In dev, Astro’s compiler adds
data-astro-source-file and data-astro-source-loc to every element it renders. Its dev toolbar uses
these. They’re also exactly what an editor needs: click an element and you have a file path and a line
number.
2. An Astro integration that only exists in dev. A small integration
(dev/edit-mode/integration.mjs) does two things, and only when command === 'dev':
- It injects the overlay script into every page with
injectScript('page', ...). - It adds middleware to Vite’s dev server under
/__edit/*.
Nothing from this ends up in astro build, so production never sees it.
3. The Claude Code command line tool does the editing. When you send a prompt, the overlay posts the selected element’s source file and line, the element’s position in the page, its visible text and a trimmed copy of its HTML. The middleware turns that into a prompt and runs:
claude -p --output-format stream-json --verbose \
--permission-mode acceptEdits \
--allowedTools Read,Edit,Write,Glob,Grep \
--disallowedTools Bash,WebFetch,WebSearch \
--append-system-prompt "<editor instructions>"
The prompt goes in on stdin, and progress comes back as one JSON event per line. The middleware turns
those events into a readable log, such as → Edit src/pages/index.astro followed by Claude’s one-line
summary, and the overlay polls for it. When Claude saves the file, Vite’s file watcher reloads the page.
I didn’t write any reload logic.
The system prompt is short. It explains that the location is a template line, and that text may come
from a frontmatter array rendered with .map(), in which case Claude should edit the data. It asks for
minimal changes in the existing style, no shell commands, and a one-sentence summary at the end.
Keeping it local
A dev server that runs an AI coding agent on request is something to be careful with. The endpoints refuse anything that isn’t:
- From this machine: the socket’s remote address must be loopback.
- Addressed to this machine: the
Hostheader must belocalhost,127.0.0.1or[::1], which blocks DNS rebinding. - From one of its own pages:
Originmust match on every POST, so another website can’t send a request tolocalhost:4321behind your back.
Claude also gets no shell and no web access, only file tools scoped to the project. Git is the undo button, so I commit before an editing session.
The bugs were the interesting part
The first version didn’t work, and the reason surprised me:
It doesn’t appear to work. Use Claude in Chrome to check it out.
Claude opened the page in my browser, hovered, saw nothing, and checked the DOM. There were no
data-astro-source-* attributes at all, even though the server’s HTML had them. Astro’s dev toolbar
removes them once it loads and keeps a private copy for its Audit feature. You can’t just turn the
toolbar off either, because Astro only adds the attributes when the toolbar is enabled. The fix was to
have the overlay copy them into its own data-edit-* attributes as soon as it runs, before the toolbar
gets to them.
Then came real use, and three more problems:
Can we have a queue of prompts available so we can do more than one change at a time?
Requests now go into a queue on the server and run one at a time, because two agents editing the same file at once would overwrite each other. The queue lives in server memory, so it survives page reloads. Each queued request also warns Claude that earlier edits may have moved its line number, so it should find the element by its content.
When I have a prompt being worked on and I start typing another, the second gets wiped if I haven’t submitted it.
Each finished edit reloads the page, and the reload wiped the half-typed prompt. Now the draft, the
cursor position and the selected element are saved in sessionStorage and restored after the reload. If
the line number has moved, the editor finds the element again by its tag and text.
Can we change the prompt box, so that if you press Enter it submits rather than Ctrl+Enter? Let Shift+Enter add a new line.
Can we reverse the order of the history?
These were small changes, but they made it pleasant to use.
A few environment problems are worth knowing about if you try this:
- Node version: Astro 7 needs Node 22.22 or newer. Rather than change my system Node, the dev server
runs through
npx -p node@22.22.0. - IPv6 only: the dev server listened on
[::1], sohttp://localhost:4321worked and127.0.0.1didn’t. - Restarting after changes: Astro restarts when
astro.config.mjschanges, but Node keeps modules it has already loaded, so changes to the integration itself need a full dev server restart.
Is it a CMS?
It has no schema, no admin panel, no database and no login. The “content model” is my source code, and the editor is the site itself. For a site with one author who’s comfortable with git, that’s the right trade. I edit what I see, every change is an ordinary diff, and the history is my commit log.
What it doesn’t do is let someone non-technical edit a live site, and I don’t want it to. It’s a localhost tool, built for me.
Packaging it as a Claude Code plugin
Two workflows came out of this session that I’ll want again:
live-edit: adds the point-and-prompt editor to any Astro project. The skill contains the integration and overlay source, so Claude copies them in, registers the integration, checksclaudeis on the PATH and that Node meets Astro’s minimum, restarts the dev server and confirms the endpoint responds.design-explorer: the narrowing process from earlier as a repeatable recipe. It covers a prototype route, N themes defined as CSS variables with a keyboard switcher, fonts chosen from the “25th percentile” rather than the usual AI-site defaults, then narrowing one decision at a time and promoting the winner to the real page.
Both are in a small local plugin marketplace. To install:
claude plugin marketplace add ./claude-plugins
claude plugin install astro-live-edit@paul-taras-plugins
Then in any Astro project, ask Claude to “set up live edit mode” or “help me explore designs for this site”.
The prompts, in order
For anyone who wants to reproduce this, here’s every prompt from the session, lightly tidied:
- Create me a prototype home page for my personal site… 25th percentile… a lot of AI sites look the same.
- Launch the site locally.
- Can you create about 5 themes that I can work with to get to the right design?
- I like Moss, but I don’t like the full caps menus, they look too harsh.
- Let’s add my full name, Paul Taras.
- Can we change the theme switcher for a font switcher?
- The Host theme is good, except for the top nav links. Can we have different themes just for the fonts on the top nav links?
- Can we remove some of the gap between the top nav and body content?
- Let’s go with the Funnel font for the top nav, remove the theme picker and apply the changes to the main website. Next… an edit mode… hover… click to select… type a prompt… localhost only… a toggle in the top right that is always there.
- It doesn’t appear to work. Use Claude in Chrome to check it out.
- Can we have a queue of prompts available so we can do more than one change at a time?
- When I have a prompt being worked on and start typing another, the second gets wiped.
- Make Enter submit, and Shift+Enter add a new line.
- Can we reverse the order of the history?
Fourteen prompts took the site from a “Coming soon” page to a designed site that edits itself when I point at it. The answers were in what the tools already provided: Astro’s source annotations, Vite’s middleware and file watcher, and Claude Code’s print mode. I just had to connect them.