The AGENTS.md file I drop into every client repo before my coding agent touches it
I build most client sites with a coding agent now. Claude Code mostly, Cursor when I want to watch the diff. The agent is fast, but the first few months it kept doing dumb stuff on client repos. Renaming image folders an
I build most client sites with a coding agent now. Claude Code mostly, Cursor when I want to watch the diff. The agent is fast, but the first few months it kept doing dumb stuff on client repos. Renaming image folders and breaking old URLs. Hardcoding the phone number in five places. Deleting a JSON file the client had just edited. Running a deploy from the wrong folder.
None of that was the agent being bad. It just didn't know the rules of my agency. So now every client repo gets an AGENTS.md file in the root before the agent touches anything. Claude Code reads CLAUDE.md, Cursor reads its rules, Codex reads AGENTS.md. I keep one file and symlink the others to it so they all get the same brief.
Here's roughly what goes in mine and why.
1. What this site is, in three lines
# Client: Harbour Physio (harbourphysio.com.au)
Astro static site, 9 pages, migrated from WordPress in 2026.
Audience: local patients booking appointments. Phone calls matter more than anything else.
Sounds obvious but it changes the agent's choices. When it knows phone calls are the goal it stops burying the number in the footer.
2. Files the agent must not touch
This is the most important section. On my sites the client edits their own content (hours, team bios, prices) and that lives in /data/*.json. If the agent "tidies up" those files it overwrites the clients changes.
## Do not edit
- public/data/*.json (client edits these through /edit, pull latest before any change)
- public/_redirects (old WordPress URLs, only append, never remove lines)
- src/assets/legal/* (client supplied, don't reword)
The _redirects line saved me twice. Agents love deleting stuff that looks unused, and a 301 from /our-services-2/ looks very unused untill Google stops sending traffic.
3. Where facts live
Business name, phone, address, ABN, booking link. One file, src/site.ts, and the agent is told to import from it and never hardcode.
## Single source of truth
- Contact details, hours fallback, socials: src/site.ts
- Never hardcode phone/email/address in components
When the client changes their number I change one line and the agent greps to confirm nothing else has it.
4. Style rules that are actually mine
Not "write clean code". Specific stuff:
- Tailwind only, no new CSS files
- Images go in
src/assetsand use<Image />, nothing raw inpublic/except favicons - No new npm packages without asking me
- No client side JS unless the page genuinely needs it (forms don't, they post natively)
That last one stops the agent reaching for React for a contact form. The form is plain HTML with a data- attribute and the host handles submissions. Zero JS.
5. The checks it runs before saying "done"
## Before you finish
1. npm run build passes with no warnings
2. Every internal link resolves (npm run check:links)
3. Every page has a unique title and meta description
4. Lighthouse mobile perf >= 95 on home and contact
5. grep dist/ for "wp-content" returns nothing
I wrote about the checks themselves before, the point here is that they're written in the repo. A new agent session doesn't need me to remember them.
6. How to ship, and when not to
## Deploy
- Preview: npx novence deploy (gives a preview URL, send that to me)
- Production: only when I say "ship it". Never deploy to prod on your own.
- Never touch DNS. Ever.
All my client sites sit on novence.ai so the deploy line is the same in every repo, which is half the reason the file works. If each client was on a different host this section would be a mess. Some days I deploy through the MCP server instead of the CLI, same rule applies, preview first.
7. A "things that went wrong" log
The bottom of the file is a running list:
## Gotchas
- 2026-10: client logo has a white box on dark bg, use logo-transparent.svg
- 2026-11: /book redirects to Cliniko, don't build a booking page
Every time the agent screws something up, one line goes here. It doesn't repeat it. This section ends up being the most valuable part after a few months.
The template
I keep a starter AGENTS.md in my agency template repo, so a fresh migration starts with sections 2 to 6 filled in and I only write the client specific bits. Takes about ten minutes per site.
The difference is big. Before this file I'd review every diff line by line. Now I mostly review the preview URL and the check output, and the agent asks before it does anything risky because the file tells it what risky means.
If you're running client work through a coding agent and you don't have one of these yet, start with just the "do not edit" and "deploy" sections. Those two alone stop most of the expensive mistakes.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.