DEV Community

Cover image for The AGENTS.md file I drop into every client repo before my coding agent touches it
Linc
Linc

Posted on

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 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.
Enter fullscreen mode Exit fullscreen mode

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)
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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/assets and use <Image />, nothing raw in public/ 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
Enter fullscreen mode Exit fullscreen mode

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.
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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.

Top comments (7)

Collapse
 
kitvane profile image
KitVane •

The protected files section is the part I'd steal first. Client-edited JSON and the redirects file being append-only are exactly the things an agent will "tidy up" without thinking. The gotchas log is a nice touch too, since it turns every past mistake into a rule. Quick question: do you treat AGENTS.md as advisory, or have you added something like a pre-commit check so the agent can't touch those files even if it ignores the rules?

Collapse
 
lincchad profile image
Linc •

It's still just advisory. I haven't added a pre-commit check yet, so if the agent ignores the file it can still touch those paths. In practice I catch it when I look at the preview and the check output, but you're right, a hook that fails the commit on public/data, _redirects and the legal folder would be the proper lock. I'll probably add that next.

Collapse
 
kitvane profile image
KitVane •

Makes sense, and catching it in the preview is a decent safety net for now. One idea for when you build the hook: a CI check that fails the PR if the diff touches those paths, with a deliberate override for the times you really do mean to edit them. That way it still protects you if the agent skips the local hook. Would be curious to hear how it goes, especially whether the agent respects the failure or tries to work around it.

Collapse
 
dosaygo profile image
dosaygo •

When a new client repo already has shared components or helpers, how do you get the agent to find and reuse them before it creates another implementation?

Collapse
 
lincchad profile image
Linc •

I write it into AGENTS.md. There's a short reuse-first section that lists the shared components and where they live, plus a rule to search src/components before creating anything new. If the agent still duplicates something, that goes in the gotchas log so the next session doesn't do it again. On a repo I don't know yet I also ask it to inventory the existing helpers before it starts building.

Collapse
 
dosaygo profile image
dosaygo •

Thanks for the detail on keeping a reuse-first section and gotchas log in AGENTS.md and asking the agent to inventory existing helpers on unfamiliar repos, I'm building AI Lint as a drop-in pre-flight checklist and doctrine pack (including AR-R2: Parallel Solutions) that requires the coding agent to name the existing module it extends before writing new code: ai-lint.dosaygo.com/go/forum-20261...

Collapse
 
dosaygo profile image
dosaygo •

A reuse-first section that lists the shared components goes stale the week a client adds a folder, and you carry that upkeep in every repo. The rule that lasts has no list in it: before new code, name what you extend. That rule, with the rejects for the usual agent shortcuts, is what the AI Lint packs are, written once and dropped in beside AGENTS.md. One-time purchase: ai-lint.dosaygo.com/go/ft2-2026112...