SKILL.md
When to Activate
- User asks to write or update a README, API docs, or architecture decision record
- User needs to add JSDoc, docstrings, or inline documentation to code
- User wants to generate documentation from existing code or APIs
- User asks to review documentation for accuracy or completeness
- User needs to create an onboarding guide or contributing guide
- User mentions writing docs, drafting proposals, specs, decision docs, or RFCs
- User wants to co-author a document through structured iteration
Skip When
- User wants a branded PDF report or proposal — use codi-content-factory
- User wants a Word document (.docx) — use codi-docx
- User wants a slide deck or presentation — use codi-content-factory or codi-pptx
- User wants to regenerate Codi’s own docs site — use codi-dev-docs-manager
- User wants to humanize AI-sounding text — use codi-humanizer after this skill
Diataxis Framework
Before writing, classify the documentation type:
- Tutorial: learning-oriented, step-by-step guided experience
- How-to Guide: task-oriented, solving a specific problem
- Reference: information-oriented, factual description of APIs/config
- Explanation: understanding-oriented, discussing concepts and reasoning
Do not mix types in one document — a tutorial should not include exhaustive reference tables.
Documentation Types
README
[CODING AGENT] Structure:
- Read existing README (if any)
- Include these sections in order:
- Overview: what the project does (1-3 sentences)
- Quick Start: install + first usage (copy-paste ready)
- Usage: key commands or API with examples
- Configuration: options, environment variables, config files
- Contributing: how to set up dev environment and submit changes
- Keep total under 300 lines — link to separate guides for details
- Include badges (CI status, version, license) at the top
API Documentation
[CODING AGENT] For each endpoint or public function:
- Method, path, and description
- Parameters with types and required/optional status
- Request body schema (if applicable)
- Response schema with status codes
- Working example (curl, fetch, or SDK call)
Use OpenAPI/Swagger for REST APIs. Use JSDoc/TypeDoc for library code.
Architecture Decision Records (ADR)
[HUMAN] Provide the context and decision.
[CODING AGENT] Format as:
- Title: short description of the decision
- Status: proposed, accepted, deprecated, superseded
- Context: what problem prompted this decision
- Decision: what was decided and why
- Consequences: trade-offs, what changes, what to watch for
Store in docs/adr/ with numbered filenames (001-use-postgres.md).
Code Comments
[CODING AGENT] Rules:
- Add JSDoc/docstring to all public APIs (functions, classes, interfaces)
- Comment the WHY, not the WHAT — the code shows what, comments explain why
- Remove commented-out code — version control has the history
- Use TODO with ticket references:
// TODO(JIRA-123): migrate to v2 endpoint
Docs-as-Code Workflow
- Store documentation in the same repository as code — changes ship together in the same PR
- Auto-generate API reference from OpenAPI specs or code annotations where possible
- Use CI to validate documentation: lint markdown, check broken links, test code examples
Co-Authoring Workflow
For substantial documents (proposals, specs, decision docs), offer this 3-stage workflow:
Stage 1 — Context Gathering
Goal: Close the gap between what the user knows and what the agent knows.
- Ask meta-context: document type, audience, desired impact, format/template, constraints
- Encourage an info dump: background, related discussions, alternative solutions, organizational context, timeline pressures, technical dependencies, stakeholder concerns
- Ask 5-10 clarifying questions based on gaps
- Continue until edge cases and trade-offs can be discussed without needing basics explained
Stage 2 — Refinement & Structure
Goal: Build the document section by section through brainstorming, curation, and iteration.
For each section:
- Clarify: Ask what to include in this section
- Brainstorm: Generate 5-20 candidate points (look for forgotten context, new angles)
- Curate: User selects what to keep/remove/combine
- Gap check: Ask if anything important is missing
- Draft: Write the section using
str_replaceor file edits - Refine: Iterate with surgical edits until the user is satisfied
Start with whichever section has the most unknowns. Leave summary sections for last.
After 80%+ of sections are done, re-read the entire document checking for: flow and consistency, redundancy, filler content, and whether every sentence carries weight.
Stage 3 — Reader Testing
Goal: Test the document with a fresh perspective to catch blind spots.
- Predict 5-10 reader questions
- If subagents are available: test each question with a fresh agent (no conversation context)
- If no subagents: guide the user to test in a fresh conversation
- Also check for: ambiguity, false assumptions, contradictions
- Fix any issues found, then loop back to refinement if needed
Exit condition: Reader consistently answers questions correctly with no new gaps.
Quality Checklist
- Language is clear and concise
- Classified by Diataxis type (tutorial, how-to, reference, explanation)
- Code examples are copy-paste ready and tested
- No outdated references to removed features
- Links work and point to current resources
- Diagrams use Mermaid (not ASCII art)
Available Agents
For specialized analysis, delegate to this agent:
- codi-docs-lookup — Research API signatures, verify deprecations, find examples. Prompt at
${CLAUDE_SKILL_DIR}[[/agents/docs-lookup.md]]
Related Skills
- codi-codebase-onboarding — Understand project structure before writing docs