codebase-discovery

Extract domain knowledge, architecture, and business rules from existing codebases into onboarding documentation.

2|2|Updated Jul 17, 2026
One-click install
npx skills add https://github.com/DiUS/agent-toolkit --skill codebase-discovery-dius
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: codebase-discovery
Source: https://github.com/DiUS/agent-toolkit/tree/main/skills/codebase-discovery
Command: npx skills add https://github.com/DiUS/agent-toolkit --skill codebase-discovery-dius

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Most real codebases are under-documented, and the documentation that exists drifts from the code over time. This Skill reverse-engineers the domain model, architecture, business rules, workflows, and business glossary out of an existing codebase, then validates the findings with a stakeholder, producing lean onboarding docs that give a new team member or AI harness (e.g. Spec Kit) enough grounded context to be productive. ## Core Features & Use Cases - Six-phase evidence-cited workflow: pre-check, tiered deep recon (structure, data model, contracts, business-logic hotspots), one-question-at-a-time stakeholder interview, synthesis, adversarial verification, and a finish phase with doc-drift summary. - Provenance and status model: every claim traces to code evidence or a named stakeholder via an assumptions register and traceability index, with five exception flags ([unchecked], [unverified], [assumption], [outdated], [contradicted]). - Resumable, host-agnostic operation: working state lives in plain files under docs/_discovery/, with commit-based staleness detection, full and code-only modes, and graceful degradation when git, sub-agents, or an SME are unavailable. - Use Case: Point it at a legacy repository with no documentation; it maps the modules into business areas, interviews the Product Owner to confirm inferred rules, and writes dated onboarding docs under docs/ plus a project-root README index ready for spec-driven development. ## Quick Start Ask your agent to run the codebase-discovery skill on this repository in code-only mode and produce onboarding docs under docs/.

Frequently Asked Questions about codebase-discovery

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate onboarding documentation from an existing codebase?

Run the skill against the repository root. It performs tiered recon of structure, data model, contracts, and business-logic hotspots, then writes dated, provenance-flagged docs under docs/ with the project-root README as the entry point.

How do I reverse-engineer business rules from legacy code?

The recon phase reads service layers, validations, state transitions, enums, and tests to form evidence-cited hypotheses with path:line citations. A stakeholder interview then validates each inferred rule one question at a time, or code-only mode flags them as assumptions.

Can I use codebase-discovery without a stakeholder available?

Yes, code-only mode skips the interview phase entirely. Everything that would need SME confirmation stays flagged as [assumption] or [unverified] in the assumptions register for later validation.

Does codebase-discovery work with agents other than Claude Code?

Yes, it is host-agnostic: SKILL.md and the playbooks read as plain Markdown instructions, and working state uses plain files rather than hooks or MCP servers. Sub-agents, git, and LSP tooling are optional inputs that degrade gracefully.

What happens when the code changes after a discovery run?

A commit-based freshness check compares the current tree against the recon manifest from the previous run. On drift, you choose to re-recon affected areas, do a full re-recon, proceed anyway, or just report the drift.

Will codebase-discovery overwrite my existing README or docs?

No. Phase 0 surveys the write target and agrees an output root before anything is written, existing READMEs are merged conservatively only with your sign-off, and a write contract governs every later phase.