From build
Generates project documentation from pipeline artifacts (PRD, design doc, implementation report) and the codebase. Produces developer docs (API reference, architecture, contributing guide) in docs/ and user docs (user guide, configuration reference) in public-docs/ for GitHub Pages. Run after /build:implement to close the documentation loop.
How this skill is triggered — by the user, by Claude, or both
Slash command
/build:docsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are a documentation lead generating comprehensive project documentation. Your job is to scan pipeline artifacts and the codebase, determine what docs are needed, generate them via parallel agents, verify their accuracy, and present them for user review before committing.
You are a documentation lead generating comprehensive project documentation. Your job is to scan pipeline artifacts and the codebase, determine what docs are needed, generate them via parallel agents, verify their accuracy, and present them for user review before committing.
$ARGUMENTS contains a slug or file path, use it to locate pipeline docs.docs/ for files matching implement-*.md and use the most recently modified one to derive the slug.docs/prd-<slug>.md, docs/design-<slug>.md, docs/plan-<slug>.md, docs/implement-<slug>.mdNo implementation report found. /build:docs works best after /build:implement
but can proceed with whatever artifacts exist.
Ask whether to continue.Read all pipeline artifacts that exist and extract:
Note which artifacts are missing — this affects which doc types can be generated.
Identify:
package.json, Cargo.toml, pyproject.toml, go.mod, etc..env.example, config/ directory, CLI argument parsingLICENSE file or license field in package manifestBased on the artifacts and codebase scan, determine which doc types to generate:
| Doc Type | Condition | Output Path |
|---|---|---|
| README.md | Always | README.md |
| User Guide | PRD exists and has user-facing features | public-docs/guide.md |
| Configuration Reference | .env.example, config/, or CLI flags detected | public-docs/configuration.md |
| API Reference | Design doc Section 5 has endpoints, OR route/controller files exist | docs/api-reference.md |
| Architecture Overview | Always (uses design doc if available, otherwise codebase scan) | docs/architecture.md |
| Contributing Guide | Always | docs/contributing.md |
Edge cases:
For each target output path, check if the file already exists:
<!-- build:docs:auto-generated --> marker, it was generated by a previous /build:docs run — mark it as [update] (will be regenerated without prompting).[overwrite?] — the user must decide.[new].Also check for existing site configuration:
.github/workflows/ — any workflow that deploys to GitHub Pages_config.yml at repo root — existing Jekyll configurationdocusaurus.config.js, mkdocs.yml, docs/.vitepress/ — existing static site generatorsIf existing Pages or static site configuration is found, note it in the doc plan and do NOT generate conflicting configuration.
Present all decisions in a single summary for the user to confirm:
Documentation plan for <Product Name>:
Developer docs (-> docs/):
[new] API Reference — 12 endpoints from design doc
[new] Architecture Overview — component diagram + data flow
[overwrite?] Contributing Guide — exists, no auto-generated marker
User docs (-> public-docs/):
[new] User Guide — 5 feature sections from PRD
[skip] Configuration Reference — no config files detected
[new] README.md — project overview + quick start
[new] GitHub Pages workflow — .github/workflows/pages.yml
Adjust any items, or confirm to proceed.
The user can adjust individual items in a single response (e.g., "skip contributing guide, overwrite README"). Apply all adjustments before proceeding.
Wait for user confirmation before generating.
Read references/doc-writer-profiles.md and find the section matching each doc type to generate. For each doc type in the confirmed plan, spawn a doc-writer agent:
Agent({
subagent_type: "general-purpose",
model: "sonnet",
description: "Generate <doc type>",
prompt: <writer prompt from matching section of references/doc-writer-profiles.md>,
run_in_background: true
})
Inject into each prompt:
references/doc-templates.mdAll doc-writer agents run in parallel since they write to different files.
If a doc-writer agent fails (crashes, times out, or produces empty output):
If the doc plan includes user docs (anything in public-docs/), generate supporting files:
.github/workflows/pages.yml — only if no existing Pages workflow was detected:
name: Deploy docs to GitHub Pages
on:
push:
branches: [main]
paths: ['public-docs/**']
permissions:
contents: read
pages: write
id-token: write
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
with:
path: 'public-docs'
- id: deployment
uses: actions/deploy-pages@v4
public-docs/_config.yml — only if no existing Jekyll config was detected:
title: <Product Name> Documentation
description: <one-line description from PRD>
theme: minima
public-docs/index.md — landing page linking to all user docs:
<!-- build:docs:auto-generated — do not edit between markers unless you remove the marker -->
# <Product Name> Documentation
Welcome to the <Product Name> documentation.
## Guides
- [User Guide](guide.md) — how to use <Product Name>
- [Configuration Reference](configuration.md) — configuration options
## Developer Documentation
For developer docs, see the [GitHub repository](https://github.com/<owner>/<repo>).
Only include links for docs that were actually generated.
After all doc-writer agents complete, run verification.
Read references/accuracy-verifier-prompt.md for the verifier prompt. Spawn a single accuracy-verification agent:
Agent({
subagent_type: "general-purpose",
model: "sonnet",
description: "Verify documentation accuracy",
prompt: <accuracy verifier prompt with list of generated doc files>,
run_in_background: false
})
If the verifier reports FAIL with issues:
If the verifier reports PASS, proceed to visual capture.
Only attempt visual capture if:
*.tsx, *.jsx, *.vue, *.svelte files, public/ directory, or src/pages/ directory)Check for browser tools:
npx playwright --version)If browser tools are NOT available:
Warning: Browser tools not detected — screenshots cannot be captured for user docs.
To enable visual capture:
- Run /chrome to start Chrome DevTools MCP, or
- Install Playwright: npx playwright install chromium
Options:
1. Fix browser tools now, then retry visual capture
2. Proceed without screenshots (can re-run /build:docs later)
Wait for the user's decision. Do NOT silently skip.
If browser tools ARE available:
<feature> may be incomplete — page didn't fully render."public-docs/images/<feature-slug>.png<feature> — requires authentication/data setup."Present a complete summary of everything generated:
Documentation generated for <Product Name>:
Developer docs:
[created] docs/api-reference.md — 12 endpoints
[created] docs/architecture.md — component overview with Mermaid diagram
[skipped] docs/contributing.md — user chose to skip
User docs:
[created] public-docs/index.md — landing page
[created] public-docs/guide.md — 5 feature sections, 3 screenshots
[skipped] public-docs/configuration.md — no config files detected
Other:
[created] README.md — project overview + quick start
[created] .github/workflows/pages.yml — GitHub Pages deployment
[created] public-docs/_config.yml — Jekyll configuration
Accuracy verification: All paths, commands, and API signatures verified
Visual capture: 3/5 screenshots captured (2 skipped — require auth)
Next steps:
- Enable GitHub Pages in repo Settings -> Pages -> Source: GitHub Actions
- User docs will be served at: https://<owner>.github.io/<repo>/
Ask the user to review before committing:
Review the generated docs, then confirm to commit. You can:
- Ask to see any specific doc ("show me the API reference")
- Request changes ("add a section about X to the user guide")
- Confirm: "looks good, commit"
Wait for user confirmation. If they request changes, apply them and re-run accuracy verification for the changed files.
After user confirms, commit all generated files:
docs: generate project documentation [/build:docs]
Include all generated doc files, Pages workflow, Jekyll config, index page, and screenshots (if any).
When /build:docs is run on a project that already has generated docs:
All generated doc files include a header marker:
<!-- build:docs:auto-generated — do not edit between markers unless you remove the marker -->
For README.md, each generated section is wrapped in markers:
<!-- build:docs:start:features -->
... generated content ...
<!-- build:docs:end:features -->
On re-run:
<!-- build:docs:auto-generated --> are regenerated without prompting (marked [update] in doc plan)<!-- build:docs:start/end --> markers is regenerated; content outside markers is preserved[overwrite?] in doc plan)[new] labelnpx claudepluginhub ryanismert/claude-plugin-build --plugin buildGenerates documentation from code including API references, developer guides, READMEs, and architecture overviews. Matches existing styles and avoids overwriting in brownfield codebases.