Agent skill
generate-docstrings
Create docstrings for functions and classes. Use when documenting code APIs.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/generation/generate-docstrings-majiayu000-claude-skill-registr
SKILL.md
Generate Docstrings
Write comprehensive docstrings for functions and classes following standard formats (Google, NumPy, reStructuredText).
When to Use
- Adding documentation to undocumented functions
- Improving code documentation completeness
- Ensuring consistent docstring format
- Supporting API documentation generation
Quick Reference
# Google-style docstring format
def matrix_multiply(a: ExTensor, b: ExTensor) -> ExTensor:
"""Multiply two matrices using optimized Mojo kernels.
Args:
a: First matrix (shape: m x n)
b: Second matrix (shape: n x k)
Returns:
Product matrix (shape: m x k)
Raises:
ValueError: If matrix dimensions don't align for multiplication
Example:
```mojo
>> a = ExTensor([[1, 2], [3, 4]], DType.float32)
>>> b = ExTensor([[1, 0], [0, 1]], DType.float32)
>>> c = matrix_multiply(a, b)
```
"""
...
Workflow
- Analyze function: Understand purpose, parameters, return value
- Choose format: Select docstring style (Google is recommended)
- Write summary: Clear one-line description
- Document parameters: Type, description, constraints
- Document return: Type and description of return value
- Add examples: Practical usage examples
Output Format
Docstring structure:
- One-line summary
- Extended description (if needed)
- Args section (parameter documentation)
- Returns section (return value documentation)
- Raises section (exceptions)
- Examples section (usage examples)
References
- See
generate-api-docsskill for API documentation generation - See Google Python Style Guide for docstring conventions
- See PEP 257 for Python docstring conventions
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?