# Code Documentation

Writing effective code documentation - API docs, README files, inline comments, and...

- Repository: https://github.com/MoizIbnYousaf/ai-agent-skills (1155 stars)
- Category: Writing
- License: MIT
- Last updated: 2026-09-21
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add MoizIbnYousaf/ai-agent-skills --skill code-documentation -g -a claude-code -y`
Codex: `npx skills add MoizIbnYousaf/ai-agent-skills --skill code-documentation -g -a codex -y`
Cursor: `npx skills add MoizIbnYousaf/ai-agent-skills --skill code-documentation -g -a cursor -y`
Gemini CLI: `npx skills add MoizIbnYousaf/ai-agent-skills --skill code-documentation -g -a gemini-cli -y`

## Description

Writing effective code documentation - API docs, README files, inline comments, and technical guides. Use for documenting codebases, APIs, or writing developer guides.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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: 'user@example.com',
 *   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

The rest: https://github.com/MoizIbnYousaf/ai-agent-skills/blob/HEAD/skills/code-documentation/SKILL.md
