generate-api-docs
Create API reference documentation from docstrings. Use when documenting public module interfaces.
When & Why to Use This Skill
This Claude skill automates the creation of professional API reference documentation by extracting docstrings directly from source code. It streamlines the technical writing workflow for developers, ensuring that public module interfaces, libraries, and APIs are accurately documented with minimal manual effort while maintaining high consistency and SEO-friendly output.
Use Cases
- Case 1: Automatically generating comprehensive HTML or Markdown reference guides for Python libraries using pdoc or Sphinx integration.
- Case 2: Maintaining up-to-date API specifications by syncing documentation with code changes through automated docstring parsing.
- Case 3: Standardizing documentation quality across large codebases by validating and extracting structured docstrings (Google, NumPy, or reStructuredText formats).
- Case 4: Creating detailed developer portals that include function signatures, parameter types, return values, and usage examples extracted directly from the source.
| name | generate-api-docs |
|---|---|
| description | "Create API reference documentation from docstrings. Use when documenting public module interfaces." |
| mcp_fallback | none |
| category | generation |
| tier | 2 |
| user-invocable | false |
Generate API Docs
Extract docstrings from functions and classes to automatically generate API reference documentation.
When to Use
- Documenting public module interfaces
- Creating reference guides for libraries
- Generating HTML API documentation
- Maintaining up-to-date API specs
Quick Reference
# Python with pdoc
pdoc --html module_name -o docs/
# Python with Sphinx
sphinx-quickstart docs/
make -C docs html
# Extract docstrings
python3 -c "import module; help(module.function)"
Workflow
- Ensure docstrings: Verify all public functions/classes have docstrings
- Validate format: Check docstring format (Google, NumPy, or reStructuredText)
- Extract metadata: Parse function signatures, parameter types, return types
- Generate documentation: Create HTML or Markdown API reference
- Validate output: Verify links work and examples are correct
Output Format
API documentation:
- Module overview
- Function/class signatures with type hints
- Parameter documentation (type, description, default)
- Return value documentation
- Raises/exceptions
- Code examples
- Cross-references to related APIs
References
- See
generate-docstringsskill for creating docstrings - See CLAUDE.md > Documentation for standards
- See
doc-issue-readmeskill for issue documentation