← All cheatsheets

AI prompts

AI documentation prompts — turn code into docs in minutes

Templates that produce usable first-draft docs. Paste the source file or function after the prompt.

## 1. Function doc
```
Generate a docstring for this function: one-sentence summary,
"Arguments:" block, "Returns:" block, "Raises:" block. Plain
English. No marketing words. Match the language's docstring
convention.
```

## 2. README seed
```
Produce a README.md for this codebase: Overview (2-3 sentences),
Setup, Usage (3 concrete examples), Configuration, Development,
Testing, Deployment. No emoji. No marketing language. Use the
actual command names from the codebase.
```

## 3. API reference from routes
```
For each route/endpoint in this file, output a table row:
| Method | Path | Auth | Description | Sample request | Sample response |
```

## 4. Architecture summary
```
Read these files and write a 5-paragraph "How this works"
overview targeted at a senior engineer who'll spend 10 minutes
reading it. Cover: what the system does, the major components,
the data flow, what's tricky, and where the seams are.
```

## 5. Changelog entry
```
Given this diff vs. main, write a CHANGELOG.md entry following
Keep-a-Changelog format. Group as Added/Changed/Fixed/Removed.
Each bullet ends with a period. No conjecture about user impact
unless the diff makes it explicit.
```

## 6. Migration guide
```
Given the diff between v1 and v2 of this library, write a
"Migrating from v1 to v2" doc: breaking changes (with before/
after code), deprecations, and a checklist.
```

## 7. Runbook
```
Write a 1-page incident runbook for the system in this code:
known failure modes, how to detect, how to triage, how to
restore. Use bullet lists. No paragraphs.
```

## 8. ADR (Architecture Decision Record)
```
Write an ADR for this design choice. Sections: Status, Context,
Decision, Consequences. Under 300 words.
```