Documentation Standards
This skill ensures that "The Job Isn't Done Until It's Documented". It provides a decision framework and execution-ready patterns for all technical documentation needs.
1. Decision Tree: What do I need?
Use this flow to determine the right documentation type:
User needs: [Documentation Task]
├─ New project or repository?
│ └─ **README.md** (use Protocol 3)
│
├─ Made important technical decision?
│ ├─ Architecture choice? → **ADR** (use Protocol 5)
│ └─ Framework/Tool choice? → **ADR** with alternatives
│
├─ Building or documenting API?
│ ├─ REST/GraphQL? → **API Docs** (use Protocol 4)
│ └─ Public Functions? → **Code Comments** (use Protocol 7)
│
├─ Releasing new version?
│ └─ **CHANGELOG.md** (use Protocol 2)
│
└─ Found a nasty bug/trap?
└─ **Production Gotcha** (use Protocol 6)
Quick Reference
| Doc Type |
Template |
Key Sections |
Protocol |
| README |
readme.md |
Features, Install, Config |
#3 |
| Changelog |
changelog.md |
Added, Fixed, Breaking |
#2 |
| ADR |
adr.md |
Context, Decision, Consequences |
#5 |
| Gotcha |
gotcha.md |
Trap, Symptom, Fix |
#6 |
2. Changelog Protocol
Use when: "Update the changelog", "What changed in this version?", "Prepare release".
Instruction:
- Read:
CHANGELOG.md to identify current version and format.
- Draft:
- Header: Use today's date and Semantic Version (
Major.Minor.Patch).
- Sections: Group by
Added, Changed, Deprecated, Removed, Fixed, Security.
- Insert: Prepend new entry to the top (below Unreleased).
- Verify: Ensure link to diff is correct (if applicable).
3. README Protocol
Use when: "New project", "Add installation steps", "Update config docs".
Instruction:
- Scan: Does the change introduce new env vars or build steps?
- Locate: Relevant section (
Configuration, Getting Started).
- Update:
- If New Env Var: Update
.env.example AND README config table.
- If New Command: Add to
Makefile or package.json scripts first, then document.
- Validate: "Fresh Eyes" test - could a junior dev follow this?
4. API Documentation Protocol
Use when: "Document this endpoint", "Create API reference".
Instruction:
- Identify: HTTP Method, Endpoint URL, Auth requirements.
- Schema: Define Request Body and Response Model.
- Examples: Provide strict JSON examples for Success (200) and Error (4xx/5xx) cases.
- Format:
- If using OpenAPI: Update YAML/JSON spec.
- If Markdown: Use a clear request/response code block pair.
5. ADR Protocol (Architecture Decision Record)
Use when: "Why did we choose X?", "Deciding on database", "Major refactor".
Instruction:
- Create: New file
doc/adr/XXXX-title.md using adr.md.
- Context: Explain the problem and constraints, not just the solution.
- Consequences: List both Positive (Benefits) and Negative (Trade-offs).
- Status: Mark as
Accepted or Proposed.
6. Production Gotchas Protocol
Use when: "This bug took hours to debug", "Obscure platform issue", "Silent failure".
Instruction:
- Target:
docs/gotchas.md or dedicated TROUBLESHOOTING.md.
- Structure:
- The Trap: What looks right but fails?
- Symptom: Exact error message or behavior.
- Fix: The solution.
- Prevention: How to stop it happening again.
- Share: Mention this in relevant code comments near the fix.
7. Code Comments Protocol
Use when: "Explain this logic", "Add JSDoc".
Instruction:
- Public API: Use JSDoc/Docstring. Focus on Inputs, Outputs, and Exceptions.
- Complex Logic: Comment WHY, not WHAT.
- ❌
// Increment i by 1
- ✅
// Offset required because external API is 1-indexed
- Format:
/**
* Short description of what it does.
*
* @param {Type} name - Description
* @returns {Type} Description
* @throws {ErrorType} When condition is met
*/
Quality Checklist
Before completing any documentation task:
1---2name: documentation-standards3description: Use when writing or updating READMEs, changelogs, API docs, ADRs (Architecture Decision Records), or code comments. Provides decision trees, templates, and quality checklists for all technical documentation needs.4---56# Documentation Standards78This skill ensures that "The Job Isn't Done Until It's Documented". It provides a decision framework and execution-ready patterns for all technical documentation needs.910## 1. Decision Tree: What do I need?1112Use this flow to determine the right documentation type:1314```text15User needs: [Documentation Task]16 ├─ New project or repository?17 │ └─ **README.md** (use Protocol 3)18 │19 ├─ Made important technical decision?20 │ ├─ Architecture choice? → **ADR** (use Protocol 5)21 │ └─ Framework/Tool choice? → **ADR** with alternatives22 │23 ├─ Building or documenting API?24 │ ├─ REST/GraphQL? → **API Docs** (use Protocol 4)25 │ └─ Public Functions? → **Code Comments** (use Protocol 7)26 │27 ├─ Releasing new version?28 │ └─ **CHANGELOG.md** (use Protocol 2)29 │30 └─ Found a nasty bug/trap?31 └─ **Production Gotcha** (use Protocol 6)32```3334## Quick Reference3536| Doc Type | Template | Key Sections | Protocol |37| ------------- | ---------------------------------------- | ------------------------------- | -------- |38| **README** | [readme.md](./templates/readme.md) | Features, Install, Config | #3 |39| **Changelog** | [changelog.md](./templates/changelog.md) | Added, Fixed, Breaking | #2 |40| **ADR** | [adr.md](./templates/adr.md) | Context, Decision, Consequences | #5 |41| **Gotcha** | [gotcha.md](./templates/gotcha.md) | Trap, Symptom, Fix | #6 |4243---4445## 2. Changelog Protocol4647**Use when**: "Update the changelog", "What changed in this version?", "Prepare release".4849> **Instruction**:50>51> 1. **Read**: `CHANGELOG.md` to identify current version and format.52> 2. **Draft**:53> - **Header**: Use today's date and Semantic Version (`Major.Minor.Patch`).54> - **Sections**: Group by `Added`, `Changed`, `Deprecated`, `Removed`, `Fixed`, `Security`.55> 3. **Insert**: Prepend new entry to the top (below Unreleased).56> 4. **Verify**: Ensure link to diff is correct (if applicable).5758## 3. README Protocol5960**Use when**: "New project", "Add installation steps", "Update config docs".6162> **Instruction**:63>64> 1. **Scan**: Does the change introduce new env vars or build steps?65> 2. **Locate**: Relevant section (`Configuration`, `Getting Started`).66> 3. **Update**:67> - If **New Env Var**: Update `.env.example` AND README config table.68> - If **New Command**: Add to `Makefile` or `package.json` scripts first, then document.69> 4. **Validate**: "Fresh Eyes" test - could a junior dev follow this?7071## 4. API Documentation Protocol7273**Use when**: "Document this endpoint", "Create API reference".7475> **Instruction**:76>77> 1. **Identify**: HTTP Method, Endpoint URL, Auth requirements.78> 2. **Schema**: Define Request Body and Response Model.79> 3. **Examples**: Provide strict JSON examples for _Success_ (200) and _Error_ (4xx/5xx) cases.80> 4. **Format**:81> - If using OpenAPI: Update YAML/JSON spec.82> - If Markdown: Use a clear request/response code block pair.8384## 5. ADR Protocol (Architecture Decision Record)8586**Use when**: "Why did we choose X?", "Deciding on database", "Major refactor".8788> **Instruction**:89>90> 1. **Create**: New file `doc/adr/XXXX-title.md` using [adr.md](./templates/adr.md).91> 2. **Context**: Explain the _problem_ and constraints, not just the solution.92> 3. **Consequences**: List both **Positive** (Benefits) and **Negative** (Trade-offs).93> 4. **Status**: Mark as `Accepted` or `Proposed`.9495## 6. Production Gotchas Protocol9697**Use when**: "This bug took hours to debug", "Obscure platform issue", "Silent failure".9899> **Instruction**:100>101> 1. **Target**: `docs/gotchas.md` or dedicated `TROUBLESHOOTING.md`.102> 2. **Structure**:103> - **The Trap**: What looks right but fails?104> - **Symptom**: Exact error message or behavior.105> - **Fix**: The solution.106> - **Prevention**: How to stop it happening again.107> 3. **Share**: Mention this in relevant code comments near the fix.108109## 7. Code Comments Protocol110111**Use when**: "Explain this logic", "Add JSDoc".112113> **Instruction**:114>115> 1. **Public API**: Use JSDoc/Docstring. Focus on **Inputs**, **Outputs**, and **Exceptions**.116> 2. **Complex Logic**: Comment **WHY**, not **WHAT**.117> - ❌ `// Increment i by 1`118> - ✅ `// Offset required because external API is 1-indexed`119> 3. **Format**:120> ```typescript121> /**122> * Short description of what it does.123> *124> * @param {Type} name - Description125> * @returns {Type} Description126> * @throws {ErrorType} When condition is met127> */128> ```129130---131132## Quality Checklist133134Before completing any documentation task:135136- [ ] **Links**: Do all internal/external links work?137- [ ] **Copy-Paste**: Do code examples actually run?138- [ ] **Secrets**: Are any real API keys accidentally included? (Use `sk_test_...`)139- [ ] **Spelling**: Run spellcheck.140- [ ] **Versioning**: Is the version number consistent across files?