README/AGENTS/CLAUDE Writer
Mission
Produce documentation that works for both humans and coding agents:
- Keep the 3-file schema strict (
README.md, AGENTS.md, CLAUDE.md).
- Keep the instruction quality high enough for autonomous execution (guardrails, conventions, playbooks, do/don't rules, verification steps, and escalation rules).
- Keep guidance agent-agnostic: no model/vendor-specific logic unless a separate compatibility note is unavoidable.
If AGENTS.md and CLAUDE.md symlink to README.md, the README is no longer "just a project readme"; it is the full operational source of truth.
When To Use
- Creating or updating documentation triplets (
README.md, AGENTS.md, CLAUDE.md)
- Converting dedicated
AGENTS.md / CLAUDE.md files to symlinked companions
- Refactoring large docs while keeping agent guidance accurate, explicit, and current
- Strengthening weak instruction files that are vague, stale, or hard for agents to execute safely
When Not To Use
- Repos that intentionally keep different content in
README.md, AGENTS.md, and CLAUDE.md.
- Environments where symlinks are disallowed by policy/tooling.
- Requests that are only content edits where triplet ownership is already intentionally defined elsewhere.
Non-Negotiables
1) File Structure Policy (Triplet Contract)
For any directory that owns this documentation unit, use one of these two allowed patterns:
Standard pattern
README.md is the canonical file in that directory.
AGENTS.md -> README.md
CLAUDE.md -> README.md
Shared-doc exception
README.md, AGENTS.md, and CLAUDE.md are all symlinks to the same canonical README.md in another directory.
- Use this only when all of these are true:
- Same owner/team and release cadence.
- Same audience and operational intent.
- No directory-specific setup/rules that would diverge.
Never keep dedicated/non-symlink AGENTS.md or CLAUDE.md when a directory uses this triplet model.
Avoid shared-doc mode when docs are expected to evolve independently.
2) Instruction Depth Policy (Canonical README Must Be Agent-Operational)
Even with symlinked companions, the canonical README.md must include in-depth agent-operational guidance:
- Scope and ownership boundaries
- Safety guardrails and non-negotiable constraints
- Conventions and coding standards (repo-specific, not generic)
- Engineering playbook (setup, test/lint/build, release, and troubleshooting)
- Do/Don't rules with concrete examples
- Verification workflow (how to prove claims and detect stale docs)
- Escalation policy for ambiguity, destructive actions, and risky operations
If this depth is missing, the triplet setup is incomplete even when symlinks are correct.
Required Commands
Default workflow (recommended):
scripts/set-doc-triplet.sh <dir>
scripts/set-doc-triplet.sh <dir> <relative-path-to-canonical-README.md>
python3 scripts/check-doc-triplets.py [root]
Manual fallback (advanced):
cd <dir>
# Standard pattern
ln -snf README.md AGENTS.md
ln -snf README.md CLAUDE.md
# Shared-doc exception
TARGET=<relative-path-to-canonical-README.md>
ln -snf "$TARGET" README.md
ln -snf "$TARGET" AGENTS.md
ln -snf "$TARGET" CLAUDE.md
Instruction-quality review (always run during doc updates):
rg -n 'TODO|TBD|FIXME|maybe|probably|should be' README.md
python3 scripts/check-doc-triplets.py [root]
Workflow
- Classify scope first
- Root doc, workspace/app/package/service doc, or module/feature doc.
- Choose section depth based on scope (load
references/scope-patterns.md).
- Confirm triplet mode is actually desired
- If separate files are intentionally different, do not enforce symlink triplets.
- Build a verified fact inventory
- Verify every filepath, variable/constant name, command, dependency, and version.
- Do not trust existing docs without checking live code/config.
- Use
references/fact-verification.md.
- Design instruction architecture before prose
- Separate hard constraints from preferences.
- Convert vague guidance into trigger/action rules ("When X, do Y").
- Keep rules agent-agnostic (do not assume one tool's private behavior model).
- Plan sections for guardrails, conventions, playbooks, and escalation.
- Use
references/agent-instruction-best-practices.md.
- Plan with temporary structure files (avoid local maxima and context bloat)
- Create concise planning files under
.tmp/readme-doc-plan/ before final writing.
- Keep these as bullet/TODO artifacts, not full prose.
- Use
references/low-context-drafting.md.
- Draft and refactor in two passes
- Pass 1: structure, ownership boundaries, must/never rules, key commands.
- Pass 2: remove stale statements, collapse duplication, sharpen actionability and determinism.
- Enforce triplet symlink policy
- Use
scripts/set-doc-triplet.sh for direct creation/fix.
- Use
scripts/check-doc-triplets.py for audit + auto-generated fix commands.
- Run instruction quality QA
- Check for ambiguity, contradictory rules, and missing failure-mode guidance.
- Ensure there are repo-specific examples (good/bad where useful).
- Re-check against
references/agent-instruction-best-practices.md.
- Final freshness pass
- Re-run verification commands for anything changed during writing.
- Ensure scope-appropriate content (no root-only setup details in small module docs).
Quality Bar
All of the following are required:
- Content is specific, verifiable, and operational.
- Commands are copy/paste ready and runnable from stated working dirs.
- Paths exist at time of writing.
- Variable names and constants match code exactly and are used as described.
- Versions reflect currently installed/declared dependencies.
- Instructions use explicit trigger/action language, not soft ambiguity.
- Hard constraints are clearly marked as mandatory vs optional guidance.
- Safety-critical operations include confirmation/escalation rules.
- Examples demonstrate both compliant and non-compliant patterns where ambiguity risk is high.
- Wording stays agent-agnostic and portable across tooling.
References
references/scope-patterns.md
references/fact-verification.md
references/low-context-drafting.md
references/agent-instruction-best-practices.md
Scripts
scripts/set-doc-triplet.sh
scripts/check-doc-triplets.py
1---2name: readme-agents-writer3description: Build and maintain unified README.md + AGENTS.md + CLAUDE.md docs where symlink-triplet policy is strict, and the canonical README remains an in-depth, high-signal agent instruction and engineering playbook.4---56# README/AGENTS/CLAUDE Writer78## Mission910Produce documentation that works for both humans and coding agents:1112- Keep the 3-file schema strict (`README.md`, `AGENTS.md`, `CLAUDE.md`).13- Keep the instruction quality high enough for autonomous execution (guardrails, conventions, playbooks, do/don't rules, verification steps, and escalation rules).14- Keep guidance agent-agnostic: no model/vendor-specific logic unless a separate compatibility note is unavoidable.1516If `AGENTS.md` and `CLAUDE.md` symlink to `README.md`, the README is no longer "just a project readme"; it is the full operational source of truth.1718## When To Use1920- Creating or updating documentation triplets (`README.md`, `AGENTS.md`, `CLAUDE.md`)21- Converting dedicated `AGENTS.md` / `CLAUDE.md` files to symlinked companions22- Refactoring large docs while keeping agent guidance accurate, explicit, and current23- Strengthening weak instruction files that are vague, stale, or hard for agents to execute safely2425## When Not To Use2627- Repos that intentionally keep different content in `README.md`, `AGENTS.md`, and `CLAUDE.md`.28- Environments where symlinks are disallowed by policy/tooling.29- Requests that are only content edits where triplet ownership is already intentionally defined elsewhere.3031## Non-Negotiables3233### 1) File Structure Policy (Triplet Contract)3435For any directory that owns this documentation unit, use one of these two allowed patterns:36371. Standard pattern38 - `README.md` is the canonical file in that directory.39 - `AGENTS.md -> README.md`40 - `CLAUDE.md -> README.md`41422. Shared-doc exception43 - `README.md`, `AGENTS.md`, and `CLAUDE.md` are all symlinks to the same canonical `README.md` in another directory.44 - Use this only when all of these are true:45 - Same owner/team and release cadence.46 - Same audience and operational intent.47 - No directory-specific setup/rules that would diverge.4849Never keep dedicated/non-symlink `AGENTS.md` or `CLAUDE.md` when a directory uses this triplet model.50Avoid shared-doc mode when docs are expected to evolve independently.5152### 2) Instruction Depth Policy (Canonical README Must Be Agent-Operational)5354Even with symlinked companions, the canonical `README.md` must include in-depth agent-operational guidance:5556- Scope and ownership boundaries57- Safety guardrails and non-negotiable constraints58- Conventions and coding standards (repo-specific, not generic)59- Engineering playbook (setup, test/lint/build, release, and troubleshooting)60- Do/Don't rules with concrete examples61- Verification workflow (how to prove claims and detect stale docs)62- Escalation policy for ambiguity, destructive actions, and risky operations6364If this depth is missing, the triplet setup is incomplete even when symlinks are correct.6566## Required Commands6768Default workflow (recommended):6970```bash71scripts/set-doc-triplet.sh <dir>72scripts/set-doc-triplet.sh <dir> <relative-path-to-canonical-README.md>73python3 scripts/check-doc-triplets.py [root]74```7576Manual fallback (advanced):7778```bash79cd <dir>80# Standard pattern81ln -snf README.md AGENTS.md82ln -snf README.md CLAUDE.md8384# Shared-doc exception85TARGET=<relative-path-to-canonical-README.md>86ln -snf "$TARGET" README.md87ln -snf "$TARGET" AGENTS.md88ln -snf "$TARGET" CLAUDE.md89```9091Instruction-quality review (always run during doc updates):9293```bash94rg -n 'TODO|TBD|FIXME|maybe|probably|should be' README.md95python3 scripts/check-doc-triplets.py [root]96```9798## Workflow991001. Classify scope first101 - Root doc, workspace/app/package/service doc, or module/feature doc.102 - Choose section depth based on scope (load `references/scope-patterns.md`).1032. Confirm triplet mode is actually desired104 - If separate files are intentionally different, do not enforce symlink triplets.1053. Build a verified fact inventory106 - Verify every filepath, variable/constant name, command, dependency, and version.107 - Do not trust existing docs without checking live code/config.108 - Use `references/fact-verification.md`.1094. Design instruction architecture before prose110 - Separate hard constraints from preferences.111 - Convert vague guidance into trigger/action rules ("When X, do Y").112 - Keep rules agent-agnostic (do not assume one tool's private behavior model).113 - Plan sections for guardrails, conventions, playbooks, and escalation.114 - Use `references/agent-instruction-best-practices.md`.1155. Plan with temporary structure files (avoid local maxima and context bloat)116 - Create concise planning files under `.tmp/readme-doc-plan/` before final writing.117 - Keep these as bullet/TODO artifacts, not full prose.118 - Use `references/low-context-drafting.md`.1196. Draft and refactor in two passes120 - Pass 1: structure, ownership boundaries, must/never rules, key commands.121 - Pass 2: remove stale statements, collapse duplication, sharpen actionability and determinism.1227. Enforce triplet symlink policy123 - Use `scripts/set-doc-triplet.sh` for direct creation/fix.124 - Use `scripts/check-doc-triplets.py` for audit + auto-generated fix commands.1258. Run instruction quality QA126 - Check for ambiguity, contradictory rules, and missing failure-mode guidance.127 - Ensure there are repo-specific examples (good/bad where useful).128 - Re-check against `references/agent-instruction-best-practices.md`.1299. Final freshness pass130 - Re-run verification commands for anything changed during writing.131 - Ensure scope-appropriate content (no root-only setup details in small module docs).132133## Quality Bar134135All of the following are required:136137- Content is specific, verifiable, and operational.138- Commands are copy/paste ready and runnable from stated working dirs.139- Paths exist at time of writing.140- Variable names and constants match code exactly and are used as described.141- Versions reflect currently installed/declared dependencies.142- Instructions use explicit trigger/action language, not soft ambiguity.143- Hard constraints are clearly marked as mandatory vs optional guidance.144- Safety-critical operations include confirmation/escalation rules.145- Examples demonstrate both compliant and non-compliant patterns where ambiguity risk is high.146- Wording stays agent-agnostic and portable across tooling.147148## References149150- `references/scope-patterns.md`151- `references/fact-verification.md`152- `references/low-context-drafting.md`153- `references/agent-instruction-best-practices.md`154155## Scripts156157- `scripts/set-doc-triplet.sh`158- `scripts/check-doc-triplets.py`