Documentation
Documentation is a product. Treat it with the same care as code: version it, review it, test it, maintain it.
Context
Documentation is a cross-cutting concern that applies at every lifecycle phase.
See context notes.
Diataxis Framework
Organize documentation into four types:
| Type |
Purpose |
Oriented to |
| Tutorial |
Learning-oriented |
Getting started, step-by-step |
| How-to Guide |
Task-oriented |
Solving specific problems |
| Reference |
Information-oriented |
Technical descriptions (API docs) |
| Explanation |
Understanding-oriented |
Background, context, decisions |
Inputs
I/O contract notes define required inputs and authority.
Process
Step 1: Identify the Need
What documentation is needed? Common triggers:
- New feature shipped (how-to guide for users)
- Architecture decision made (ADR for future developers)
- Incident resolved (runbook to prevent recurrence)
- New team member joining (onboarding tutorial)
Before writing, classify the need explicitly:
must_consider only: verify that no durable doc update is needed and record that decision in the surrounding artifact or handoff
must_produce: create or update the durable doc because downstream work, operators, or users would otherwise lose context
skip_when_fast_track: only use the waiver when the route is explicitly fast-tracked and the change does not create durable knowledge debt
Step 2: Write for Your Audience
- Developers: Code examples, API reference, architecture docs
- Operators: Runbooks, deployment guides, monitoring dashboards
- Users: Tutorials, how-to guides, FAQs
- Stakeholders: Architecture Decision Records, design docs
Step 3: Keep Docs Close to Code
- Use docs-as-code: Markdown in the repository, versioned alongside code
- Auto-generate API docs from code annotations (OpenAPI, JSDoc, docstrings)
- README.md in every significant directory explaining its purpose
- Architecture Decision Records in
docs/adr/
Step 4: Review and Maintain
- Documentation reviews as part of PR process (if docs were changed)
- Quarterly documentation audit: remove outdated content
- Track documentation debt alongside tech debt
Outputs
Produce only declared outputs at their documented quality boundary.
Quality Gate
Anti-Patterns
- Write once, abandon forever -- Outdated docs are worse than no docs. They mislead.
- Documentation dump -- A 200-page doc no one reads. Keep it focused and findable.
- Separate documentation system -- If docs aren't next to code, they won't be updated with code.
- No documentation at all -- "The code is self-documenting" is only true for WHAT, never for WHY.
1---2name: pc-documentation-23description: Use when a feature, architecture decision, incident, or workflow change needs durable technical documentation such as tutorials, reference docs, ADRs, runbooks, or maintenance guidance instead of ad hoc notes.4---56# Documentation78> Documentation is a product. Treat it with the same care as code: version it, review it, test it, maintain it.910## Context1112Documentation is a cross-cutting concern that applies at every lifecycle phase.1314See [context notes](references/context.md).1516## Diataxis Framework1718Organize documentation into four types:1920| Type | Purpose | Oriented to |21|------|---------|-------------|22| **Tutorial** | Learning-oriented | Getting started, step-by-step |23| **How-to Guide** | Task-oriented | Solving specific problems |24| **Reference** | Information-oriented | Technical descriptions (API docs) |25| **Explanation** | Understanding-oriented | Background, context, decisions |2627## Inputs2829[I/O contract notes](references/io-contract.md) define required inputs and authority.3031## Process3233### Step 1: Identify the Need3435What documentation is needed? Common triggers:36- New feature shipped (how-to guide for users)37- Architecture decision made (ADR for future developers)38- Incident resolved (runbook to prevent recurrence)39- New team member joining (onboarding tutorial)4041Before writing, classify the need explicitly:42- `must_consider` only: verify that no durable doc update is needed and record that decision in the surrounding artifact or handoff43- `must_produce`: create or update the durable doc because downstream work, operators, or users would otherwise lose context44- `skip_when_fast_track`: only use the waiver when the route is explicitly fast-tracked and the change does not create durable knowledge debt4546### Step 2: Write for Your Audience4748- **Developers**: Code examples, API reference, architecture docs49- **Operators**: Runbooks, deployment guides, monitoring dashboards50- **Users**: Tutorials, how-to guides, FAQs51- **Stakeholders**: Architecture Decision Records, design docs5253### Step 3: Keep Docs Close to Code5455- Use docs-as-code: Markdown in the repository, versioned alongside code56- Auto-generate API docs from code annotations (OpenAPI, JSDoc, docstrings)57- README.md in every significant directory explaining its purpose58- Architecture Decision Records in `docs/adr/`5960### Step 4: Review and Maintain6162- Documentation reviews as part of PR process (if docs were changed)63- Quarterly documentation audit: remove outdated content64- Track documentation debt alongside tech debt6566## Outputs6768Produce only declared outputs at their documented quality boundary.6970## Quality Gate7172- [ ] Target audience can complete their task using only the documentation73- [ ] Documentation is discoverable (linked from README, searchable)74- [ ] Auto-generated docs are integrated into CI pipeline75- [ ] No outdated information (verified within last quarter)7677## Anti-Patterns78791. **Write once, abandon forever** -- Outdated docs are worse than no docs. They mislead.802. **Documentation dump** -- A 200-page doc no one reads. Keep it focused and findable.813. **Separate documentation system** -- If docs aren't next to code, they won't be updated with code.824. **No documentation at all** -- "The code is self-documenting" is only true for WHAT, never for WHY.