generated/claude/skills/documentation/SKILL.md
Documentation standards and best practices for code changes. Use when writing or reviewing documentation, adding public APIs, making user-facing changes, or checking documentation quality. Triggers on: 'use documentation mode', 'document', 'documentation', 'docstring', 'add docs', 'update docs', 'documentation review', 'API documentation', 'README update'. Full access mode - can write documentation and update code comments.
npx skillsauth add mcouthon/agents documentationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Write documentation that serves humans and AI agents. Keep it accurate, layered, and close to the code.
"Documentation is a love letter that you write to your future self." — Damian Conway
Documentation lives in layers. Each layer has a distinct audience, scope, and update cadence.
| Layer | Audience | Scope | Update Frequency | | ----------------------------- | ------------------------ | ------------------------- | ------------------------ | | Code comments | Maintainers, AI agents | Single block / decision | Every code change | | Docstrings | Consumers, AI agents | Function / class contract | Every signature change | | Module docs | Team members, onboarding | File / package purpose | When module role changes | | Project docs (README, guides) | All stakeholders | System / feature | Every user-facing change | | Architecture docs (ADRs) | Maintainers, future devs | Design decisions | When decisions are made |
| Audience | What They Need | Key Layers | | -------------------------- | --------------------------------------------- | --------------------------------------- | | Internal maintainers | Intent, trade-offs, edge cases | Comments, docstrings, ADRs | | New team members | Orientation, key concepts, how things connect | Module docs, README, architecture | | External users / consumers | How to use it, API contracts | README, API reference, how-to guides | | AI agents | Purpose, contracts, intent behind decisions | Docstrings, architecture docs, comments |
// Workaround for #1234Follow the Diátaxis framework (see below). Keep docs in the repo, close to what they describe.
Four types of documentation, each serving a different user need:
| Type | Orientation | Answers | Structure | | ---------------- | ------------- | ------------------------------- | ------------------------------------------- | | Tutorial | Learning | "Follow these steps to learn X" | Step-by-step, hands-on, minimal explanation | | How-to Guide | Task | "How to accomplish X" | Goal-oriented steps, assumes knowledge | | Reference | Information | "Specification of X" | Precise, complete, consistent structure | | Explanation | Understanding | "Why X works this way" | Conceptual, discursive, gives context |
Common mistakes:
- [ ] Public APIs have complete docstrings (params, returns, raises)
- [ ] Code comments explain "why", not "what"
- [ ] No stale documentation (matches current behavior)
- [ ] User-facing changes reflected in README or relevant guides
- [ ] New modules have a brief purpose description at top of file
- [ ] Architecture-significant decisions documented (ADR or equivalent)
- [ ] Examples are runnable and up-to-date
- [ ] CHANGELOG updated for user-visible changes
| Anti-Pattern | Problem | Correction | | ---------------------------------------- | --------------------------- | ---------------------------------------------- | | Comment restates the code | Noise, drifts out of sync | Delete or explain the why | | Docstring describes implementation | Couples docs to internals | Focus on the contract (what, not how) | | README lists features that don't exist | Misleading, erodes trust | Audit docs against actual behavior | | Docs live only in PR/commit messages | Invisible to future readers | Move to permanent location in repo | | Over-documenting trivial code | Clutter, maintenance burden | Skip obvious getters/setters/constructors | | Copy-pasting docstrings across overloads | Drift between copies | Document the base, reference it from overloads | | Huge top-of-file comment blocks | Nobody reads them | Keep to one paragraph; link to detailed docs |
Follow the standard specified by each language's instruction file. Do not invent custom formats.
| Language | Standard | Reference |
| ---------- | ------------ | ------------------------------------------------ |
| Python | Google style | python.instructions.md — Documentation section |
| TypeScript | TSDoc | TSDoc conventions |
| JavaScript | JSDoc | JSDoc conventions |
When a language-specific instruction file doesn't cover documentation, apply these defaults:
@param + @returns + @throwsAI agents consume documentation differently than humans. Optimize for both.
What helps agents most:
| Documentation Element | Agent Benefit | | ---------------------------------------- | -------------------------------------------- | | Docstrings with typed params | Navigation, correct usage, type inference | | Module-level purpose comments | Understanding component responsibility | | Architecture docs | High-level context for cross-cutting changes | | "Why" comments | Making correct decisions about modifications | | Explicit contracts (pre/post conditions) | Safe refactoring boundaries |
Principles:
development
Systematic debugging with hypothesis-driven investigation. Use when something is broken, tests are failing, unexpected behavior occurs, or errors need investigation. Triggers on: 'this is broken', 'debug', 'why is this failing', 'unexpected error', 'not working', 'bug', 'fix this issue', 'investigate', 'tests failing', 'trace the error', 'use debug mode'. Full access mode - can run commands, add logging, and fix issues.
development
Systematic debugging with hypothesis-driven investigation. Use when something is broken, tests are failing, unexpected behavior occurs, or errors need investigation. Triggers on: 'this is broken', 'debug', 'why is this failing', 'unexpected error', 'not working', 'bug', 'fix this issue', 'investigate', 'tests failing', 'trace the error', 'use debug mode'. Full access mode - can run commands, add logging, and fix issues.
testing
Behavioral testing strategy — deciding what to test and how. Use when writing tests, reviewing test quality, or fixing tests that test mocks instead of behavior. Triggers on: 'use testing mode', 'write tests', 'test strategy', 'tests are brittle', 'tests test mocks', 'improve test quality', 'what should I test'. Full access mode - can write and run tests.
development
Use when finding code smells, auditing TODOs, removing dead code, cleaning up unused imports, or assessing code quality. Triggers on: 'use tech-debt mode', 'tech debt', 'code smells', 'clean up', 'remove dead code', 'delete unused', 'simplify'. Full access mode - can modify files and run tests.