Documentation Standards
Documentation Standards
Section titled “Documentation Standards”1. Architecture Decision Records (ADR)
Section titled “1. Architecture Decision Records (ADR)”Purpose
Section titled “Purpose”Document significant architectural decisions, their context, and consequences.
Format
Section titled “Format”Use Markdown files in docs/adr/ directory. Number sequentially: 0001-decision-title.md.
Metadata is a bullet list directly under the title — not a ## Status heading or a bare Date: line — so humans and the doc-lint check find it without parsing section structure. Legacy ADRs that use ## Status / ## Date headings still pass the lint; convert them when you next touch them.
Template
Section titled “Template”Copy templates/docs/adr.md:
# ADR NNNN: [Title]
- **Status:** Proposed- **Date:** YYYY-MM-DD- **Related:** #123, `docs/specs/YYYY-MM-DD-topic-design.md`- **Supersedes:** —- **Extends:** —
## Context
[The issue motivating this decision, with evidence]
## Decision
[The change we are making. Name a rejected alternative inline when it matters]
## Consequences
[The resulting context: what gets easier, harder, or impossible; follow-ups spawned]Metadata Fields
Section titled “Metadata Fields”| Field | Form | Values | doc-lint |
|---|---|---|---|
| Status | - **Status:** |
Proposed, Accepted, Rejected, Deprecated, Superseded by ADR NNNN |
Required |
| Date | - **Date:** |
ISO YYYY-MM-DD — the date the status last changed |
Required |
| Related | - **Related:** |
Issues, PRs, specs, review-finding ids (R17, M-3); — when there is nothing to link |
Expected on every ADR written from the template; not lint-enforced |
| Supersedes / Extends | - **Supersedes:**, - **Extends:** |
ADR numbers or —. Supersedes retires the older ADR (set its status to Superseded by ADR NNNN); Extends refines it and leaves it Accepted |
Expected on every ADR written from the template; not lint-enforced |
| Context, Decision, Consequences | ## headings |
Required sections. An Alternatives Considered section is optional — prefer one inline sentence in Decision |
Required |
Status, Date and the three sections are the lint-enforced minimum, chosen so that pre-existing Nygard-style ADRs (including the legacy ## Status / ## Date heading form) keep passing. Related, Supersedes and Extends are part of the template and reviewers should expect them on every new ADR; write — rather than omitting the line.
Guidelines
Section titled “Guidelines”- When to Create: For decisions that affect structure, dependencies, or significant technical choices.
- Status Updates: Update status (and Date) when decisions are implemented, deprecated, or superseded.
- Cross-References: Link related ADRs. Reference issues/PRs when applicable.
- Root-Cause Classes: When an ADR closes a recurring class of defect (e.g. “UI feedback loop — late async response overwrote newer state”), name the class in Consequences. Over time
docs/adr/doubles as a design-decision ledger that reviewers cite by number. - Lint:
make lint-standardsrunsdoc-lint, which fails an ADR missing Status, Date, Context, Decision, or Consequences, and fails any relative Markdown link that does not resolve (§10).
2. Code Documentation
Section titled “2. Code Documentation”Inline Comments
Section titled “Inline Comments”- Purpose: Explain “why”, not “what”. Code should be self-documenting.
- Style: Use language-specific comment syntax. Keep comments concise.
- Complex Logic: Document non-obvious algorithms, business rules, and workarounds.
API Documentation
Section titled “API Documentation”- Public APIs: All public functions, classes, methods, and interfaces must be documented.
- Format: Use language-standard documentation format (JSDoc, docstrings, JavaDoc, rustdoc).
- Required Tags: Include parameters, return values, exceptions/errors, and examples.
Example Standards
Section titled “Example Standards”TypeScript/JavaScript:
/** * Creates a new user with validated email address. * * @param email - Valid email address (must match RFC 5322) * @param name - User's full name (non-null, non-empty) * @returns New User entity instance * @throws {InvalidEmailError} If email format is invalid */Python:
def create_user(email: str, name: str) -> User: """Create a new user with validated email address.
Args: email: Valid email address (must match RFC 5322) name: User's full name (non-null, non-empty)
Returns: User entity instance.
Raises: InvalidEmailError: If email format is invalid. """3. Usage Documentation
Section titled “3. Usage Documentation”README Files
Section titled “README Files”Every package and application must include a README.md with:
- Purpose: What the component does
- Installation: Setup instructions
- Usage: Basic usage examples
- Configuration: Required environment variables and settings
- Development: How to contribute or extend
API Usage Guides
Section titled “API Usage Guides”- Location:
docs/usage/directory - Format: Markdown with code examples
- Sections: Quick start, common patterns, advanced usage, troubleshooting
CLI Documentation
Section titled “CLI Documentation”- Help Text: Comprehensive
--helpoutput for all commands - Man Pages: Generate man pages for complex CLIs
- Examples: Include practical examples in help text
4. Changelog Management
Section titled “4. Changelog Management”Format
Section titled “Format”Use Keep a Changelog format in CHANGELOG.md at project root.
Structure
Section titled “Structure”# Changelog
## [Unreleased]
### Added- New features
### Changed- Changes to existing functionality
### Deprecated- Soon-to-be removed features
### Removed- Removed features
### Fixed- Bug fixes
### Security- Security vulnerability fixesGuidelines
Section titled “Guidelines”- Every PR (manual mode only): When the project has no release automation, update the changelog for user-facing changes. Do NOT hand-edit a shared
## [Unreleased]block when releases are automated — see “Automated Releases” below. - Categories: Use standard categories. Be specific about changes
- Links: Link to issues and PRs:
[#123](https://github.com/user/repo/issues/123) - Versioning: Follow semantic versioning. Tag releases with version numbers
Automated Changelog
Section titled “Automated Changelog”- Tool: Use
conventional-changelogor similar for automated generation - Source: Generate from conventional commit messages
- Review: Always review and edit generated changelogs before release
Automated Releases
Section titled “Automated Releases”When a project uses an automated release tool (semantic-release, release-please, Changesets, etc.), the changelog and release notes are generated — contributors MUST NOT hand-maintain a shared ## [Unreleased] block per PR.
- Why: Under parallel development, every PR editing the same first line of
### Added/### Changed/### Fixedproduces a predictableCHANGELOG.mdmerge conflict on each batch. Generated notes (or per-PR fragments) eliminate it. - Preferred approaches:
- Commit-message-driven (
semantic-release,release-please): notes are generated from the git history. KeepCHANGELOG.mdeither generated at release time (@semantic-release/changelog) or omit the per-PR manual section entirely. - Fragment-driven (Changesets): one changeset file per PR under
.changeset/, collected at release. Notes derive from the fragments, not from commit messages.
- Commit-message-driven (
- Match enforcement to the model: for commit-message-driven automation, Conventional Commits become load-bearing — enforce the commit convention (commitlint / hook). For fragment-driven automation, the gate is instead that each user-facing PR includes a changeset fragment (enforce via a
changesetstatus check).
5. Project Documentation
Section titled “5. Project Documentation”Project Overview
Section titled “Project Overview”- Location:
docs/README.mdor rootREADME.md - Contents: Project purpose, architecture overview, getting started guide
- Audience: New contributors and users
Architecture Documentation
Section titled “Architecture Documentation”- Location:
docs/architecture/ - Contents: System design, component diagrams, data flow, deployment architecture
- Format: Markdown with diagrams (Mermaid, PlantUML, or images)
Development Guides
Section titled “Development Guides”- Location:
docs/development/ - Contents: Setup instructions, development workflow, testing guidelines, contribution guide
- Audience: Developers working on the project
Deployment Documentation
Section titled “Deployment Documentation”- Location:
docs/deployment/ - Contents: Deployment procedures, environment configuration, rollback procedures
- Security: Never include secrets or credentials
6. User Documentation
Section titled “6. User Documentation”User Guides
Section titled “User Guides”- Location:
docs/user-guide/or separate documentation site - Contents: Feature documentation, tutorials, FAQs
- Format: Markdown, HTML, or documentation framework (MkDocs, Docusaurus)
Tutorials
Section titled “Tutorials”- Structure: Step-by-step guides with clear outcomes
- Examples: Include working code examples
- Prerequisites: Clearly state required knowledge and setup
API Reference
Section titled “API Reference”- Generation: Auto-generate from code documentation
- Tools: Use language-specific tools (Sphinx, JSDoc, rustdoc, JavaDoc)
- Hosting: Publish to documentation site or include in repository
7. Project Blog
Section titled “7. Project Blog”Purpose
Section titled “Purpose”- Announcements: Release notes, major feature announcements
- Technical Deep Dives: Architecture decisions, implementation details
- Community: Team updates, community highlights
Content Guidelines
Section titled “Content Guidelines”- Frequency: Regular but not mandatory (monthly or per major release)
- Style: Technical but accessible. Include code examples and diagrams
- Format: Markdown in
docs/blog/or separate blog repository - Metadata: Include author, date, tags, and categories
Blog Structure
Section titled “Blog Structure”docs/blog/├── 2024/│ ├── 01-15-release-1.0.0.md│ └── 02-20-architecture-deep-dive.md└── index.md8. Project Website
Section titled “8. Project Website”Purpose
Section titled “Purpose”- Landing Page: Project overview, key features, quick start
- Documentation: Hosted user and developer documentation
- Community: Links to resources, contribution guide, code of conduct
Technology
Section titled “Technology”- Static Site: Use static site generators (Hugo, Jekyll, Docusaurus, MkDocs)
- Hosting: GitHub Pages, Netlify, Vercel, or custom hosting
- CI/CD: Auto-deploy from documentation changes
Content
Section titled “Content”- Homepage: Clear value proposition, installation instructions, examples
- Documentation: Full user and developer documentation
- Blog: Project blog posts and announcements
- Community: Contribution guidelines, code of conduct, contact information
9. Documentation Maintenance
Section titled “9. Documentation Maintenance”Review Process
Section titled “Review Process”- Code Reviews: Documentation changes reviewed alongside code
- Regular Audits: Quarterly review of documentation accuracy
- Outdated Content: Mark deprecated content clearly. Remove after deprecation period
Versioning
Section titled “Versioning”- Documentation Versions: Tag documentation with project versions
- Current vs. Historical: Clearly distinguish current and historical documentation (see below)
- Migration Guides: Provide guides for breaking changes
Docs Index: Live vs. Historical
Section titled “Docs Index: Live vs. Historical”Every docs/ tree with more than a handful of documents keeps an index (docs/README.md or docs/index.md) listing each document with a Status column:
| Status | Meaning | Edit policy |
|---|---|---|
live |
Describes current behavior; maintained alongside the code | Edit in the PR that changes the behavior |
historical |
Point-in-time record: implemented specs, plans, verification docs, superseded ADRs | Never rewritten. Add a dated note at the top if context is needed (“Superseded by …”) |
Rules:
- A new document is added to the index in the PR that creates it, with its status.
- Changing a document’s status (spec
Draft→Implemented, planActive→Done) flips its index row tohistoricalin the same PR. - Agents and readers take current truth from
livedocuments only;historicaldocuments are provenance. A document that is neither is deleted or moved.
Accessibility
Section titled “Accessibility”- Language: Clear, concise language. Avoid jargon when possible
- Structure: Use headings, lists, and formatting for readability
- Examples: Include diverse, realistic examples
- Search: Implement search functionality for large documentation sites
10. Documentation Tools
Section titled “10. Documentation Tools”Recommended Tools
Section titled “Recommended Tools”- Markdown Editors: VS Code, Typora, or any Markdown-capable editor
- Diagram Tools: Mermaid (text-based), PlantUML, or draw.io
- Documentation Generators:
- Python: Sphinx
- TypeScript/JavaScript: TypeDoc, JSDoc
- Rust: rustdoc
- Java: JavaDoc
- Static Site Generators: MkDocs, Docusaurus, Hugo, Jekyll
Automation
Section titled “Automation”- CI/CD: Generate and deploy documentation automatically
- Link Checking: Validate internal and external links.
make lint-standardsrunsdoc-lint(scripts/lint-checks/common/doc-lint.sh), which fails on relative Markdown links that do not resolve and on ADRs missing required fields (§1); fenced code and inline code are ignored - Spell Checking: Use automated spell checkers
- Format Validation: Ensure consistent formatting across documentation
11. Spec, Plan, Design-Pass and Verification Documents
Section titled “11. Spec, Plan, Design-Pass and Verification Documents”Non-trivial work leaves a paper trail a reader can follow from “why” to “what shipped”. Templates live in templates/docs/ (.standards/templates/docs/ when installed as a submodule); copy, fill, and add each document to the docs index (§9).
| Document | Location | Required sections | Lifecycle |
|---|---|---|---|
Design spec — spec.md |
docs/specs/YYYY-MM-DD-<topic>-design.md |
Purpose, Success, Non-goals, Anti-goals, Architecture, Errors, Testing, Left to the plan | live while Draft/Agreed → historical once Implemented |
Implementation plan — plan.md |
docs/plans/YYYY-MM-DD-<topic>-plan.md |
Goal, Architecture, Global Constraints, Review Focus, phased checkbox tasks, PR map, Execution | historical from the first commit: tick boxes, never rewrite |
Design pass (UI) — design-pass.md |
docs/design/YYYY-MM-DD-<surface>.md |
Identity prompts, Hard constraints, Deliverables table, State inventory | live until Built → historical |
Verification — verification.md |
docs/<feature>-verification.md |
Tests run (counts), Coverage per module, What was NOT verified, Residual risk | historical; one per feature PR |
- Spec before plan, plan before code for non-trivial work: a new feature, a change that crosses architectural layers, a migration. Trivial fixes go straight from issue to PR.
- “Left to the plan” is the explicit hand-off. The plan may decide ordering, PR boundaries and file names; it may not silently change the spec’s Architecture or cross an Anti-goal. If it must, reopen the spec first.
- Design pass precedes UI code. The state inventory (empty / loading / error / streaming / sync paused / runner unavailable / pending write) is the checklist that proc-04 §7 later validates the build against.
- Verification docs say what was NOT verified. A green pipeline is evidence, not proof. Record test counts and per-module coverage from tool output, then name every gap and its residual risk.
- Reference review-finding ids. When a review tool or reviewer assigns ids (
R17,M-3), cite them in the commit body and in the ADR/specRelatedfield so a fix can be traced to the finding that prompted it. - Projects on the
superpowersworkflow keep specs indocs/superpowers/specs/and plans indocs/superpowers/plans/; the template content is identical.