From andthen
Analyze an existing codebase to produce structured documentation and discover implicit requirements. Trigger on 'map codebase', 'map this repo', 'analyze the project', 'understand this codebase', 'what does this repo do'.
How this skill is triggered — by the user, by Claude, or both
Slash command
/andthen:map-codebaseThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Brownfield codebase analysis that produces structured understanding of an existing codebase plus a discovered requirements document. Use this when onboarding to an existing project or when project documentation is missing/outdated.
Brownfield codebase analysis that produces structured understanding of an existing codebase plus a discovered requirements document. Use this when onboarding to an existing project or when project documentation is missing/outdated.
Output: Structured documentation files + discovered requirements document that feeds directly into the andthen:plan skill.
Output directory (defaults to docs/, or as configured in Project Document Index):
OUTPUT_DIR: $ARGUMENTS or docs/
Learnings document (see Project Document Index) exists, read it before startingtemplates/project-state-templates.mdtree -d -L 3 for directory structuregit ls-files | head -500 for file inventorygit log --oneline -20pnpm-workspace.yaml, lerna.json, nx.json, turbo.json, "workspaces" in root package.json, [workspace] in root Cargo.toml, go.work, or multiple sub-dirs with their own package config. If detected: list workspace tool and sub-projects. Set IS_MONOREPO = true and pass the sub-project list to all analysis sub-agents.Gate: Project shape understood, technologies identified, monorepo status determined
Spawn parallel sub-agents (if supported by your coding agent). Use a fast/lightweight model (model: "haiku", gpt-5.4-mini, or similar) for scanning agents and a capable coding model (model: "sonnet", gpt-5.3-codex, or similar) for synthesis.
Monorepo note (apply to all sub-agents when IS_MONOREPO = true): organize findings with clear sub-project boundaries. Document shared aspects once; only call out per-sub-project specifics where they differ.
Analyze and document languages/versions, frameworks and libraries (with versions from lock files), infrastructure, external services, build tools and CI/CD.
Output: the Stack document (see Project Document Index; default: OUTPUT_DIR/STACK.md)
Analyze and document system design and component boundaries, key modules and responsibilities, data flow, entry points (routes, CLI, event handlers), and integration points with external systems. If monorepo: document sub-project boundaries and inter-project relationships.
Output: the Architecture document (see Project Document Index; default: OUTPUT_DIR/ARCHITECTURE.md)
Analyze and document naming conventions, file organization patterns, error handling, logging, testing patterns, and code style (formatting, imports, exports).
Output: a ## Conventions section to be appended to the project's CLAUDE.md
Analyze test framework(s), test directory structure, coverage patterns, test helpers/fixtures, and integration/E2E setup.
Output: included in the Architecture document (see Project Document Index) under a "Testing" section
Discover commands by scanning package.json scripts, Makefile, Taskfile.yml, justfile, deno.json, Cargo.toml aliases, CI/CD configs, and README files. If monorepo: organize commands per sub-project and identify root-level orchestration commands.
Output: the Key Dev Commands document (see Project Document Index; default: docs/KEY_DEVELOPMENT_COMMANDS.md), using the template from templates/project-state-templates.md
Gate: All analysis sub-agents complete
Spawn a sub-agent (capable coding model) to reverse-engineer a discovered requirements document by analyzing:
Output: OUTPUT_DIR/requirements-discovered.md in a format compatible with the andthen:plan skill input:
# Discovered Requirements: [Project Name]
> **Generated by**: the `andthen:map-codebase` skill on [date]
> **Source**: Reverse-engineered from codebase analysis
> **Status**: Discovered – requires validation by team
## System Overview
## Discovered Features
### [Feature Area]
- **REQ-D01**: [description] – Evidence: [file paths] – Confidence: High/Medium/Low
## Implicit Business Rules
- **RULE-D01**: [rule] – Evidence: [where enforced]
## External Integration Contracts
- **INT-D01**: [system] – Contract: [what the code expects]
## Non-Functional Characteristics
## Gaps & Uncertainties
Gate: Requirements discovery complete
OUTPUT_DIR/IS_MONOREPO = true: generate a lightweight CLAUDE.md for each sub-project that doesn't already have one (under ~40 lines: name/description, key development commands inline table, sub-project-specific notes)andthen:plan skill: /andthen:plan docs/requirements-discovered.mdOUTPUT_DIR/
├── STACK.md # Technology stack
├── ARCHITECTURE.md # System architecture + testing overview
├── KEY_DEVELOPMENT_COMMANDS.md # Discovered dev commands
└── requirements-discovered.md # Reverse-engineered requirements
Additionally:
- A `## Conventions` section is appended to the project's `CLAUDE.md`
- (Monorepo) Per-sub-project `CLAUDE.md` files are generated in each sub-project directory
When complete, print each output file's relative path from the project root.
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub it-huset/andthen --plugin andthen