| name | docstring |
| description | Generate documentation comments for code. Use when user says "add comments", "generate docs", "add JSDoc/docstring/JavaDoc", or highlights undocumented code. |
Documentation Generator
Generate proper documentation comments for the selected code.
Workflow
- Read the selected code
- Detect the language
- Generate appropriate documentation format
- Insert comments without changing any code logic
Format by Language
JavaScript/TypeScript → JSDoc
Python → Docstring
def function_name(param1, param2):
"""
Description of what the function does.
Args:
param1 (str): Description
param2 (int): Description
Returns:
dict: Description of return value
Raises:
ValueError: When conditions
Example:
>>> function_name("hello", 42)
{"result": "ok"}
"""
Java → JavaDoc
Go → GoDoc
Rules
- Don't change the code, only add comments
- Don't over-document obvious things (e.g.,
// i++ increments i)
- Focus on WHAT and WHY, not HOW
- Document edge cases and assumptions
- Keep existing comments intact