/docgen:docgenfrom docgen
Generates or updates project documentation (README, API references, architecture overviews, changelogs) from codebase analysis. Invoke via /docgen with a doc type and optional scope.
Ships in docgen. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Generate or update project documentation from the codebase — READMEs, API references, architecture overviews, and changelogs. Designed to produce accurate, non-padded docs that match the project's existing style.
Core principles:
/docgen readme # generate or update project README
/docgen readme src/auth/ # README for a subdirectory or package
/docgen api src/routes/ # API endpoint documentation
/docgen architecture # architecture overview from codebase structure
/docgen changelog v0.2.0..v0.3.0 # changelog from git history for a version range
You MUST follow this order. No skipping steps.
Determine doc type and scope:
| Doc Type | Detection | Scope Default |
|---|---|---|
readme | First arg is "readme" | Project root or specified path |
api | First arg is "api" | Specified path (required); error if missing |
architecture | First arg is "architecture" | Project root |
changelog | First arg is "changelog" | Optional git range (e.g. v0.2.0..v0.3.0); defaults to recent history |
If no argument or unrecognized type: say "Usage: /docgen readme, /docgen api src/routes/, /docgen architecture, /docgen changelog [range]." Then stop.
If api is invoked without a path: say "Please provide a path. Example: /docgen api src/routes/." Then stop.
Context to gather varies by doc type:
readme:
package.json, go.mod, pyproject.toml, or equivalent (for name, version, description, dependencies)api:
router.GET, app.post, @app.route, r.HandleFuncarchitecture:
changelog:
git log --oneline [range] to get commitsgit log $(git describe --tags --abbrev=0)..HEAD --onelineBefore generating, check whether the target doc already exists:
Produce the document in the conversation. Structure by type:
readme:
# <project name>
<1-2 sentence description — what it does and who it's for>
## Install
<install command(s)>
## Usage
<primary usage pattern with example>
## Architecture (omit if trivial)
<brief description of key components>
## Configuration (omit if none)
<key config options>
## License
<license name>
api:
# API Reference
## Endpoints
| Method | Path | Auth | Description |
|--------|------|------|-------------|
| GET | /api/users | JWT | List users |
...
## <Endpoint Group Name>
### GET /api/users/:id
<description>
**Request**
- Path params: `id` (string) — user UUID
**Response**
- 200: `{ id, name, email, createdAt }`
- 404: `{ error: "not found" }`
architecture:
# Architecture
## Overview
<2-3 sentences: what the system does, how it's structured>
## Components
<table or list of top-level packages/modules with one-line descriptions>
## Data Flow
<how data moves through the system — input → processing → output>
## Key Files
<table: file/path → purpose>
changelog:
## <version or date range>
### Added
- <feat: commits>
### Fixed
- <fix: commits>
### Changed
- <refactor:, perf: commits>
### Internal
- <docs:, chore:, test: commits — summarized, not listed verbatim>
Apply style matching: if the existing project uses ## for top-level sections, match that. If it uses sentence case headings, use sentence case.
After outputting the document to the conversation, ask:
Want me to write this to [path]?
If the user says yes: write the file using the Write or Edit tool.
If the user requests changes: make them in the conversation first, then ask again before writing.
| Mistake | Fix |
|---|---|
| Writing files without asking | Always confirm with "Want me to write this to [path]?" before writing. |
| Blowing away manual content | Read existing doc first. Identify what to preserve. State preservation plan before generating. |
| Padding empty sections | If there's no configuration, omit the Configuration section. No filler. |
| Dumping git log verbatim into changelog | Group by type. Deduplicate. Filter noise. The changelog should be readable, not a raw log. |
| Using wrong heading style | Match the project's existing doc style — check for # vs ## top-level, title case vs sentence case. |
| Generating api docs without reading routes | Always read the actual route definition files, not just a description. |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
documentation-generator, readme-generator, changelog, api-docs
npx claudepluginhub harnessprotocol/harness-kit --plugin docgenOther plugins' skills for the same job