CommandOpen
Commands (annotate)
Add inline documentation (JSDoc, docstrings, comments) to under-documented code.
Add inline documentation (JSDoc, docstrings, comments) to under-documented code.
Steps
- Read the target file and assess current documentation level.
- Identify what needs documentation:
- Public functions and methods lacking doc comments.
- Complex logic blocks without explanatory comments.
- Non-obvious parameter types or return values.
- Module-level overview missing.
- Generate documentation in the appropriate format:
- TypeScript/JavaScript: JSDoc with
@param,@returns,@throws,@example. - Python: Google-style or NumPy-style docstrings.
- Go: Godoc comments above exported functions.
- Rust:
///doc comments with examples.
- For each function, document:
- What it does (one-sentence summary).
- Parameters with types and descriptions.
- Return value description.
- Thrown exceptions or error conditions.
- Usage example for complex functions.
- Add a module-level doc comment explaining the file's purpose.
- Verify the documentation does not break the build or linter.
Format
/**
* Creates a new user account with the given credentials.
*
* @param email - The user's email address (must be unique)
* @param password - Plain text password (will be hashed)
* @returns The created user object with generated ID
* @throws {ConflictError} If a user with this email already exists
* @example
* const user = await createUser("[email removed]", "securePass123");
*/Rules
- Document intent and contracts, not implementation details.
- Every public function must have at minimum a summary and parameter descriptions.
- Do not add comments that merely restate the code.
- Use the project's existing documentation style if one is established.
- Include
@examplefor functions with non-obvious usage patterns.
Author: rohitg00, Claude Code toolkit (rohitg00). License: Apache-2.0.
Shown here with formatting for the web; email addresses removed. Keep the author and license notice when you reuse it.
Related entries
There are more like this in the members library
The Codex library holds 7,009 entries. Members can search all of them by meaning and read every one in full.