From add
Generates and syncs project documentation including architecture diagrams, API docs, and README using a discovery-first approach with cached manifests.
How this skill is triggered — by the user, by Claude, or both
Slash command
/add:docs [--scope all|api|diagrams|readme] [--check] [--discover][--scope all|api|diagrams|readme] [--check] [--discover]This skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generate, update, and verify project documentation. Uses a discovery-first approach: the skill learns your codebase structure on first run, caches that knowledge in a manifest, and uses it for fast, accurate doc generation on every subsequent run.
Generate, update, and verify project documentation. Uses a discovery-first approach: the skill learns your codebase structure on first run, caches that knowledge in a manifest, and uses it for fast, accurate doc generation on every subsequent run.
Works with any project type — web APIs, libraries, CLIs, data pipelines, monorepos, or anything else.
Token economy: doc rendering is mechanical work. When sub-agent dispatch is available, delegate bulk generation (diagram emission, API doc rendering, README regen) to the fast tier per rules/model-roles.md; keep the frontier-model context for judgment — what to document, staleness calls, and review.
The Docs skill manages documentation artifacts that drift as code evolves:
Documentation is generated from code, not written by hand. The source of truth is always the implementation. The manifest bridges the gap between raw source and generated docs.
All archetype lookup tables, the manifest schema, report formats, and configuration defaults live in ${CLAUDE_PLUGIN_ROOT}/references/docs-archetypes.md — referenced throughout as "the archetype reference".
Read .add/config.json
docs configuration block (defaults in the archetype reference)Read .add/docs-manifest.json if it exists
Read knowledge tiers — filter for relevance
${CLAUDE_PLUGIN_ROOT}/knowledge/global.md — universal ADD best practices~/.claude/add/library.json — filter for process and technical entries about documentation drift.add/learnings.json — filter for project-specific doc-related entriesRead CLAUDE.md
Check for session handoff — per the Session-Handoff Preflight in ${CLAUDE_PLUGIN_ROOT}/references/skill-epilogue.md. If the handoff mentions recent structural changes, prioritize diagram updates.
Determine scope
--scope flag if provided, otherwise default to allall, api, diagrams, readme--check mode: report what's stale without modifying files--discover flag: force full re-discovery even if manifest existsDetect documentation tooling
docs/The docs skill adapts its behavior based on the project archetype, detected from .add/config.json or inferred from the codebase. The archetype determines what to discover, what diagrams to generate, and what "API documentation" means.
Detection order: explicit docs.archetype in config → inferred from architecture config and project structure → generic fallback. The full detection-signal table and the per-archetype vocabulary table (what "entry points", "interceptors", "types", and "services" mean per archetype) are in the archetype reference. If ambiguous, prefer the more specific archetype and note the assumption in output.
Recognized archetypes: web-api, web-app, library, cli, data-pipeline, plugin, monorepo, generic.
Runs automatically on first invocation (no manifest found) or when --discover is passed. Produces .add/docs-manifest.json which all other scopes consume.
Read .add/config.json for architecture details and determine archetype. Use the archetype vocabulary table (archetype reference) to guide what to scan for — entry points, interceptors, types, and services mean different things per archetype.
For monorepos, identify the workspace structure first, then recursively discover each package/app using its own detected archetype. Build a top-level manifest with per-package sub-manifests.
For all archetypes, perform these steps using framework/language-appropriate patterns:
Scan entry points
Scan interceptors / middleware / hooks
Scan types / models / schemas
Scan services / internal modules
Build directory map
Inventory existing docs
docs/**/*.md, *.md in root, generated doc files, spec filesAssess flow coverage
Compute file fingerprints
Write .add/docs-manifest.json
entry_points[].detail shapes)Write .add/handoff.md (if discovery took significant effort)
On every invocation (unless --discover is passed), validate the manifest before proceeding:
Hash entry point, type, and interceptor files listed in fingerprints
Compare to stored fingerprints
Report validation result — list changed files and what was re-scanned (example in the archetype reference)
--scope diagrams)Keep the diagram file (default: docs/architecture-diagrams.md, configurable via docs.diagram_file in config) accurate. When entry points, interceptors, or service interactions change, the diagrams must reflect reality.
Load entry points and interceptors from manifest
.add/docs-manifest.json for the full entry point registry and interceptor chaindocs.exclude_patterns from configdocs.priority_entries configTrace flows from source
Read existing diagram file
flows.stale and flows.undocumented listsGenerate/update Mermaid diagrams
sequenceDiagram for web-api request flows, flowchart/classDiagram for libraries)alt blocks (sequence) or branching (flowchart)docs.diagram_style.show_interceptors is true (default)docs.diagram_style.show_error_paths is true (default)docs.diagram_style.max_participants limit (default 8)Write updated diagram file
Every project must document at minimum: the primary entry point → processing → output flow (happy path), and the error handling / fallback flow. Per-archetype additions (auth flows, subcommand dispatch, retry behavior, hook execution, cross-package flows) are listed in the archetype reference.
For parallel diagram generation on large codebases, use the Agent tool to dispatch independent diagram groups concurrently.
--scope api)Generate or regenerate interface documentation appropriate to the project archetype. The what-to-generate and tool-detection strategy per archetype is the "API Doc Strategy by Archetype" table in the archetype reference.
Identify doc generation strategy
docs.api_doc_strategy from config (default: auto)auto, use the archetype to detect the appropriate doc generation toolCheck tool availability
Run doc generation
Verify generation succeeded
Report coverage
--scope readme)Ensure project overview documents reflect the current state of the codebase.
Load current state from manifest
entry_points[]directoriestypes[] and services[]Read existing documents
docs.readme_files config (default: ["CLAUDE.md", "README.md"])Compare and identify drift
Update documents
Optionally update README.md (if it exists and is in readme_files)
--check)When --check is passed, do NOT modify any files. Instead:
--scope if provided: --check --scope diagrams checks only diagrams/add:docs command to fix. Full example in the archetype reference.--discover first)After generating/updating docs, produce a concrete report: execution context (project, archetype, scope, discovery mode), changes made per file, coverage percentages, warnings, and next steps. Full example in the archetype reference.
.add/config.jsonThe docs skill reads its configuration from the docs key in .add/config.json. The full defaults block is in the archetype reference. If no docs key exists in config, all defaults apply.
Tasks to create (mechanics per ${CLAUDE_PLUGIN_ROOT}/references/skill-epilogue.md; skip tasks that don't apply to the current scope):
| Phase | Subject | activeForm |
|---|---|---|
| Discovery | Running codebase discovery | Discovering codebase structure... |
| Validate | Validating manifest freshness | Validating docs manifest... |
| Scan | Scanning codebase | Scanning codebase for doc targets... |
| Diagrams | Updating architecture diagrams | Generating architecture diagrams... |
| API | Regenerating interface docs | Regenerating interface documentation... |
| README | Syncing project overview | Syncing README and CLAUDE.md... |
| Report | Generating report | Generating documentation report... |
Manifest missing (no .add/docs-manifest.json)
auto_discover_on_first_run is true (default), run full discovery automatically/add:docs --discover to initialize."Archetype not detected
generic archetypedocs.archetype in .add/config.json for better results."Framework not recognized (web-api/web-app archetype)
docs.api_doc_strategy to configNo entry points found
No diagram file exists
docs.diagram_fileDoc generation tool not installed
Application not running (for auto-generated docs like FastAPI OpenAPI)
Manifest stale (fingerprint mismatch on many files)
/add:deploy: Run --scope diagrams automatically if entry point files changed in the deployed commit/add:verify: --check mode can be added as a Gate 2 advisory check for documentation freshness/add:tdd-cycle: If new entry points were added, suggest running /add:docs/add:spec: Discovery manifest provides accurate entry point/type inventory for writing new specs/add:plan: Manifest data helps identify which files a plan will touch and what docs need updatingFor large codebases with many independent entry point groups, use the Agent tool to dispatch parallel diagram generation:
End-of-skill epilogue: follow ${CLAUDE_PLUGIN_ROOT}/references/skill-epilogue.md (observation + learning checkpoint + progress tracking). Learning checkpoint trigger: "After Verification".
npx claudepluginhub mountainunicorn/add --plugin addGenerates API docs, architecture diagrams, user guides, and technical references from code using AI analysis. Useful for building documentation pipelines and standardizing docs across a repository.
Generates API docs, architecture diagrams, user guides, and technical references from code with automation and consistency checks.