Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add aj-geddes/useful-ai-prompts --skill code-documentation -a claude-code
Open on GitHub

What 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.js with 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-code

2Manually: put the files in place

~/.claude/skills/code-documentation/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/code-documentation/

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.

From the same set118

grafana-dashboard Lets your agent write Grafana dashboards: panels, template variables, alerts and provisioning. Handy when you need monitoring up before the next deploy. CX Codex +1 494installs Model Hyperparameter Tuning A skill for tuning model hyperparameters: grid search, random search, Bayesian optimization with Optuna. Useful once baseline settings stop improving. CX Codex +1 494installs api-reference-documentation A skill that walks the agent through writing API reference docs: endpoints, auth, request and response examples, OpenAPI specs. CX Codex +1 494installs database-performance-debugging A skill that walks your agent through finding slow SQL queries and reading their execution plans. Useful when the app drags or the database burns CPU. CX Codex +1 493installs reactive-programming A skill for reactive streams in RxJS: observables, operators, backpressure. Useful when a project leans on async data and events. CX Codex +1 491installs api-pagination A skill that tells the agent how to page through big collections: offset/limit, cursors, keyset. Useful when a user list or search result set outgrows one response. CX Codex +1 489installs nosql-database-design Guides the agent through NoSQL schema work: MongoDB collections, DynamoDB tables, embedding vs referencing, indexes. Useful before the schema hardens in code. CX Codex +1 486installs database-indexing-strategy A skill for planning indexes: picks the type, builds composite and partial ones, covers maintenance. Useful when queries slow down. CX Codex +1 486installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor