| name | generate-docs |
| description | Use this skill to generate, update, or improve documentation. Triggered by
"write docs", "generate documentation", "update README", "document this code".
|
| argument-hint | [file, function, or module] |
| allowed-tools | Read, Write, Edit, Grep, Glob |
| context | fork |
Documentation Generator
Generate clear, accurate documentation for the specified code.
Target
$ARGUMENTS
!ls -la $ARGUMENTS 2>/dev/null || echo "Scanning for files..."
Instructions
-
Read all relevant source files for the target
-
Identify what needs documentation:
- Public functions, classes, and methods
- Module purpose and exports
- Configuration options
- Usage examples
-
Choose the appropriate format:
- JSDoc/TSDoc for TypeScript/JavaScript functions
- docstring for Python
- godoc for Go
- README.md for modules/repos
- API.md for REST API endpoints
-
Write documentation that includes:
- Purpose — what it does (1-2 sentences)
- Parameters — name, type, description, whether required
- Returns — type and description
- Throws — what errors can occur
- Example — minimal working example
- Notes — gotchas, performance notes, deprecations
JSDoc Example
Rules
- Do NOT fabricate behavior — only document what the code actually does
- Keep examples minimal but runnable
- If the code is confusing, note it and suggest a refactor
- Update existing docs rather than creating duplicates
- For READMEs: include install, usage, configuration, and contributing sections
$ARGUMENTS