skills/document-this/SKILL.md
Generate multi-audience documentation from any codebase — workflows for non-technical readers, architecture for developers, and AI orientation for agents. Deterministic JS scripts handle structural extraction; the agent writes the prose. Project-agnostic and self-orienting. Use when the user asks to "document this project", runs `/document-this`, runs `/document-this <file-path>`, or wants fresh documentation reflecting the current codebase state.
npx skillsauth add rolemodel/rolemodel-skills document-thisInstall 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.
Generates documentation across three audiences from one codebase:
Scripts handle everything deterministic (directory structure, entity listing, test categorization). The agent handles everything that requires interpretation (prose, pattern recognition, workflow narratives).
/document-this # Full project documentation
/document-this <file-path> # Targeted update of affected sections only
generated-docs/
├── README.md # Navigation hub: project summary + links to all docs
├── workflows.md # Non-technical: user-facing workflows from system/integration tests
├── architecture.md # Developer: stack, directory map, data model, patterns & conventions
├── ai-orientation.md # AI agents: entry points, coverage map, known gaps, glossary
└── diagrams/
├── data-model.mmd # Key entities + relationships (Mermaid erDiagram)
└── architecture.mmd # High-level component/module map (Mermaid graph TD)
Regenerating overwrites previous output. The developer can use git diff generated-docs/ to review changes.
If generated-docs/ does not exist, create it.
All scripts live under scripts/ in this skill and emit JSON on stdout. Invoke them with node from the project root:
| Script | Purpose | Key Output Fields |
|---|---|---|
| fingerprint.mjs | Language, framework, DB, dep files, config files, project name | language, database, configFiles, testLayouts |
| front_matter.mjs | Current date + project name | date, projectName |
| directory_tree.mjs [--depth N] | Pruned directory tree honoring .gitignore | tree |
| tech_stack.mjs | Parsed dependency listing per ecosystem | ecosystems |
| test_inventory.mjs | Test files grouped by system / integration / unit | files, summary |
| entities.mjs | Model/entity definitions across any framework | sources, schemaFiles |
| entry_points.mjs | Routes, controllers, service layer directories | routes, controllers, services |
Invocation from project root:
Replace skills/document-this/ below with the path to this skill in your installation (for example, under .claude/skills/, .github/skills/, or .rolemodel-skills/skills/).
node skills/document-this/scripts/fingerprint.mjs
node skills/document-this/scripts/front_matter.mjs
node skills/document-this/scripts/directory_tree.mjs --depth 3
node skills/document-this/scripts/tech_stack.mjs
node skills/document-this/scripts/test_inventory.mjs
node skills/document-this/scripts/entities.mjs
node skills/document-this/scripts/entry_points.mjs
Fallback rule: if node is not available on PATH, do not error — fall back to agent-driven extraction using Read, Glob, and Grep for the same purposes. Scripts are an optimization, not a hard dependency.
Under templates/. Each is a markdown scaffold with {{PLACEHOLDER}} tokens the agent fills:
README.template.md — navigation hub linking all generated files.workflows.template.md — top-level scaffold for workflows.md.workflow-entry.template.md — one per workflow in the Workflows section.architecture.template.md — the Architecture section with explicit placeholders for stack, directory map, data model, patterns, optional JS architecture, and diagrams.ai-orientation.template.md — entry points, test coverage map (well-tested / undertested split), known gaps, glossary.Execute in this order. Each step's output informs the next. Each phase can stand alone — you don't need to complete all phases in one run.
Run the fingerprint and tree scripts to orient yourself:
node skills/document-this/scripts/fingerprint.mjs
node skills/document-this/scripts/directory_tree.mjs --depth 3
From the output, derive — do not assume:
Also read the README if one was detected.
workflows.mdGoal: Document every user-facing workflow in plain English, for a non-technical reader.
Discovery mechanism: Start from system/end-to-end and integration tests, not routes or controllers. Tests are human-authored descriptions of complete user interactions.
node skills/document-this/scripts/test_inventory.mjs
Then:
templates/workflow-entry.template.mdsequenceDiagram mermaid blockPersona filter: Write as if the reader is a non-technical manager or end user. Do not assume they know what "modal", "CRUD", or "API" means.
Inclusion rule: Only document a workflow if backed by at least one system or integration test. If a workflow appears in code but has no test coverage, note it in Known Gaps instead.
No-tests case: if the project has zero system and integration tests, put a prominent note at the top of workflows.md using the {{#if NO_SYSTEM_TESTS}} block in the template.
architecture.md + diagrams/Goal: Give a developer enough orientation to understand the codebase in under 5 minutes.
node skills/document-this/scripts/tech_stack.mjs
node skills/document-this/scripts/directory_tree.mjs --depth 3
node skills/document-this/scripts/entities.mjs
node skills/document-this/scripts/entry_points.mjs
Cover these five things — keep each concise (not exhaustive documentation, just orientation):
components/, controllers/, src/, etc.Then create the Mermaid diagram files:
diagrams/data-model.mmd — entity relationships (erDiagram syntax), derived from entities.mjs output and schema files. Include entity names and relationships only — do not add attribute rows to the tables.diagrams/architecture.mmd — high-level module/layer map (graph TD syntax), derived from entry_points.mjs and directory treeai-orientation.mdGoal: Give an agent the fastest possible path to useful context without duplicating what's in architecture.md.
Open with:
For stack, directory structure, data model, and conventions — see Architecture.
Then include exactly these four things:
entry_points.mjs output)test_inventory.mjs)README.mdWrite a brief navigation document:
workflows.md, architecture.md, ai-orientation.md, and the diagramstemplates/README.template.md)/document-this <file-path>When called with a path, do not regenerate the whole document. Instead:
Identify which sections the file is most likely to affect:
workflows.md + test coverage map in ai-orientation.mdarchitecture.md (data model) + diagrams/data-model.mmd + possibly Terminologyarchitecture.md (patterns) + possibly workflows.mdarchitecture.md (stack)architecture.md (JS Architecture section) + possibly diagrams/architecture.mmdRe-run only the relevant scripts
Regenerate only the affected sections
Ripple check: After updating, scan other sections for cross-references or dependent content that is now stale. Update those too if needed.
Do not regenerate the entire document unless the file affects all sections.
workflows.md. Do not fabricate workflows from routes or controllers alone.testing
Verify what Ruby versions actually exist and install a specific Ruby via rbenv. Use BEFORE asserting that any Ruby version does or doesn't exist (e.g., "Ruby 4.0 isn't out yet", "the latest Ruby is 3.x", "Ruby X.Y.Z doesn't exist"). Also use when the user asks "what's the latest Ruby", "is Ruby X out", "does Ruby X.Y exist", "install Ruby", "switch to Ruby X", "what Ruby is installed", or mentions a specific Ruby version you're unsure about. Claude's training data may be out of date — run `check.sh` first.
development
Trace code through the stack — upward to entry points, downward to data, or laterally across boundaries. Use when the user asks "where does this get called from", "what calls this method", "trace this through the stack", "how does this request flow", "where does this data come from", "follow this through the code", or pastes/selects a piece of code and wants to understand where it fits in the larger system.
tools
Pick the single highest-priority unresolved Sentry issue and hand it off to a fixer skill. Use when triaging Sentry errors, running automated issue triage, or when asked to fix the top Sentry issue in a project.
tools
Find and fix issues from Sentry using MCP. Use when asked to fix Sentry errors, debug production issues, investigate exceptions, or resolve bugs reported in Sentry. Methodically analyzes stack traces, breadcrumbs, traces, and context to identify root causes.