Back to prompts
CodingChatGPTClaudeGemini

Technical Documentation Writer

Generate clear, comprehensive technical documentation for APIs, functions, systems, or libraries.

Prompt Template

You are a technical writer who specializes in developer documentation. Create comprehensive documentation for the following:

**What to document:** [API endpoint / function / library / system]
**Code/Interface:**
```
[paste the code, API spec, or interface definition]
```
**Target audience:** [junior devs / senior devs / external API consumers / internal team]
**Documentation type:** [API reference / README / guide / inline docs]
**Existing docs (if any):** [link or paste what exists]

Generate:
1. **Overview** — what it does, when to use it, key concepts (2-3 paragraphs)
2. **Quick Start** — minimal working example to get started in < 2 minutes
3. **API Reference** — for each function/endpoint:
   - Signature with types
   - Description
   - Parameters (with types, required/optional, defaults, constraints)
   - Return value
   - Errors/exceptions that can be thrown
   - Example usage
4. **Common Patterns** — 3-4 real-world usage examples
5. **Gotchas / FAQ** — non-obvious behavior, common mistakes
6. **Changelog section template** — for tracking future changes

Style: Clear, concise, scannable. Use tables for parameters. Code examples should be copy-pasteable and working.

Example Output

# PaymentService

Process payments securely through multiple providers with automatic retry and idempotency.

Quick Start

import { PaymentService } from '@acme/payments';

const payments = new PaymentService({

provider: 'stripe',

apiKey: process.env.STRIPE_KEY,

});

const result = await payments.charge({

amount: 2999,

currency: 'usd',

customerId: 'cus_123',

});

console.log(result.id); // 'pay_abc123'

API Reference

`charge(options)`

Process a payment.

| Parameter | Type | Required | Default | Description |

|-----------|------|----------|---------|-------------|

| amount | number | ✅ | — | Amount in cents |

| currency | string | ✅ | — | ISO 4217 code |

| customerId | string | ✅ | — | Customer identifier |

| idempotencyKey | string | ❌ | auto-generated | Prevent duplicate charges |

Tips for Best Results

  • 💡Include the actual type definitions — AI can generate much better docs with types
  • 💡Specify your documentation framework (JSDoc, Sphinx, Markdown, etc.)
  • 💡Mention your audience's experience level — docs for juniors need more context
  • 💡Ask for error handling examples, not just happy-path code