{"slug": "the-agents-md-file-i-drop-into-every-client-repo-before-my-coding-agent-touches", "title": "The AGENTS.md file I drop into every client repo before my coding agent touches it", "summary": "A developer at a web agency has standardized an AGENTS.md file placed in every client repo before a coding agent (Claude Code, Cursor, or Codex) begins work, with symlinks so each tool reads the same brief. The file defines do-not-edit paths like client-edited JSON and _redirects, a single source of truth for contact details, pre-finish checks such as build, link validation and Lighthouse scores, deploy rules requiring preview-first and explicit approval, and a running gotchas list. The developer says the practice shifted review from line-by-line diffs to checking preview URLs.", "body_md": "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.\n\nNone 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.\n\nHere's roughly what goes in mine and why.\n\n```\n# Client: Harbour Physio (harbourphysio.com.au)\nAstro static site, 9 pages, migrated from WordPress in 2026.\nAudience: local patients booking appointments. Phone calls matter more than anything else.\n```\n\nSounds obvious but it changes the agent's choices. When it knows phone calls are the goal it stops burying the number in the footer.\n\nThis 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.\n\n```\n## Do not edit\n- public/data/*.json  (client edits these through /edit, pull latest before any change)\n- public/_redirects    (old WordPress URLs, only append, never remove lines)\n- src/assets/legal/*   (client supplied, don't reword)\n```\n\nThe `_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.\n\nBusiness name, phone, address, ABN, booking link. One file, `src/site.ts`, and the agent is told to import from it and never hardcode.\n\n```\n## Single source of truth\n- Contact details, hours fallback, socials: src/site.ts\n- Never hardcode phone/email/address in components\n```\n\nWhen the client changes their number I change one line and the agent greps to confirm nothing else has it.\n\nNot \"write clean code\". Specific stuff:\n\n`src/assets` and use `<Image />`, nothing raw in `public/` except favicons\nThat 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.\n\n```\n## Before you finish\n1. npm run build passes with no warnings\n2. Every internal link resolves (npm run check:links)\n3. Every page has a unique title and meta description\n4. Lighthouse mobile perf >= 95 on home and contact\n5. grep dist/ for \"wp-content\" returns nothing\n```\n\nI 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.\n\n```\n## Deploy\n- Preview: npx novence deploy (gives a preview URL, send that to me)\n- Production: only when I say \"ship it\". Never deploy to prod on your own.\n- Never touch DNS. Ever.\n```\n\nAll my client sites sit on [novence.ai](https://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.\n\nThe bottom of the file is a running list:\n\n```\n## Gotchas\n- 2026-10: client logo has a white box on dark bg, use logo-transparent.svg\n- 2026-11: /book redirects to Cliniko, don't build a booking page\n```\n\nEvery 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.\n\nI 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.\n\nThe 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.\n\nIf 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.", "url": "https://wpnews.pro/news/the-agents-md-file-i-drop-into-every-client-repo-before-my-coding-agent-touches", "canonical_source": "https://dev.to/lincchad/the-agentsmd-file-i-drop-into-every-client-repo-before-my-coding-agent-touches-it-5fb2", "published_at": "2026-11-25 00:07:12+00:00", "updated_at": "2026-11-25 00:14:13.960074+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "ai-tools"], "entities": ["Claude Code", "Cursor", "Codex", "novence.ai"], "also_reported_by": [], "takeaway": "A repo-level AGENTS.md with do-not-edit paths, a single source of truth for shared data, pre-finish checks and a preview-only deploy rule stops coding agents from breaking client sites, and a running gotchas list prevents repeat mistakes.", "recommendation": {"advice": "Write an AGENTS.md in each repo listing do-not-edit paths, single-source-of-truth files, pre-finish checks and preview-only deploys, and add one line to a gotchas section each time the agent errs.", "playbook": "coding-agents", "playbook_url": "https://wpnews.pro/playbooks/coding-agents"}, "alternates": {"html": "https://wpnews.pro/news/the-agents-md-file-i-drop-into-every-client-repo-before-my-coding-agent-touches", "markdown": "https://wpnews.pro/news/the-agents-md-file-i-drop-into-every-client-repo-before-my-coding-agent-touches.md", "text": "https://wpnews.pro/news/the-agents-md-file-i-drop-into-every-client-repo-before-my-coding-agent-touches.txt", "jsonld": "https://wpnews.pro/news/the-agents-md-file-i-drop-into-every-client-repo-before-my-coding-agent-touches.jsonld"}}