product-docs-kit
AGENTS.md0 starsChanged 2 months agoMITView on GitHub
Read this file completely at the start of every session, before any other action. It applies to Claude Code, GitHub Copilot, and any other coding agent working in this repository. The documents in docs/ are the source of truth for intent. The code is the source of truth for current reality. Your job is to keep them in agreement. If you are asked to build something that is not described in docs/01-prd.md, stop and say so. Propose the requirement first.…
- Reads credentials
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,542 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository8 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- add-featureSkill
- bootstrap-docsSkill
- doc-drift-auditSkill
- implement-featureSkill
- release-prepSkill
- reverse-engineer-docsSkill
- stack-auditSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
24 rules. About 0 are common, 13 are distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
If you are asked to build something that is not described in docs/01-prd.md,
- Distinctive: line 21
Before writing or changing any code, read in this order:
- Distinctive: line 38
Every unit of work is anchored to an ID from the PRD.
- Very specific: line 59
IDs are permanent: Never renumber, never reuse a retired ID.
- Distinctive: line 114
Use expand → migrate → contract, never a destructive change in one release.
- Very specific: line 118
Every migration gets a MIG- ID and a tested rollback path.
- Distinctive: line 119
Never write a migration that cannot be reversed without data loss unless the PRD explicitly approves it.
- Distinctive: line 126
Prefer the platform. If the framework or standard library already does it, use that instead of adding a package.
- Very specific: line 130
Never put a secret behind a browser-exposed prefix (e.g.
- Very specific: line 133
Never change a pinned runtime version (.nvmrc, engines, CI image) without an UPG- entry — silent drift between local, CI, and production is …
- Very specific: line 144
Do not change shared components in docs/03-design-system.md without checking every SCR- that consumes them.
- Distinctive: line 146
Use design tokens. Never hard-code a colour, spacing value, or font size.
- Distinctive: line 149
Put anything risky, slow to validate, or externally dependent behind a
- Distinctive: line 151
Never modify a passing test to make new code pass.
- Distinctive: line 153
Never delete a test without an explicit, recorded reason.
- Very specific: line 159
When you edit any file in docs/:
- Very specific: line 161
Update the YAML front-matter: bump version, set last_updated, adjust status if needed.
- Distinctive: line 164
Follow the version bump rules:
- Distinctive: line 169
Never rewrite history in a Change Log table.
- Distinctive: line 185
If a task requires reversing a decision recorded in an ADR, stop and propose a new superseding ADR instead of just doing it.
- Very specific: line 192
Commit secrets, .env files, API keys, or credentials
- Distinctive: line 196
Delete or renumber an existing requirement ID
- Very specific: line 198
Add a dependency without a TECH- row and a stated reason
- Very specific: line 199
Add an environment variable without a CFG- row and an .env.example entry
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md — Operating Rules for AI Coding Agents
Read this file completely at the start of every session, before any other action. It applies to Claude Code, GitHub Copilot, and any other coding agent working in this repository.
1. Prime directive
The documents in docs/ are the source of truth for intent. The code is the
source of truth for current reality. Your job is to keep them in agreement.
If you are asked to build something that is not described in docs/01-prd.md,
stop and say so. Propose the requirement first. Do not silently invent scope.
2. Session start checklist
Before writing or changing any code, read in this order:
docs/11-glossary.md— so you use our words correctlydocs/01-prd.md— the requirement you are working ondocs/12-tech-stack.md— what we are actually running, and at which versionsdocs/04-architecture.md— how the system is put togetherdocs/05-data-model.md— before touching anything persistentdocs/06-api-contract.md— before touching any endpointdocs/08-test-plan.md— how this must be verifieddocs/adr/— decisions you are not allowed to quietly reverse
State which requirement ID you are working on before you begin.
3. The ID system — never break the chain
Every unit of work is anchored to an ID from the PRD.
| Prefix | Meaning | Lives in |
OBJ- | Business objective | docs/00-vision.md |
PER- | Persona | docs/00-vision.md |
FR- | Functional requirement | docs/01-prd.md |
NFR- | Non-functional requirement | docs/01-prd.md |
UF- | User flow | docs/02-user-flows.md |
SCR- | Screen / route | docs/02-user-flows.md |
CMP- | UI component | docs/03-design-system.md |
ADR- | Architecture decision | docs/adr/ |
ENT- | Data entity | docs/05-data-model.md |
MIG- | Migration | docs/05-data-model.md |
API- | Endpoint | docs/06-api-contract.md |
THR- / CTL- | Threat / control | docs/07-security-privacy.md |
TC- | Test case | docs/08-test-plan.md |
TECH- | Technology / dependency | docs/12-tech-stack.md |
CFG- | Config / environment variable | docs/12-tech-stack.md |
UPG- | Upgrade task | docs/12-tech-stack.md |
IDs are permanent. Never renumber, never reuse a retired ID. To retire one,
set its status to Deprecated — do not delete the row.
Allocate a new ID by taking max(existing) + 1 for that prefix. Check the whole
repo before allocating.
4. Definition of Done
A change is not done until every box is true:
- The requirement exists in
docs/01-prd.mdwith acceptance criteria - All affected downstream docs are updated in the same PR
- Each touched document has a bumped
versionand a new Change Log row docs/09-traceability-matrix.mdhas a row linking requirement → code → test- Automated tests exist, are tagged with the requirement ID, and pass
- Every acceptance criterion has been verified on the Vercel preview URL
CHANGELOG.mdhas an entry under[Unreleased]- No secrets, keys, or tokens are committed
- Any new dependency has a
TECH-row; any new env var has aCFG-row and an.env.exampleentry - No dependency or runtime version was bumped as a side effect of this work
- Accessibility and performance budgets in the PRD's NFR section still hold
5. Git conventions
Branches: <type>/<ID>-<slug> — e.g. feat/FR-014-saved-search,
fix/FR-009-token-refresh, chore/CHORE-004-bump-deps.
Commits — Conventional Commits, with the ID in the scope:
feat(FR-014): add saved search persistence
Implements ENT-007 and API-021. Adds TC-058 and TC-059.
Refs: FR-014Types: feat fix docs refactor test chore perf build ci.
A breaking change must carry a BREAKING CHANGE: footer explaining the
migration path. This drives the MAJOR version bump.
One requirement per branch. One branch per PR. Never bundle.
6. Change safety rules
These exist to stop version N+1 from breaking version N.
Database
- Use expand → migrate → contract, never a destructive change in one release.
- Expand: add the new column/table as nullable. Deploy.
- Migrate: backfill, write to both, read from new. Deploy.
- Contract: drop the old column in a later release. Deploy.
- Every migration gets a
MIG-ID and a tested rollback path. - Never write a migration that cannot be reversed without data loss unless the PRD explicitly approves it.
Dependencies & configuration
- Never add a dependency without recording it. A new direct dependency needs a
TECH-row indocs/12-tech-stack.md§3, a stated reason in the PR, and an ADR if the choice is significant or hard to reverse. - Prefer the platform. If the framework or standard library already does it, use that instead of adding a package.
- Never introduce an environment variable without a
CFG-row indocs/12-tech-stack.md§4 and a described line in.env.example. - Never put a secret behind a browser-exposed prefix (e.g.
NEXT_PUBLIC_). - Never bump a dependency version as a side effect of feature work. Upgrades
are separate PRs with their own
UPG-ID. - Never change a pinned runtime version (
.nvmrc,engines, CI image) without anUPG-entry — silent drift between local, CI, and production is how "works on my machine" happens.
API
- Adding an optional field or a new endpoint is safe.
- Removing a field, renaming a field, changing a type, or adding a required
request field is breaking. Version the endpoint instead (
/v2/...) and deprecate the old one with a removal date recorded indocs/06-api-contract.md.
UI
- Do not change shared components in
docs/03-design-system.mdwithout checking everySCR-that consumes them. - Use design tokens. Never hard-code a colour, spacing value, or font size.
General
- Put anything risky, slow to validate, or externally dependent behind a feature flag, defaulted off.
- Never modify a passing test to make new code pass. Fix the code, or change the requirement in the PRD first and record why.
- Never delete a test without an explicit, recorded reason.
7. Documentation editing rules
When you edit any file in docs/:
- Update the YAML front-matter: bump
version, setlast_updated, adjuststatusif needed. - Append a row to that document's Change Log table, citing the requirement ID.
- Follow the version bump rules:
- PATCH — wording, typos, formatting only
- MINOR — additive change (new requirement, new field, new flow)
- MAJOR — removal or incompatible change; you must also list the downstream documents that now need review
- Never rewrite history in a Change Log table. Only append.
8. Uncertainty protocol
You will not always know the answer. Mark it, do not guess:
[INFERRED]— you deduced this from the code with reasonable confidence[ASSUMPTION]— you had to pick something to make progress; state the choice[NEEDS CONFIRMATION]— a human must decide; you cannot resolve this from available evidence
Never invent business rationale, target users, success metrics, compliance obligations, or SLAs. Those come from a human. Ask.
If a task requires reversing a decision recorded in an ADR, stop and propose a new superseding ADR instead of just doing it.
9. What you must never do
- Commit secrets,
.envfiles, API keys, or credentials - Push directly to
main - Disable, skip, or weaken a CI check to make a PR pass
- Perform a destructive database operation without an approved
MIG-entry - Delete or renumber an existing requirement ID
- Change
docs/00-vision.mdwithout explicit human instruction - Add a dependency without a
TECH-row and a stated reason - Add an environment variable without a
CFG-row and an.env.exampleentry - Upgrade a dependency or runtime as a side effect of unrelated work
- Mark work complete when acceptance criteria are unverified
10. Tech stack
The stack inventory lives in
docs/12-tech-stack.md. Read it at session start. Do not restate versions here — two copies of a version number means one of them is wrong, and you will trust the wrong one.
That document tells you exactly what is installed, at which versions, which environment variables exist, and what is scheduled to change. If it disagrees with the lockfile, trust the lockfile and flag the document as drifted.
Commands
Fill these in and keep them accurate — you are expected to run lint, typecheck, and tests before opening a PR.
# install
# dev
# test
# lint
# typecheck
# buildDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

