Documentation Guidelines (LLM-first)
Purpose
Provide standards for repository documentation that is maintained for both LLMs and human collaborators.
Goals:
- Semantic precision: minimize ambiguity and "guesswork"
- Balanced information density: surface key decisions quickly; details available on demand
- Token efficiency: avoid non-essential verbosity so the model can act reliably within limited context
When to use
Use the documentation-guidelines skill when:
- Writing or reviewing
README.md, AGENTS.md, CLAUDE.md
- Creating specs, ADRs, design notes
- Authoring SSOT content under
.ai/skills/
- Writing bootstrap materials under
init/
Inputs
- The document to write or review
- Target audience (LLM, human developer, or both)
- Document type (entry/rules, standards/design, skill/command, task/implementation)
Outputs
- Documentation that follows LLM-first principles
- Self-review checklist results
Steps
- Confirm the document's purpose and target reader (who will use the document, and for what decision or task).
- Write the main path first (the smallest set of steps or facts needed to succeed) and defer deep detail to later sections.
- Add explicit inputs/outputs, and include verification criteria whenever the document describes a process or checklist.
- Run a readability pass: short paragraphs, scannable headings, consistent terminology, and minimal jargon.
- Ensure all examples and templates are placed in the most appropriate section (or extracted into dedicated example/template files if available).
Core Principles
Information Structure
- Conclusion first: start each section with decisions/constraints, then explain rationale/details
- One paragraph, one intent: do not mix multiple topics in the same paragraph
- Verifiable: key claims must include "how to verify" (commands, paths, checkpoints)
- Progressive disclosure: keep top doc to "overview + navigation"; move deep detail to supporting files
Semantic Precision
- Use MUST/SHOULD/MAY to express requirement strength
- Avoid vague references ("it/this/above/related"); use explicit nouns and paths instead
- Define terms on first use (e.g., SSOT, skill stub)
- Make assumptions explicit (OS differences, relative vs absolute paths, workspace roots)
Token Efficiency
- Prefer bullet lists over long paragraphs
- Do not paste large code blocks/logs into docs; reference paths and include only minimal excerpts
- Avoid repeating background across documents; use links + 1-line summaries
- Keep examples minimal; move complex examples to an appendix
Document Templates
Standards/Spec Docs
- Purpose & scope
- Core principles
- Rules (MUST/SHOULD/MAY)
- Exceptions & boundaries
- Verification (how to check compliance)
- Change log (optional)
Task/Implementation Docs
- Background (<= 5 lines)
- Goals (verifiable)
- Scope (IN/OUT)
- Constraints (MUST / DON'T)
- Steps (executable)
- Verification (commands/checkpoints)
- Risks & rollback (if generating/overwriting)
Skill/Command Docs (SSOT)
- Purpose (1-2 sentences): what problem the skill solves
- Trigger/usage: when to use; required inputs; expected outputs
- Steps: bullet list; minimal examples only
- Notes: boundaries, forbidden actions, failure handling
- References: optional (file paths / external links)
Readability Rules (MUST)
- Keep heading depth <= 4 levels (
# to ####)
- Wrap all paths/commands/identifiers in backticks
- Any action that generates/overwrites files MUST specify:
- blast radius (which directories/files are written)
- idempotency (whether repeated runs are safe)
- rollback plan (if available)
Prompt-Oriented Writing
When a doc is meant to guide an LLM, write the "inputs/outputs/invariants" like an interface:
- Inputs: required fields (e.g., project profile, target directory)
- Outputs: which files/directories are generated
- Invariants: rules that must not be violated
Include a minimal prompt template at the end:
Goal:
Constraints (MUST / DON'T):
Relevant paths:
Acceptance criteria:
Verification
Self-review checklist:
- Can the key decisions be extracted within 30 seconds?
- Are there any terms/references that require guessing?
- Are MUST/SHOULD/MAY used correctly (no "nice-to-have" phrased as MUST)?
- Is verification included?
- Can any redundant background be removed or replaced by a link + 1-line summary?
Boundaries
- Do NOT create documentation that exceeds 500 lines without progressive disclosure
- Do NOT use vague terms like "it", "this", "above" without explicit references
- Do NOT mix multiple intents in a single paragraph
Iterative co-authoring loop (borrowed)
For substantial docs/specs, prefer an explicit loop:
- Context gathering: ask targeted questions to close gaps.
- Structure first: create section headers with placeholders.
- Draft section-by-section with review feedback.
- Reader testing: validate that a fresh reader (or fresh agent) can answer the obvious questions without extra context.
Included assets
None.
1---2name: documentation-guidelines3description: Apply LLM-first documentation standards when writing or reviewing docs - covers structure, semantic precision, token efficiency, and verification.4---56# Documentation Guidelines (LLM-first)78## Purpose910Provide standards for repository documentation that is **maintained for both LLMs and human collaborators**.1112Goals:13- **Semantic precision**: minimize ambiguity and "guesswork"14- **Balanced information density**: surface key decisions quickly; details available on demand15- **Token efficiency**: avoid non-essential verbosity so the model can act reliably within limited context1617## When to use1819Use the documentation-guidelines skill when:20- Writing or reviewing `README.md`, `AGENTS.md`, `CLAUDE.md`21- Creating specs, ADRs, design notes22- Authoring SSOT content under `.ai/skills/`23- Writing bootstrap materials under `init/`2425## Inputs2627- The document to write or review28- Target audience (LLM, human developer, or both)29- Document type (entry/rules, standards/design, skill/command, task/implementation)3031## Outputs3233- Documentation that follows LLM-first principles34- Self-review checklist results353637## Steps381. Confirm the document's purpose and target reader (who will use the document, and for what decision or task).392. Write the main path first (the smallest set of steps or facts needed to succeed) and defer deep detail to later sections.403. Add explicit inputs/outputs, and include verification criteria whenever the document describes a process or checklist.414. Run a readability pass: short paragraphs, scannable headings, consistent terminology, and minimal jargon.425. Ensure all examples and templates are placed in the most appropriate section (or extracted into dedicated example/template files if available).4344## Core Principles4546### Information Structure4748- **Conclusion first**: start each section with decisions/constraints, then explain rationale/details49- **One paragraph, one intent**: do not mix multiple topics in the same paragraph50- **Verifiable**: key claims must include "how to verify" (commands, paths, checkpoints)51- **Progressive disclosure**: keep top doc to "overview + navigation"; move deep detail to supporting files5253### Semantic Precision5455- Use **MUST/SHOULD/MAY** to express requirement strength56- Avoid vague references ("it/this/above/related"); use explicit nouns and paths instead57- Define terms on first use (e.g., SSOT, skill stub)58- Make assumptions explicit (OS differences, relative vs absolute paths, workspace roots)5960### Token Efficiency6162- Prefer bullet lists over long paragraphs63- Do not paste large code blocks/logs into docs; reference paths and include only minimal excerpts64- Avoid repeating background across documents; use links + 1-line summaries65- Keep examples minimal; move complex examples to an appendix6667## Document Templates6869### Standards/Spec Docs70711. Purpose & scope722. Core principles733. Rules (MUST/SHOULD/MAY)744. Exceptions & boundaries755. Verification (how to check compliance)766. Change log (optional)7778### Task/Implementation Docs79801. Background (<= 5 lines)812. Goals (verifiable)823. Scope (IN/OUT)834. Constraints (MUST / DON'T)845. Steps (executable)856. Verification (commands/checkpoints)867. Risks & rollback (if generating/overwriting)8788### Skill/Command Docs (SSOT)8990- **Purpose (1-2 sentences)**: what problem the skill solves91- **Trigger/usage**: when to use; required inputs; expected outputs92- **Steps**: bullet list; minimal examples only93- **Notes**: boundaries, forbidden actions, failure handling94- **References**: optional (file paths / external links)9596## Readability Rules (MUST)9798- Keep heading depth <= 4 levels (`#` to `####`)99- Wrap all paths/commands/identifiers in backticks100- Any action that generates/overwrites files MUST specify:101 - blast radius (which directories/files are written)102 - idempotency (whether repeated runs are safe)103 - rollback plan (if available)104105## Prompt-Oriented Writing106107When a doc is meant to guide an LLM, write the "inputs/outputs/invariants" like an interface:108- **Inputs**: required fields (e.g., project profile, target directory)109- **Outputs**: which files/directories are generated110- **Invariants**: rules that must not be violated111112Include a minimal prompt template at the end:113```114Goal:115Constraints (MUST / DON'T):116Relevant paths:117Acceptance criteria:118```119120## Verification121122Self-review checklist:123- Can the key decisions be extracted within 30 seconds?124- Are there any terms/references that require guessing?125- Are MUST/SHOULD/MAY used correctly (no "nice-to-have" phrased as MUST)?126- Is verification included?127- Can any redundant background be removed or replaced by a link + 1-line summary?128129## Boundaries130131- Do NOT create documentation that exceeds 500 lines without progressive disclosure132- Do NOT use vague terms like "it", "this", "above" without explicit references133- Do NOT mix multiple intents in a single paragraph134135## Iterative co-authoring loop (borrowed)136137For substantial docs/specs, prefer an explicit loop:1381391. **Context gathering**: ask targeted questions to close gaps.1402. **Structure first**: create section headers with placeholders.1413. **Draft section-by-section** with review feedback.1424. **Reader testing**: validate that a fresh reader (or fresh agent) can answer the obvious questions without extra context.143144## Included assets145146None.