Skip to main content
skill CX Codex

code-documentation · moizibnyousaf — Claude Code skill: docs for your codebase

A skill that gives the agent fixed templates for READMEs, API reference, inline comments and architecture notes.

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

What code-documentation does

The skill spells out how documentation should look in a repo: a README template with Quick Start, Installation, Usage, API Reference, Configuration, Contributing and License sections, JSDoc/TSDoc style for functions and interfaces, and an OpenAPI 3.0.0 layout for HTTP endpoints. It also draws a line between comments worth writing and comments worth deleting — explain why the code does something, not what the next line says, and drop stale comments since they mislead worse than silence.

Architecture gets its own section. An ADR follows Status, Context, Decision, Rationale and Consequences, while a component write-up covers the overview, the flow, dependencies and config variables. The JWT example walks through a login request to /auth/login, token lifetimes and storing refresh tokens in Redis.

Installation differs by platform. Copilot uses gh skill install, the rest go through npx skills add. One thing to settle first: if your project already has a house README format, the template will push the agent to rewrite sections its own way, so decide which structure wins before you run it.

What it helps with

  • draft a README with quick start and install steps
  • document a function in JSDoc with params and throws
  • record a database choice as an ADR
  • strip comments that just restate the code
  • write up an auth module: flow, dependencies, env vars

Example prompts for the agent

  • write a README for this project using the skill template
  • document the auth module: flow, dependencies and configuration
  • review comments in src/auth.ts and drop the ones that repeat the code

How to install code-documentation

1Skills CLI (Vercel)

npx skills add MoizIbnYousaf/ai-agent-skills --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 MoizIbnYousaf/ai-agent-skills --skill code-documentation -a claude-code. The skill file lands at ~/.claude/skills/code-documentation/SKILL.md.

What does code-documentation do?

It hands the agent templates for READMEs, JSDoc/TSDoc and OpenAPI API reference, inline comments and ADR notes. It kicks in when you ask for docs on a codebase or a developer guide.

How is it different from plain README generation?

It covers more than the README: there are rules for inline comments, an OpenAPI schema and an ADR format with a Consequences section. It also lists when a comment should not be written at all.

Source text

SKILL.md · MIT
---
name: code-documentation
description: Writing effective code documentation - API docs, README files, inline comments, and technical guides. Use for documenting codebases, APIs, or writing developer guides.
source: wshobson/agents
license: MIT
version: 4.1.0
---

# Code Documentation

## README Structure

### Standard README Template
```markdown
# Project Name

Brief description of what this project does.

## Quick Start

\`\`\`bash
npm install
npm run dev
\`\`\`

## Installation

Detailed installation instructions...

## Usage

\`\`\`typescript
import { something } from 'project';

// Example usage
const result = something.doThing();
\`\`\`

## API Reference

### `functionName(param: Type): ReturnType`

Description of what the function does.

**Parameters:**
- `param` - Description of parameter

**Returns:** Description of return value

**Example:**
\`\`\`typescript
const result = functionName('value');
\`\`\`

## Configuration

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `option1` | `string` | `'default'` | What it does |

## Contributing

How to contribute...

## License

MIT
```

## API Documentation

### JSDoc/TSDoc Style
```typescript
/**
 * Creates a new user account.
 *
 * @param userData - The user data for account creation
 * @param options - Optional configuration
 * @returns The created user object
 * @throws {ValidationError} If email is invalid
 * @example
 * ```ts
 * const user = await createUser({
 *   email: '[email protected]',
 *   name: 'John'
 * });
 * ```
 */
async function createUser(
  userData: UserInput,
  options?: CreateOptions
): Promise<User> {
  // Implementation
}

/**
 * Configuration options for the API client.
 */
interface ClientConfig {
  /** The API base URL */
  baseUrl: string;
  /** Request timeout in milliseconds @default 5000 */
  timeout?: number;
  /** Custom headers to include in requests */
  headers?: Record<string, string>;
}
```

### OpenAPI/Swagger
```yaml
openapi: 3.0.0
info:
  title: My API
  version: 1.0.0

paths:
  /users:
    post:
      summary: Create a user
      description: Creates a new user account
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserInput'
      responses:
        '201':
          description: User created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '400':
          description: Invalid input

components:
  schemas:
    UserInput:
      type: object
      required:
        - email
        - name
      properties:
        email:
          type: string
          format: email
        name:
          type: string
    User:
      type: object
      properties:
        id:
          type: string
        email:
          type: string
        name:
          type: string
        createdAt:
          type: string
          format: date-time
```

## Inline Comments

### When to Comment
```typescript
// GOOD: Explain WHY, not WHAT

// Use binary search because the list is always sorted and
// can contain millions of items - O(log n) vs O(n)
const index = binarySearch(items, target);

// GOOD: Explain complex business logic
// Users get 20% discount if they've been members for 2+ years
// AND have made 10+ purchases (per marketing team decision Q4 2024)
if (user.memberYears >= 2 && user.purchaseCount >= 10) {
  applyDiscount(0.2);
}

// GOOD: Document workarounds
// HACK: Safari doesn't support this API, fallback to polling
// TODO: Remove when Safari adds support (tracking: webkit.org/b/12345)
if (!window.IntersectionObserver) {
  startPolling();
}
```

### When NOT to Comment
```typescript
// BAD: Stating the obvious
// Increment counter by 1
counter++;

// BAD: Explaining clear code
// Check if user is admin
if (user.role === 'admin') { ... }

// BAD: Outdated comments (worse than no comment)
// Returns the user's full name  <-- Actually returns email now!
function getUserIdentifier(user) {
  return user.email;
}
```

## Architecture Documentation

### ADR (Architecture Decision Record)
```markdown
# ADR-001: Use PostgreSQL for Primary Database

## Status
Accepted

## Context
We need a database for storing user data and transactions.
Options considered: PostgreSQL, MySQL, MongoDB, DynamoDB.

## Decision
Use PostgreSQL with Supabase hosting.

## Rationale
- Strong ACID compliance needed for financial data
- Team has PostgreSQL experience
- Supabase provides auth and realtime features
- pgvector extension for future AI features

## Consequences
- Need to manage schema migrations
- May need read replicas for scale
- Team needs to learn Supabase-specific features
```

### Component Documentation
```markdown
## Authentication Module

### Overview
Handles user authentication using JWT tokens with refresh rotation.

### Flow
1. User submits credentials to `/auth/login`
2. Server validates and returns access + refresh tokens
3. Access token used for API requests (15min expiry)
4. Refresh token used to get new access token (7d expiry)

### Dependencies
- `jsonwebtoken` - Token generation/validation
- `bcrypt` - Password hashing
- `redis` - Refresh token storage

### Configuration
- `JWT_SECRET` - Secret for signing tokens
- `ACCESS_TOKEN_EXPIRY` - Access token lifetime
- `REFRESH_TOKEN_EXPIRY` - Refresh token lifetime
```

## Documentation Principles

1. **Write for your audience** - New devs vs API consumers
2. **Keep it close to code** - Docs in same repo, near relevant code
3. **Update with code** - Stale docs are worse than none
4. **Examples over explanations** - Show, don't just tell
5. **Progressive disclosure** - Quick start first, details later

© MoizIbnYousaf · MIT · MoizIbnYousaf/ai-agent-skills

Similar skills

Everything for Writing and docs →

code-documentation by other authors comes first.

code-documentation bytedance This skill auto-generates README files, API references, architecture docs, and developer guides straight from your codebase. Use it to document projects, libraries, and APIs without manual effort. CX Codex +1 1,900installs code-documentation aj-geddes 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. CX Codex +1 492installs update-docs NeoLabHQ Updates project documentation based on uncommitted git changes or the latest commit. Keeps README files, docs/, and JSDoc comments synchronized with your codebase. CX Codex +1 1,300installs api-docs ruvnet Skill that turns TypeScript and JavaScript source into documentation: it finds public exports, reads existing JSDoc, writes the missing comments and emits OpenAPI 3.0 for HTTP endpoints. CX Codex +1 891installs documentation official anthropics A skill for technical writing that drafts READMEs, API references, runbooks, architecture docs and onboarding guides. Useful when the code exists but the description does not. CX Codex +1 10,300installs technical-documentation wondelai A skill that audits and rewrites developer documentation against Google's style guide: READMEs, how-tos, API references, changelogs. Useful when your docs drift in tone and structure. CX Codex +1 1,400installs markdown-documentation aj-geddes A skill that gives the agent a fixed set of Markdown rules for READMEs, wikis and docs pages. Useful when the model writes the text and it has to look consistent. CX Codex +1 1,300installs documentation-engineer zhaono1 A skill for writing technical documentation: READMEs, API references, code comments and architecture notes. Useful when the codebase has grown but the docs have not. CX Codex +1 711installs

From the same set6

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