skills/superdocs/SKILL.md
Generates a docs/ directory of markdown files giving AI and humans deep context on WHAT a codebase is, HOW it works, and WHY decisions were made. Scans any codebase, produces structured documentation. Re-runnable — detects existing docs, monorepos, and git-based staleness. Runs automatically without user interaction.
npx skillsauth add asteroid-belt-llc/skills superdocsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Generate a docs/ directory of markdown files that give AI agents and human contributors deep context on any codebase.
Scope: Superdocs works on codebases — repositories containing source code with build/test/deploy pipelines. It does not generate documentation for pure-docs projects, wikis, or non-code repositories.
Re-runnable: Safe to run multiple times. First run generates from scratch (migrating existing docs if found). Subsequent runs detect what changed in the codebase since the last docs update and refresh only stale content.
References: See RESEARCH-PROMPTS.md for codebase exploration prompts, DOC-TEMPLATES.md for document templates, EXAMPLE-OUTPUT.md for a sample output walkthrough.
Documentation should answer three questions at every level:
| Question | What It Captures | Example | |----------|-----------------|---------| | WHAT | Facts, structures, components | "This is a REST API built with Express" | | HOW | Processes, flows, mechanics | "Requests pass through auth middleware, then route handlers" | | WHY | Rationale, trade-offs, history | "We chose SQLite over Postgres for single-binary deployment" |
Most documentation answers WHAT. Good documentation answers HOW. Great documentation answers WHY. Superdocs targets all three.
/superdocs # Uses cwd as project root
/superdocs @README.md @CLAUDE.md # With context files as hints
Superdocs runs fully automatically — no user prompts or confirmations. It scans, classifies, researches, generates, and verifies in one pass.
# From the project root
./scripts/generate-docs.sh
# Or with options
./scripts/generate-docs.sh --project-dir /path/to/project --output-dir docs
See scripts/generate-docs.sh for CI integration details.
docs/
overview.md # WHAT: Project identity, purpose, scope
architecture.md # HOW + WHY: System design, component relationships
getting-started.md # HOW: Setup, prerequisites, first run
development.md # HOW: Contributing, testing, deploying
adr/ # WHY: Architecture Decision Records
README.md # Index of all ADRs with status summary
0001-[title].md # Individual ADR per significant decision
0002-[title].md # ...numbered sequentially
glossary.md # WHAT: Domain terms, acronyms, project-specific jargon
When the project contains multiple deployable apps or packages, superdocs generates per-package docs with a root index:
docs/
README.md # Root index linking to each package's docs
apps/
web/
docs/ # Full superdocs set for the web app
overview.md
architecture.md
getting-started.md
development.md
adr/
glossary.md
api/
docs/ # Full superdocs set for the api
...
packages/
shared-lib/
docs/ # Full superdocs set for shared-lib
...
Each package gets its own complete superdocs set. The root docs/README.md serves as a navigation index.
+-----------------------------------------------------------------------+
| SUPERDOCS WORKFLOW |
+-----------------------------------------------------------------------+
| |
| 1. DISCOVER -> Validate codebase, detect monorepo, |
| | classify docs state, compute staleness |
| v |
| 1b. MIGRATE -> (If non-superdocs docs/ exist) Absorb |
| | existing content into superdocs structure |
| v |
| 2. RESEARCH -> Deep-dive with parallel agents: architecture, |
| | patterns, decisions, domain concepts |
| v |
| 3. OUTLINE -> Plan doc structure, identify gaps, scope |
| | updates using git diff data |
| v |
| 4. GENERATE -> Write all markdown files with WHAT/HOW/WHY |
| | coverage at every level |
| v |
| 5. VERIFY -> Cross-check completeness, validate links, |
| report coverage summary + change log |
| |
+-----------------------------------------------------------------------+
Read the relevant reference BEFORE starting each phase.
| When | Reference | What You Get | |------|-----------|--------------| | Phase 2: Research | RESEARCH-PROMPTS.md | Exact prompts for parallel exploration agents | | Phase 4: Generate | DOC-TEMPLATES.md | Templates for each output document | | Phase 5: Verify | EXAMPLE-OUTPUT.md | Example of well-generated docs for reference |
Confirm the project contains source code. Check for at least one of:
package.json, pyproject.toml, go.mod, Cargo.toml, Gemfile, pom.xml, build.gradlesrc/, lib/, app/, cmd/, internal/Makefile, Justfile, Dockerfile, CI configIf none found: EXIT with message — "Superdocs requires a codebase with source code. This directory does not appear to contain one."
Check for monorepo indicators:
| Indicator | Check For |
|-----------|-----------|
| Workspace config | workspaces in package.json, pnpm-workspace.yaml, Cargo workspace in Cargo.toml, Go workspace in go.work |
| Multi-package dirs | apps/, packages/, services/, libs/, modules/ containing multiple subdirs with their own package files |
| Monorepo tools | lerna.json, nx.json, turbo.json, rush.json, pants.toml, BUILD files (Bazel) |
Classification:
| Result | Criteria | Action |
|--------|----------|--------|
| SINGLE | One deployable codebase | Generate docs/ at project root |
| MONOREPO | Multiple packages/apps detected | Generate root docs/README.md index + per-package docs/ |
For monorepos, identify each package:
MONOREPO PACKAGES DETECTED
----------------------------
| Package | Path | Type | Has Existing Docs? |
|---------|------|------|--------------------|
| [name] | apps/web/ | app | Yes/No |
| [name] | apps/api/ | app | Yes/No |
| [name] | packages/shared/ | library | Yes/No |
Before classifying docs state, scan the entire repo for scattered ADRs that should be centralized into docs/adr/:
# Find existing ADR directories
find . -type d -name "adr" -o -name "adrs" -o -name "decisions" | grep -v node_modules | grep -v .git
# Find individual ADR files by naming convention
find . -type f \( -name "ADR-*.md" -o -name "adr-*.md" -o -name "[0-9][0-9][0-9][0-9]-*.md" \) | grep -v node_modules | grep -v docs/adr
| Location Found | Action |
|----------------|--------|
| adr/ or decisions/ at project root | Move contents into docs/adr/, renumber if needed |
| doc/adr/ or doc/decisions/ | Move contents into docs/adr/, renumber if needed |
| ADR files scattered in subdirectories | Copy into docs/adr/, preserve original, add source reference |
| Existing docs/adr/ in superdocs format | Keep as-is (handled by UPDATE state) |
Record all found ADRs for use in Phase 1b (MIGRATE) or Phase 4 (GENERATE):
EXISTING ADRs FOUND
---------------------
| # | File | Location | Status | Action |
|---|------|----------|--------|--------|
| 1 | 0001-use-postgres.md | adr/ (root) | Valid ADR | Centralize to docs/adr/ |
| 2 | ADR-auth-strategy.md | doc/decisions/ | Valid ADR | Centralize + renumber |
| 3 | 0003-api-versioning.md | docs/adr/ | Already centralized | Keep |
Total: [N] existing ADRs found, [M] need centralizing
For each docs target (project root for SINGLE, each package for MONOREPO):
| State | Detection | Action |
|-------|-----------|--------|
| FRESH | No docs/ directory exists | Full generation from scratch |
| MIGRATE | docs/ exists but is NOT superdocs format | Absorb existing content, then generate |
| UPDATE | docs/ exists in superdocs format | Diff codebase changes, update stale content |
To detect superdocs format, check for the presence of at least 3 of: overview.md, architecture.md, getting-started.md, development.md, adr/README.md, glossary.md.
When existing superdocs are detected, determine exactly what changed since the last docs update:
# Find when docs/ was last modified
git log -1 --format="%H" -- docs/
# Count commits since last docs update
git rev-list --count <docs-last-sha>..HEAD
# List files changed since last docs update
git diff --name-only <docs-last-sha>..HEAD
# Summarize changes by directory
git diff --stat <docs-last-sha>..HEAD
Build a staleness report:
STALENESS REPORT
-----------------
Docs last updated: [SHA] ([date], [N] commits ago)
Commits since: [count]
Files changed: [count]
Changes by area:
src/api/ [N files changed] -> architecture.md, development.md may be stale
src/models/ [N files changed] -> architecture.md, glossary.md may be stale
package.json [modified] -> getting-started.md may be stale
Dockerfile [modified] -> development.md may be stale
[new directory] [added] -> architecture.md needs new component
Affected superdocs files:
overview.md [STALE / OK]
architecture.md [STALE / OK]
getting-started.md [STALE / OK]
development.md [STALE / OK]
adr/ [STALE / OK] — [N] new ADR candidates
glossary.md [STALE / OK]
Identify the primary language, framework, and tooling:
| Detection | Check For | |-----------|-----------| | Language | File extensions, package files | | Framework | Framework-specific config (next.config.js, django settings, etc.) | | Build system | Makefile, Justfile, Taskfile, build scripts | | Test framework | jest.config, pytest.ini, go test conventions, etc. | | CI/CD | .github/workflows, .gitlab-ci.yml, Jenkinsfile | | Infrastructure | Dockerfile, docker-compose.yml, terraform/, k8s/ |
DISCOVERY CHECKLIST
--------------------
1. Use project root directory (cwd or user-specified)
2. Read existing docs in priority order:
- README.md (primary project description)
- CLAUDE.md / AGENTS.md (agent context)
- CONTRIBUTING.md (development workflow)
- CHANGELOG.md / HISTORY.md (evolution)
- docs/ directory (existing documentation)
- .github/ (CI, issue templates, PR templates)
3. Record what already exists vs what needs generating
tree --gitignore -a -L 3
| Size | Criteria | Documentation Approach | |------|----------|----------------------| | Small | <20 files, <2K LOC | Concise docs, merge overview+architecture | | Medium | 20-100 files, 2-20K LOC | Full doc set, standard depth | | Large | >100 files, >20K LOC | Full doc set, deeper architecture, component breakdown |
DISCOVERY COMPLETE
-------------------
Project: [name]
Type: [SINGLE / MONOREPO ([N] packages)]
Stack: [language/framework]
Size: [small/medium/large]
Docs state: [FRESH / MIGRATE / UPDATE]
Staleness: [N/A / [N] commits behind, [N] files changed]
Existing docs: [list what already exists]
Existing ADRs: [N] found ([M] need centralizing)
CHECKPOINT: Run /compact focus on: Phase 1 DISCOVER complete. Project=[name], Type=[type], Stack=[stack], Docs state=[state], [N] existing ADRs found. Phase 1b/2 goals next.
Skip this phase if docs state is FRESH or UPDATE. For FRESH/UPDATE: existing ADRs found in Step 3 are centralized during Phase 4 (GENERATE) instead.
When docs/ exists but is not in superdocs format, absorb the existing content before generating.
Read every file in docs/ and catalog:
| File | Content Summary | Maps To Superdocs File |
|------|----------------|----------------------|
| [existing-file.md] | [Brief summary] | [overview.md / architecture.md / adr/NNNN / etc. / NONE] |
For each existing doc file, extract content that can be incorporated:
architecture.mdgetting-started.mdadr/glossary.mdFor each existing ADR found in Phase 1, Step 3:
<!-- TODO: verify -->)NNNN number in docs/adr/0001-use-postgres-over-sqlite.md)docs/adr/ — the centralized locationADR CENTRALIZATION
--------------------
| Original | Centralized As | Action |
|----------|---------------|--------|
| adr/0001-use-postgres.md | docs/adr/0001-use-postgres.md | Moved, reformatted |
| doc/decisions/auth.md | docs/adr/0002-auth-strategy.md | Moved, renumbered, reformatted |
| src/README.md (decision section) | docs/adr/0003-event-sourcing.md | Extracted, new ADR created |
mkdir -p docs/adr/docs/ untouched)MIGRATION COMPLETE
-------------------
Files absorbed: [count]
Content mapped:
[old-file.md] -> [superdocs-file.md]
...
ADRs centralized: [count]
[original-path] -> docs/adr/[new-name].md
...
Files preserved (unmapped): [list any files left as-is]
Files removed: [list files fully absorbed and deleted]
Old ADR dirs removed: [list directories cleaned up]
CHECKPOINT: Run /compact focus on: Phase 1b MIGRATE complete. [N] files absorbed, [M] ADRs centralized into docs/adr/. Phase 2 RESEARCH goals next.
STOP. Read RESEARCH-PROMPTS.md NOW for exact agent prompts.
Launch 5 parallel Explore agents to gather comprehensive codebase context:
LAUNCHING RESEARCH AGENTS
--------------------------
Agent 1: Architecture & Structure [scanning...]
Agent 2: Patterns & Conventions [scanning...]
Agent 3: Domain & Business Logic [scanning...]
Agent 4: Build, Test & Deploy Pipeline [scanning...]
Agent 5: Decision Archaeology [scanning...]
Estimated time: 2-5 minutes
For MONOREPO: run agents per-package, parallelizing across packages where possible.
Discovers the high-level system design:
Identifies how code is written:
Captures what the codebase actually does:
Maps the development lifecycle:
Mines project history and artifacts for architecture decisions:
// WHY:, // DECISION:, // NOTE:, rationale in docstringsdocs/adr/ (if MIGRATE ran) or from scattered locations found in Phase 1, Step 3. Do NOT duplicate decisions already captured in existing ADRs. Instead, supplement them with new decisions found in git history that aren't yet recorded.After agents complete, compile and cross-check:
RESEARCH COMPLETE
------------------
Architecture style: [monolith/microservices/serverless/library/CLI/etc.]
Key components: [list top 5-8]
Domain concepts: [list core entities]
Build pipeline: [list key commands]
Decisions found: [count] from git history, [count] from code/docs, [count] inferred
Existing ADRs read: [count] (centralized in Phase 1b or found in Phase 1)
New ADR candidates: [list decision titles not already captured]
CHECKPOINT: Run /compact focus on: Phase 2 RESEARCH complete. [N] components, [M] domain concepts, [K] ADR candidates ([J] existing + [L] new). Phase 3 OUTLINE goals next.
Based on codebase size and existing documentation:
| Document | Always Generate? | Skip When |
|----------|-----------------|-----------|
| overview.md | Yes | Never skip |
| architecture.md | Yes | Never skip |
| getting-started.md | Yes | Never skip |
| development.md | Yes | Never skip |
| adr/ | Yes, if decisions found | No technical decisions discoverable |
| glossary.md | Yes, if domain terms found | Trivial codebase with no domain language |
In UPDATE mode, cross-reference the staleness report (Phase 1, Step 4) with research findings to build a precise change plan:
CHANGE PLAN
-------------
Stale documents: [list docs needing updates]
New documents: [list new docs to create, e.g., new ADRs]
Unchanged documents: [list docs that are still accurate]
Changes by file:
architecture.md:
- ADD: [new component from src/new-module/]
- REMOVE: [deleted component]
- UPDATE: [changed data flow]
getting-started.md:
- UPDATE: [new dependency version in package.json]
adr/:
- NEW: 0005-[title].md (from commit abc1234)
- SUPERSEDE: 0002-[title].md -> 0005-[title].md
glossary.md: OK (no domain changes)
overview.md: OK (scope unchanged)
For each document, plan the sections based on research findings:
DOCUMENT OUTLINE
-----------------
overview.md:
- Project name and one-line description
- Problem statement (WHY this exists)
- Key features / capabilities (WHAT it does)
- Target audience
- Project status and maturity
architecture.md:
- System diagram (text-based)
- Component breakdown
- Data flow
- Key interfaces and boundaries
- Design decisions (WHY these components)
getting-started.md:
- Prerequisites
- Installation steps
- Configuration
- First run / hello world
- Common issues
development.md:
- Repository structure
- Development workflow
- Testing strategy
- Code style and conventions
- CI/CD pipeline
adr/README.md:
- Index of all ADRs with status and summary
- Link to each individual ADR file
adr/NNNN-[title].md (one per decision):
- Status (Accepted / Superseded / Deprecated)
- Context: situation, constraints, forces at play
- Decision: what was chosen
- Consequences: benefits, trade-offs, alternatives considered
- Sources: git commits, plan files, code references that evidence the decision
glossary.md:
- Alphabetical term list
- Each entry: Term, Definition, Context/Usage
Generate all applicable documents without prompting. Do not ask for user confirmation.
STOP. Read DOC-TEMPLATES.md NOW for document templates.
Generate documents in this order (each builds on the previous):
docs/adr/ now, normalizing to superdocs ADR format and renumbering sequentiallyadr/README.md index covering both centralized and newly generated ADRsadr/NNNN-title.md files for decisions discovered by Agent 5 that aren't already capturedFor monorepos, generate in this order:
docs/README.md - write last, linking to each package's docs with a brief descriptionIn UPDATE mode, follow the change plan from Phase 3:
For each document:
<!-- TODO: verify -->Write all files to the output directory:
mkdir -p docs/adr/
Write each file using the Write tool.
After all documents are written:
GENERATION COMPLETE
--------------------
Docs state: [FRESH / MIGRATE / UPDATE]
Files written: [count]
Files updated: [count] (UPDATE mode)
Files unchanged: [count] (UPDATE mode)
docs/overview.md [X lines]
docs/architecture.md [X lines]
docs/getting-started.md [X lines]
docs/development.md [X lines]
docs/adr/README.md [X lines]
docs/adr/0001-[title].md [X lines]
...
docs/glossary.md [X lines]
Total: [N] files ([M] ADRs), [L] total lines
Verify WHAT/HOW/WHY coverage across all documents:
COVERAGE MATRIX
----------------
WHAT HOW WHY
overview.md [x] [ ] [x]
architecture.md [x] [x] [x]
getting-started.md [x] [x] [ ]
development.md [x] [x] [ ]
adr/ [ ] [ ] [x] [N] ADR files
glossary.md [x] [ ] [ ]
Legend: [x] = covered, [ ] = not applicable for this doc
Verify that documents reference each other where appropriate:
For each document, verify at least 2 claims against the actual codebase:
Search all generated docs for <!-- TODO: verify --> markers:
SUPERDOCS COMPLETE
================
Project: [name]
Type: [SINGLE / MONOREPO ([N] packages)]
Output: docs/
Docs state: [FRESH / MIGRATE / UPDATE]
Staleness: [N/A / was [N] commits behind, now current]
Files: [N]
Total lines: [M]
WHAT coverage: [X/N] documents
HOW coverage: [X/N] documents
WHY coverage: [X/N] documents
Cross-links: [X/Y] verified
TODOs remaining: [N] (items needing human verification)
Documents generated: [count]
Documents updated: [count] (UPDATE only)
Documents unchanged: [count] (UPDATE only)
ADRs total: [count]
docs/overview.md
docs/architecture.md
docs/getting-started.md
docs/development.md
docs/adr/README.md
docs/adr/0001-[title].md
docs/adr/...
docs/glossary.md
| Red Flag | What's Wrong | Fix |
|----------|-------------|-----|
| Writing "the project uses modern best practices" | Vague filler with no information content | State the specific practice and where it's implemented |
| Describing a component without a file path | Unverifiable claim | Find the actual path or flag with <!-- TODO: verify --> |
| Listing a command without checking it exists | May be wrong | Read package.json, Makefile, or Justfile to confirm |
| Generating an ADR without a source reference | Fabricated rationale | Every ADR needs at least one evidence source (commit, code, doc) |
| Skipping cross-links between documents | Docs become isolated silos | Every doc links to at least 2 others |
| Writing aspirational content ("we plan to...") | Documents future, not present | Document only what EXISTS in the codebase now |
| Rewriting an unchanged document in UPDATE mode | Wasted effort, risks introducing errors | Check the staleness report — only touch stale docs |
These are excuses that should never bypass the workflow:
| Rationalization | Why It's Wrong | What to Do Instead |
|----------------|---------------|-------------------|
| "I'll skip the codebase validation, it's obviously code" | Validation takes seconds and prevents running on wikis/docs repos | Always run Step 1 |
| "I don't need to check for existing ADRs" | Scattered ADRs get duplicated or lost | Always scan in Step 3 |
| "I'll generate all docs without reading research first" | Docs will contain generic filler instead of actual project data | Research MUST complete before generation |
| "The staleness check isn't needed, I'll just regenerate everything" | Overwrites accurate content, loses manual edits | In UPDATE mode, always compute staleness first |
| "I'll write the ADR rationale from what seems reasonable" | Fabricated rationale is worse than no rationale | Every ADR needs evidence; use Inferred — [evidence] for low-confidence decisions |
| "Cross-link validation is optional" | Broken links make docs untrustworthy | Always validate in Phase 5 |
Do NOT rely on memory or assumptions. For every claim in generated docs:
ls or Glob that the path existsIf you cannot verify a claim, mark it with <!-- TODO: verify --> and list it in the final summary.
| Aspect | Guideline | |--------|-----------| | Voice | Technical writer - precise, neutral, helpful | | Audience | Assume reader is a competent developer unfamiliar with this specific codebase | | Length | Concise but complete - every sentence should add information | | Formatting | Use tables for structured data, code blocks for commands, headers for navigation | | Examples | Use actual codebase code and commands, not hypothetical ones | | Jargon | Define on first use or link to glossary.md |
development
Transforms technical documents into rigorous learning journeys with collegiate-level mastery requirements. Uses Bloom's taxonomy progression, 80%+ mastery thresholds, and multi-level verification before advancing. Treats learning as a high school to college graduation progression. Use when user wants deep understanding, not surface familiarity.
development
Use when starting significant features, epics, or complex tasks. Creates multi-phase implementation plans with parallelizable phases, poker estimates, TDD-first acceptance criteria, and quality gates. Detects tech stack from CLAUDE.md/AGENTS.md (bypassing internet research if complete) or via codebase scan.
development
Weekly codebase hygiene skill that identifies and fixes AI-generated code problems ("slop") using Martin Fowler's refactoring techniques. Scans for 15 common issues, prioritizes by severity, and generates superplan-compatible plans for systematic improvement.
development
Use when executing implementation plans phase-by-phase with strict enforcement of quality gates, tests, and Definition of Done. Triggers on "build this plan", "execute plan", "implement phases", or when user provides a plan document to execute.