code-documentation · aj-geddes — Claude Code skill: JSDoc, docstrings, comments
A skill that makes the agent write documentation inside your code: JSDoc, Python docstrings, JavaDoc, inline comments and API notes. Useful when functions and classes need describing, not rewriting.
npx skills add aj-geddes/useful-ai-prompts --skill code-documentation -a claude-codeWhat code-documentation does
The skill sets documentation standards for the agent across languages. It covers function and class docs, JSDoc for JavaScript and TypeScript, Python docstrings, JavaDoc, inline comments, type definitions and usage examples embedded in code. Inside you get a short JavaScript starter example plus a references/ directory with longer guides on function, class, type and module documentation.
The rules are blunt. Document public APIs, include usage examples, describe parameters, return values and thrown exceptions. A comment should explain why, not what — skip the obvious. There is also a list of things to avoid: commented-out code, misleading comments, vague parameter descriptions, and docs left stale after the code changes.
The skill installs on six platforms, and each keeps the file somewhere different: ~/.claude/skills/code-documentation/SKILL.md in Claude, .cursor/skills/code-documentation/SKILL.md in Cursor. If your project already follows its own comment style, expect the skill to push code toward the standards it describes — worth checking whether the two agree.
What it helps with
- document public functions and classes to a language standard
- write JSDoc for a JavaScript or TypeScript module
- add Python docstrings with parameters and exceptions
- attach usage examples to a tricky function
- describe a whole module and its types
Example prompts for the agent
- document the functions in
src/utils/price.jswith JSDoc - add docstrings to the class in
models/user.py, with usage examples - go through this module and comment the parts where the logic is not obvious
How to install code-documentation
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill code-documentation -a claude-code2Manually: put the files in place
~/.claude/skills/code-documentation/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/code-documentation/
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill code-documentation -a codex2Manually: put the files in place
.agents/skills/code-documentation/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill code-documentation -a cursor2Manually: put the files in place
.cursor/skills/code-documentation/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install aj-geddes/useful-ai-prompts code-documentation2Manually: put the files in place
.github/skills/code-documentation/SKILL.md1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill code-documentation -a gemini-cli2Platform CLI
gemini skills install https://github.com/aj-geddes/useful-ai-prompts --path skills/code-documentationManually: put the files in place
.devin/skills/code-documentation/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill code-documentation -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about code-documentation
How do I install code-documentation in Claude?
Run npx skills add aj-geddes/useful-ai-prompts --skill code-documentation -a claude-code. The skill lands in ~/.claude/skills/code-documentation/SKILL.md.
What does code-documentation do?
It guides the agent through writing in-code documentation: JSDoc, Python docstrings, JavaDoc, inline comments and API descriptions. It follows the conventions of the language at hand.
Which languages does the skill cover?
The examples and reference guides cover JavaScript and TypeScript with JSDoc, Python with docstrings, and Java with JavaDoc. The general rules on parameters, exceptions and examples carry over to other languages.
Source text
SKILL.md · MIT
---
name: code-documentation
description: >
Write comprehensive code documentation including JSDoc, Python docstrings,
inline comments, function documentation, and API comments. Use when
documenting code, writing docstrings, or creating inline documentation.
---
# Code Documentation
## Table of Contents
- [Overview](#overview)
- [When to Use](#when-to-use)
- [Quick Start](#quick-start)
- [Reference Guides](#reference-guides)
- [Best Practices](#best-practices)
## Overview
Create clear, comprehensive code documentation using language-specific standards like JSDoc, Python docstrings, JavaDoc, and inline comments.
## When to Use
- Function and class documentation
- JSDoc for JavaScript/TypeScript
- Python docstrings
- JavaDoc for Java
- Inline code comments
- API documentation from code
- Type definitions
- Usage examples in code
## Quick Start
Minimal working example:
```javascript
/**
* Calculates the total price including tax and discount.
*
* @param {number} basePrice - The base price before tax and discount
* @param {number} taxRate - Tax rate as a decimal (e.g., 0.08 for 8%)
* @param {number} [discount=0] - Optional discount amount
* @returns {number} The final price after tax and discount
* @throws {Error} If basePrice or taxRate is negative
*
* @example
* const price = calculateTotalPrice(100, 0.08, 10);
* console.log(price); // 98
*
* @example
* // Without discount
* const price = calculateTotalPrice(100, 0.08);
* console.log(price); // 108
*/
function calculateTotalPrice(basePrice, taxRate, discount = 0) {
if (basePrice < 0 || taxRate < 0) {
throw new Error("Price and tax rate must be non-negative");
}
return basePrice * (1 + taxRate) - discount;
}
// ... (see reference guides for full implementation)
```
## Reference Guides
Detailed implementations in the `references/` directory:
| Guide | Contents |
|---|---|
| [Function Documentation](references/function-documentation.md) | Function Documentation |
| [Class Documentation](references/class-documentation.md) | Class Documentation |
| [Type Definitions](references/type-definitions.md) | Type Definitions |
| [Function Documentation](references/function-documentation-2.md) | Function Documentation |
| [Class Documentation](references/class-documentation-2.md) | Class Documentation |
| [Module Documentation](references/module-documentation.md) | Module Documentation |
## Best Practices
### ✅ DO
- Document public APIs thoroughly
- Include usage examples
- Document parameters and return values
- Specify thrown exceptions/errors
- Use language-specific standards (JSDoc, docstrings, etc.)
- Keep comments up-to-date
- Document "why" not "what"
- Include edge cases and gotchas
- Add links to related functions
- Document type definitions
- Use consistent formatting
### ❌ DON'T
- State the obvious in comments
- Leave commented-out code
- Write misleading comments
- Skip examples for complex functions
- Use vague parameter descriptions
- Forget to update docs when code changes
- Over-comment simple code
© aj-geddes · MIT · aj-geddes/useful-ai-prompts
Similar skills
Everything for Writing and docs →code-documentation by other authors comes first.