Generate Documentation Skill
Create useful documentation from code - extract information and present it clearly.
Purpose
Transform code into documentation:
- •Extract types, signatures, and comments
- •Generate API documentation
- •Create/update README files
- •Discover and use documentation tools
Commands
| Command | Purpose |
|---|---|
/wicked-engineering:generate [path] | Generate docs from code |
/wicked-engineering:generate --api | Generate API documentation |
/wicked-engineering:generate --readme | Generate/update README |
/wicked-engineering:generate --types | Generate type documentation |
Quick Start
bash
# Generate general documentation /wicked-engineering:generate src/ # Generate API documentation /wicked-engineering:generate src/api --api # Update README /wicked-engineering:generate --readme
Process
1. Analyze Target
Understand what to document:
- •Language and framework
- •Code structure (functions, classes, modules)
- •Existing comments and docstrings
- •Type information
2. Discover Tools
Check for documentation tooling:
- •JavaScript/TypeScript: TypeDoc, JSDoc, Docusaurus
- •Python: Sphinx, MkDocs, pdoc
- •Rust: rustdoc, Go: godoc
If tools exist, use them. Otherwise extract manually.
3. Extract Information
From code, extract:
- •Function signatures and descriptions
- •Class structure and methods
- •API endpoints and schemas
- •Type definitions
4. Generate Documentation
Create focused, useful docs:
- •README: overview, installation, quick start
- •API docs: endpoints, parameters, responses
- •Reference: functions, classes, types
See Templates for standard formats.
Language Patterns
Extract from:
- •JavaScript/TypeScript: JSDoc comments and type definitions
- •Python: Docstrings and type hints
- •REST APIs: Route definitions and schemas
- •Other: Language-specific doc comments
Tool Integration
Check for existing doc tools (TypeDoc, Sphinx, rustdoc) and use them. If none exist, extract and generate manually.
Read project metadata from package.json or pyproject.toml for README generation.
Best Practices
- •Include Examples - Every function/endpoint needs an example
- •Use Type Information - Show parameter types clearly
- •Document Edge Cases - Note unusual behavior
- •Don't Generate Boilerplate - Focus on useful content
- •Update, Don't Replace - Preserve manual sections
Integration
Use wicked-search to find code to document. Use wicked-mem to learn and maintain project doc style.
Events
- •
[docs:generated:success]- Documentation created - •
[docs:readme:updated:success]- README updated - •
[docs:api:generated:success]- API docs generated
Tips
- •Use Existing Tools - Don't reinvent TypeDoc/Sphinx
- •Parse, Don't Guess - Read actual code structure
- •Include Examples - Show real usage
- •Extract from Tests - Tests are usage examples
- •Link Related Docs - Cross-reference related APIs
- •Update, Don't Replace - Preserve manual sections
Reference
- •Templates - Standard documentation templates