From core
Reverse-engineer a codebase into grounded architecture docs and requirements. Classifies small vs large codebases, partitions large workspaces, gates unknowns via questioning, and produces docs under docs/<feature>/.
How this command is triggered — by the user, by Claude, or both
Slash command
/core:code-analysis-flowThe summary Claude sees in its command listing — used to decide when to auto-load this command
<code_analysis_flow> <description_and_purpose> Problem: Code analysis degrades into transcription, drifts into suggestions/refactors, or stalls when codebase exceeds single-agent context; assumptions and unknowns are silently adopted. Solution: Thin, sequential workflow that classifies SMALL vs LARGE codebase, delegates analysis to the `reverse-engineering` skill, partitions LARGE codebases via `large-workspace-handling`, gates critical/high unknowns through `questioning`, and optionally extracts requirements via `requirements-authoring`. Grounded by links, HITL at unknowns and final revi...
<code_analysis_flow>
<description_and_purpose>
Problem: Code analysis degrades into transcription, drifts into suggestions/refactors, or stalls when codebase exceeds single-agent context; assumptions and unknowns are silently adopted.
Solution: Thin, sequential workflow that classifies SMALL vs LARGE codebase, delegates analysis to the reverse-engineering skill, partitions LARGE codebases via large-workspace-handling, gates critical/high unknowns through questioning, and optionally extracts requirements via requirements-authoring. Grounded by links, HITL at unknowns and final review.
Validation: Output files exist under docs/<feature>/; every claim traces to code/docs; no generated or suggested implementation; open questions and assumptions are documented; state file reflects phase evidence.
</description_and_purpose>
<workflow_phases>
large-workspace-handling.agents/TEMP/<FEATURE>/code-analysis-flow-state.md updated after each phase.best_practices for sizing and diagram rules./goal is set repeat phases 4-8 until goal is met.large-workspace-handling.requirements-authoringrequirements_branch and review (more agents - less scope each).<context_load phase="1" applies="ALL" subagent="discoverer" role="Context gatherer for analysis scope" subagent_required_model="claude-sonnet-5, gpt-5.4-medium, gemini-3.1-pro">
docs/CONTEXT.md, docs/ARCHITECTURE.md, agents/IMPLEMENTATION.md; grep headers of docs/CODEMAP.md, docs/TECHSTACK.md, docs/DEPENDENCIES.md if present.load-contextcode-analysis-flow-state.md.</context_load>
<scope_and_classify phase="2" applies="ALL" subagent="discoverer" role="Scope and size scanner" subagent_required_model="claude-sonnet-5, gpt-5.4-medium, gemini-3.1-pro">
scope (paths), size (SMALL|LARGE), module-list (LARGE only).reasoningcode-analysis-flow-state.md.</scope_and_classify>
<clarify_unknowns phase="3" applies="ALL" type="HITL">
questioningcode-analysis-flow-state.md.</clarify_unknowns>
<requirements_branch phase="4" applies="ALL" when="user requested requirements reverse-engineering" subagent="architect" role="Requirements engineer extracting intent from code" subagent_required_model="claude-opus-4-8, gpt-5.5-high, gemini-3.1-pro-high">
reverse-engineering skill to distill intent, then requirements-authoring skill to produce atomic, testable functional and non-functional requirements with SMART, MECE, acceptance criteria, EARS phrasing, priority (MoSCoW), and predecessors.docs/REQUIREMENTS/ per requirements-authoring layout, with HITL per-unit approval owned by that skill.reverse-engineering, requirements-authoringcode-analysis-flow-state.md.large-workspace-handling (Summarization & Indexing strategy): every file belongs to exactly one scope; subagents analyze per-module in parallel.</requirements_branch>
<analyze_small phase="5" applies="SMALL" subagent="architect" role="Senior systems analyst producing a single grounded analysis document" subagent_required_model="claude-opus-4-8, gpt-5.5-high, gemini-3.1-pro-high">
docs/<feature>/analysis.md.reverse-engineeringcode-analysis-flow-state.md.</analyze_small>
<analyze_large_parallel phase="6" applies="LARGE" subagent="architect" role="Per-module systems analyst (parallel dispatch)" subagent_required_model="claude-opus-4-8, gpt-5.5-high, gemini-3.1-pro-high">
large-workspace-handling (Summarization & Indexing strategy): every file belongs to exactly one scope; subagents analyze per-module in parallel.module-list + scope + context. Output: docs/<feature>/module-<module>.md per module.large-workspace-handling, reverse-engineeringcode-analysis-flow-state.md.</analyze_large_parallel>
docs/<feature>/summary.md with: Business context (processes/scenarios with involved components and Mermaid diagrams), Domain description (data models with business purpose and cross-repo physical references), Detailed analysis (per repository/component: tech stack, features, dependencies), Architecture insights (patterns and conventions), Dependency map (Mermaid at component and subcomponent level).module-<module>.md documents. Output: docs/<feature>/summary.md.reverse-engineeringcode-analysis-flow-state.md.reasoningcode-analysis-flow-state.md.<user_review phase="9" applies="ALL" type="HITL">
analyze_small, analyze_large_parallel, summarize, or requirements_branch).</user_review>
IMPLEMENTATION.md with a brief pointer to produced analysis artifacts.code-analysis-flow-state.md complete with phase evidence and artifact paths.</workflow_phases>
reverse-engineering — extract WHAT and WHY; strip HOW; detect implicit state machines; consolidate scattered logic; exclude dead code and workarounds.requirements-authoring — atomic, testable, EARS-phrased functional and non-functional requirements with per-unit HITL.large-workspace-handling — partition 100+ file workspaces; Summarization & Indexing strategy for analysis; parallel subagent dispatch with explicit scope boundaries.questioning — batch critical/high MECE questions; safe defaults; persist Q&A.reasoning — 7D decomposition for classification and review.load-context — load Rosetta project context files.discoverer (context/scope), architect (analysis/summary/requirements), reviewer (quality review).<best_practices>
reverse-engineering pitfalls.</best_practices>
<validation_checklist>
analysis.md; LARGE → module-*.md + summary.md).code-analysis-flow-state.md has artifact evidence for every executed phase.docs/REQUIREMENTS/ artifacts only when the user requested it.docs/REQUIREMENTS/INDEX.md is greppable by headers, which provides automatic ToC for all requirement files with short description.</validation_checklist>
</code_analysis_flow>
npx claudepluginhub p/griddynamics-core-instructions-r2-core/hatch3r-codebase-mapReverse-engineers a brownfield codebase into current-state module boundaries, integration-point inventory, tech-debt register, and dependency graph via static analysis, outputting structured specs and ADRs.
/map-codebaseAnalyzes codebase using parallel Explore agents to produce structured codebase documents in .planning/codebase/. Optionally focus on a specific subsystem.
/exploreExplores a codebase from multiple angles using parallel agents, generating ASCII visualizations and import graphs for architecture and health analysis.
/map-codebasePerforms deep codebase analysis using parallel agents, producing 7 structured documents covering stack, architecture, conventions, testing, integrations, and concerns. Supports optional focus area.
/audit-codebaseConducts a PM-focused codebase audit, auto-detecting structure, mapping capabilities, and identifying gaps between documentation and implementation.
/map-codebaseAnalyzes codebase with parallel mapper agents to produce structured documents in .planning/codebase/. Also supports --fast scan and --query intel modes.