AGENTS.md guide
How to write AGENTS.md so coding agents respect repo boundaries, tests, and review norms.
GuideWebsites, apps, and software built with AI—you own the code.
Short answer
Spec-driven development means agreeing on goals, constraints, acceptance commands, and out-of-scope paths before an AI agent or contractor edits your repository. The spec is the merge contract: reviewers pass or fail against it, not against whatever the model sounded confident about. Pair specs with verify commands in AGENTS.md and human sign-off on regulated paths.
Spec-driven development is the habit of writing a short, testable contract before autonomous coding agents (or offshore contractors) touch your repository. The spec names the user-visible outcome, the verify commands that must pass, and what must remain untouched. PunkSolid treats specs as merge law—not as optional preamble in a chat window. This guide sits in the learn cluster beside AI agents explained and Claude Code vs Cursor.
Language models excel at plausible code. They do not automatically inherit your roadmap, compliance boundaries, or canonical URL policy. Without a spec, reviewers debate whether a refactor “felt helpful” instead of checking a checklist. That ambiguity shows up in rescue work: silent redirect edits, duplicate sitemaps, and lockfile churn.
A written spec turns review into pass/fail. Did pnpm test pass? Did redirects match the signed inventory? Did the agent stay out of infra/? Those questions do not depend on which vendor produced the diff.
PunkSolid uses the same skeleton on migrations, CMS seeds, and feature slices:
Optional but valuable: Rollback — how to revert if acceptance passes locally but staging fails (feature flag, revert commit, DNS hold).
| Artifact | Audience | Lifetime |
|---|---|---|
| Ticket / issue | Humans prioritizing work | Closes when shipped |
| Spec (this guide) | Agent + reviewers for one slice | Archived with the PR |
| AGENTS.md | Every future agent session | Living repo doc |
AGENTS.md belongs at repository root: install steps, verify commands, forbidden paths. A spec is task-specific. Do not paste a multi-day feature spec into AGENTS.md; link the ticket instead.
Cursor rules encode habits (git remotes, no force-push). Rules steer style; specs bound intent for a single branch.
“If tests pass” is not acceptance. Name filters: pnpm --filter @scope/web test, pnpm validate, site build <id> --pull. The command should be the same one you would run before asking a human reviewer for a LGTM.
On PunkSolid monorepos, content agents run package validators before claiming a page is ready for reviewed. Client apps mirror that pattern so Claude Code and Cursor sessions cannot shortcut with a verbal “all good.”
Agents with shell access can touch more than you intended. The spec should list allowed path globs when the task is narrow: apps/ai-network/src/content/pages/punksolid/** only, for example. Pair that list with deny rules in AGENTS.md for infra/, commerce webhooks, and secret stores.
Least privilege beats heroic prompting. If the task is “rewrite five guides,” the spec should not invite dependency updates or deploy script edits.
A practical loop for mixed Cursor and Claude Code teams:
Neither tool replaces step five on production paths. See methodology for how PunkSolid gates client delivery.
Common failures: the spec was vague, acceptance commands were missing from CI, or the agent “fixed” unrelated lint. Recovery is revert or narrow—not an argument in chat.
If you hire PunkSolid for AI code review after a vibe-coded sprint, the first deliverable is often retroactive specs for the slices you still want to keep. That documents intent before the next agent session.
Website migrations need specs with URL inventory attachment: old path, new path, redirect code, canonical owner. Agents should not invent redirects from sitemap guesses. The website migration SEO checklist lists structural checks that belong in acceptance.
For large content moves, acceptance includes validator output (duplicate keywords, orphan links) not just HTML build green.
Product and content leads can write the problem and review sections; engineering fills constraints and acceptance. Plain-language problem statements reduce agents hallucinating features you did not request.
Regulated industries: the spec should flag which pages need medical, legal, or financial sign-off. Agents may draft; humans publish.
Website development and Claude Code development engagements start from a spec-shaped statement of work: deliverables, verify commands, and ownership of hosting. If you already use agents internally, we can tighten your AGENTS.md and rules so specs stay short.
Continue with What is agentic AI? for vocabulary, or AI coding agents compared if you are still choosing tooling.
One page for most agent tasks: problem, constraints, acceptance commands, out of scope, and reviewer. Long features get an ADR or ticket link instead of pasting requirements into chat. See [AGENTS.md guide](/guides/agents-md-guide/).
It slows the first hour and saves the second day—fewer surprise refactors and fewer “helpful” dependency upgrades. [Methodology](/methodology/) treats specs as cheaper than production rollback.
It can draft bullets; a human still signs scope before edits. Letting the same session invent and implement invites scope creep—see [AI agents explained](/guides/ai-agents-explained/).
The spec wins until you consciously revise it. Merge against acceptance commands, not the agent’s closing summary.
Cursor is a trademark of Anysphere, Inc. Claude Code is a product of Anthropic. PunkSolid is not affiliated with either company.
Send the site, the stack, and the deadline. We reply with questions, risks, and a proposed first step.
How to write AGENTS.md so coding agents respect repo boundaries, tests, and review norms.
GuideCompare agentic coding workflows—terminal-first vs IDE-first—without picking a universal winner.
GuideAgents as loops of observe, act, and verify—plus where they fail without engineering discipline.
GuideProject rules and skills that steer IDE agents—scope, tone, and test discipline.
Guide