/generate-docs [path]
Generate documentation. Public APIs MUST be documented.
First: Activate Workflow
bash
mkdir -p .claude && echo '{"skill":"doc-code","started":"'$(date -Iseconds)'"}' > .claude/active-workflow.json
Craft Standards (MANDATORY)
Write documentation a master craftsperson would be proud of.
Documentation must look like it was written by a skilled human technical writer, not generated by AI.
AI Antipatterns in Documentation to REJECT
- •Restating the obvious (
@param name - the name) - •Verbose descriptions that add no information
- •Generic placeholder text ("This function handles...")
- •Documenting every private/internal detail
- •Comments that describe WHAT instead of WHY
- •Changelog-style comments in code
Human Craft in Documentation
- •Document the WHY, not the obvious WHAT
- •Clear examples that show real usage
- •Concise descriptions that respect the reader's time
- •JSDoc that adds value beyond the type signature
- •README sections that help users get started fast
Test: Would someone learn something from this doc they couldn't infer from the code? If not, cut it.
⚠️ STRICT REQUIREMENTS - NO JUDGMENT CALLS
You MUST do these documentation tasks. Not "consider" - DO:
- •PUBLIC FUNCTIONS - Add JSDoc/TSDoc to EVERY exported function
- •COMPLEX LOGIC - Add inline comments for non-obvious code
- •README - Update if feature adds new usage/commands
- •TYPES - Document non-obvious type fields
FORBIDDEN (Phase will FAIL if detected):
- •Over-documenting obvious code
- •Adding comments that just repeat the code
- •Saying "documentation would help" without writing it
- •Skipping JSDoc on public APIs
- •Writing vague descriptions ("handles the thing")
Process
- •Analyze - Identify what needs documentation
- •Document - Add JSDoc to public APIs, inline comments where needed
- •Update README - If feature affects usage
- •Report - List what was documented
REQUIRED Output Format
markdown
## Documentation: [target] DOCUMENTED: - src/service.ts: 5 functions with JSDoc - src/types.ts: 3 types with field comments - README.md: Added "Usage" section for new feature PUBLIC_APIS_DOCUMENTED: N README_UPDATED: yes/no COMMENTS_ADDED: N APPLIED: - [expert]: [decision] DOC_COMPLETE
Validation (Phase will FAIL if violated)
- •No DOCUMENTED section
- •PUBLIC_APIS_DOCUMENTED: 0 when public functions exist
🛑 MANDATORY STOP
After documenting:
- •DO NOT proceed to any other workflow step
- •DO NOT make additional code changes
Your turn ends here. Output DOC_COMPLETE and STOP.