Reverse Engineer Skill
Base: shared/base.md (full on first load, §Summary on chain). Actions: load per-step from actions/.
You perform deep analysis of existing codebases. Extract architecture, module boundaries, data models, API contracts, business rules, features, integrations, conventions, and technical debt.
When active:
- Follow ONLY the process below
- WAIT for user confirmation after each pass (iterative mode)
- Never narrate your internal process
- ALL output in the user's language (read manifest
language field) — no English narration
- Process modules sequentially — analyze one module fully, write results, then move to the next
Activation
✅ aidlc-reverse-engineer active — {platform} detected.
Ready to analyze your codebase. Provide a scope or say "full project".
Quick Start
- User provides scope (directory, module, or "full project" — default)
- Phase 1: Scan & Map — lightweight: directory structure, configs, entry points
- Phase 2: Module-by-module — read ALL files per module, extract findings, write, move on
- Phase 3: Cross-cutting — read only output files, add cross-module observations
- User can deep-dive or update after completion
Reads: Source code, configs, tests, migrations, README, Dockerfiles, CI/CD, IaC
Writes: .aidlc/reverse-engineer/ (13 analysis documents)
Core Approach
The context limit applies per-module, not per-project. Process one module at a time:
- Read ALL files in one module → extract findings → write to output → release context → next module
- Large modules (150+ files): subdivide by subdirectory, process each batch sequentially
Environment Paths (extends shared base)
OUTPUT_DIR = .aidlc/reverse-engineer
WORK_DIR = {OUTPUT_DIR}/_work
Output structure:
.aidlc/reverse-engineer/
├── _work/ ← intermediate (deleted on completion)
│ ├── progress.json
│ └── modules/
├── README.md, overview.md, modules.md
├── data-model.md, api-surface.md, business-rules.md, features.md
├── integrations.md, conventions.md, infrastructure.md
├── security.md, configuration.md, debt.md
Information Contract
Required Inputs
| Information |
Description |
Accepted Formats |
| Source code |
Codebase to analyze |
Filesystem access |
Optional Inputs
| Information |
Description |
Accepted Formats |
| Scope |
Directory or "full project" |
Path or keyword |
| Existing analysis |
Previous output to update |
Files in .aidlc/reverse-engineer/ |
Outputs
| Artifact |
Path |
Produced By |
| README.md |
{OUTPUT_DIR}/README.md |
Phase 3 |
| overview.md |
{OUTPUT_DIR}/overview.md |
Phase 1 |
| modules.md |
{OUTPUT_DIR}/modules.md |
Phase 1 |
| data-model.md |
{OUTPUT_DIR}/data-model.md |
Phase 2 + Phase 3 |
| api-surface.md |
{OUTPUT_DIR}/api-surface.md |
Phase 2 + Phase 3 |
| business-rules.md |
{OUTPUT_DIR}/business-rules.md |
Phase 2 + Phase 3 |
| features.md |
{OUTPUT_DIR}/features.md |
Phase 2 + Phase 3 |
| integrations.md |
{OUTPUT_DIR}/integrations.md |
Phase 2 + Phase 3 |
| conventions.md |
{OUTPUT_DIR}/conventions.md |
Phase 2 + Phase 3 |
| infrastructure.md |
{OUTPUT_DIR}/infrastructure.md |
Phase 1 + Phase 3 |
| security.md |
{OUTPUT_DIR}/security.md |
Phase 2 + Phase 3 |
| configuration.md |
{OUTPUT_DIR}/configuration.md |
Phase 1 + Phase 2 + Phase 3 |
| debt.md |
{OUTPUT_DIR}/debt.md |
Phase 2 + Phase 3 |
Initialization
- Detect environment
- Create
{OUTPUT_DIR}/ and {WORK_DIR}/modules/ if needed
- Check for existing analysis (
overview.md exists → offer update/extend)
- Check for
{WORK_DIR}/progress.json → resume from next incomplete module
- Resolve scope from user (default: full project)
- Resolve mode: full (default, no stops) or iterative (stop after each module)
Process
Execute phases sequentially. Load the action file when you reach that phase — not before.
| Phase |
Action |
Load |
| 1 |
Scan & Map (lightweight) |
{SKILL_DIR}/actions/phase1-scan.md |
| 2 |
Module-by-module analysis |
{SKILL_DIR}/actions/phase2-modules.md |
| 3 |
Validation & cross-cutting |
{SKILL_DIR}/actions/phase3-crosscutting.md |
Skill Handoff
Next skill: aidlc-context (when user says "start context" or "done, start context").
Phase-Specific Rules
Analysis Principles
- Read ALL code in each module. No budgets, no sampling, no skipping.
- Read code, don't guess. Every claim traceable to file:line.
- Be honest about uncertainty.
- Don't judge — document factually.
- Write ONE file at a time. Never multiple output files in a single response.
- Write after each module. Never hold multiple modules in context.
- Large modules (150+ files): subdivide by subdirectory.
- Large sections (150+ lines): split into sub-sections, write each separately.
- Load only the relevant language reference (
analysis-patterns-{language}.md).
- Intermediate files in
{WORK_DIR}/ — never in {OUTPUT_DIR}/.
Tool Extensions
- Kiro: also uses
invokeSubAgent
- Claude Code: also uses
Agent
Recovery
- Read
{WORK_DIR}/progress.json → resume from next incomplete module.
Timestamps
Every generated file includes: <!-- Analyzed: {ISO timestamp} | Scope: {scope} -->
1---2name: aidlc-reverse-engineer3description: Deep brownfield codebase analysis. Extracts architecture, modules, data models, API surface, business rules, features, integrations, conventions, and technical debt.4license: MIT5---67# Reverse Engineer Skill89> **Base**: `shared/base.md` (full on first load, §Summary on chain). **Actions**: load per-step from `actions/`.1011You perform deep analysis of existing codebases. Extract architecture, module boundaries, data models, API contracts, business rules, features, integrations, conventions, and technical debt.1213When active:141. Follow ONLY the process below152. WAIT for user confirmation after each pass (iterative mode)163. Never narrate your internal process174. ALL output in the user's language (read manifest `language` field) — no English narration184. Process modules sequentially — analyze one module fully, write results, then move to the next1920---2122## Activation2324```25✅ aidlc-reverse-engineer active — {platform} detected.26Ready to analyze your codebase. Provide a scope or say "full project".27```2829---3031## Quick Start32331. User provides scope (directory, module, or "full project" — default)342. **Phase 1: Scan & Map** — lightweight: directory structure, configs, entry points353. **Phase 2: Module-by-module** — read ALL files per module, extract findings, write, move on364. **Phase 3: Cross-cutting** — read only output files, add cross-module observations375. User can deep-dive or update after completion3839**Reads**: Source code, configs, tests, migrations, README, Dockerfiles, CI/CD, IaC40**Writes**: `.aidlc/reverse-engineer/` (13 analysis documents)4142---4344## Core Approach4546The context limit applies per-module, not per-project. Process one module at a time:47- Read ALL files in one module → extract findings → write to output → release context → next module48- Large modules (150+ files): subdivide by subdirectory, process each batch sequentially4950---5152## Environment Paths (extends shared base)5354- `OUTPUT_DIR` = `.aidlc/reverse-engineer`55- `WORK_DIR` = `{OUTPUT_DIR}/_work`5657Output structure:58```59.aidlc/reverse-engineer/60├── _work/ ← intermediate (deleted on completion)61│ ├── progress.json62│ └── modules/63├── README.md, overview.md, modules.md64├── data-model.md, api-surface.md, business-rules.md, features.md65├── integrations.md, conventions.md, infrastructure.md66├── security.md, configuration.md, debt.md67```6869---7071## Information Contract7273### Required Inputs74| Information | Description | Accepted Formats |75|---|---|---|76| Source code | Codebase to analyze | Filesystem access |7778### Optional Inputs79| Information | Description | Accepted Formats |80|---|---|---|81| Scope | Directory or "full project" | Path or keyword |82| Existing analysis | Previous output to update | Files in `.aidlc/reverse-engineer/` |8384### Outputs8586| Artifact | Path | Produced By |87|---|---|---|88| README.md | `{OUTPUT_DIR}/README.md` | Phase 3 |89| overview.md | `{OUTPUT_DIR}/overview.md` | Phase 1 |90| modules.md | `{OUTPUT_DIR}/modules.md` | Phase 1 |91| data-model.md | `{OUTPUT_DIR}/data-model.md` | Phase 2 + Phase 3 |92| api-surface.md | `{OUTPUT_DIR}/api-surface.md` | Phase 2 + Phase 3 |93| business-rules.md | `{OUTPUT_DIR}/business-rules.md` | Phase 2 + Phase 3 |94| features.md | `{OUTPUT_DIR}/features.md` | Phase 2 + Phase 3 |95| integrations.md | `{OUTPUT_DIR}/integrations.md` | Phase 2 + Phase 3 |96| conventions.md | `{OUTPUT_DIR}/conventions.md` | Phase 2 + Phase 3 |97| infrastructure.md | `{OUTPUT_DIR}/infrastructure.md` | Phase 1 + Phase 3 |98| security.md | `{OUTPUT_DIR}/security.md` | Phase 2 + Phase 3 |99| configuration.md | `{OUTPUT_DIR}/configuration.md` | Phase 1 + Phase 2 + Phase 3 |100| debt.md | `{OUTPUT_DIR}/debt.md` | Phase 2 + Phase 3 |101102---103104## Initialization1051061. Detect environment1072. Create `{OUTPUT_DIR}/` and `{WORK_DIR}/modules/` if needed1083. Check for existing analysis (`overview.md` exists → offer update/extend)1094. Check for `{WORK_DIR}/progress.json` → resume from next incomplete module1105. Resolve scope from user (default: full project)1116. Resolve mode: **full** (default, no stops) or **iterative** (stop after each module)112113---114115## Process116117Execute phases sequentially. **Load the action file when you reach that phase — not before.**118119| Phase | Action | Load |120|---|---|---|121| 1 | Scan & Map (lightweight) | `{SKILL_DIR}/actions/phase1-scan.md` |122| 2 | Module-by-module analysis | `{SKILL_DIR}/actions/phase2-modules.md` |123| 3 | Validation & cross-cutting | `{SKILL_DIR}/actions/phase3-crosscutting.md` |124125---126127## Skill Handoff128129**Next skill**: `aidlc-context` (when user says "start context" or "done, start context").130131---132133## Phase-Specific Rules134135### Analysis Principles136- **Read ALL code in each module.** No budgets, no sampling, no skipping.137- Read code, don't guess. Every claim traceable to file:line.138- Be honest about uncertainty.139- Don't judge — document factually.140- **Write ONE file at a time.** Never multiple output files in a single response.141- **Write after each module.** Never hold multiple modules in context.142- **Large modules (150+ files)**: subdivide by subdirectory.143- **Large sections (150+ lines)**: split into sub-sections, write each separately.144- **Load only the relevant language reference** (`analysis-patterns-{language}.md`).145- **Intermediate files in `{WORK_DIR}/`** — never in `{OUTPUT_DIR}/`.146147### Tool Extensions148- **Kiro**: also uses `invokeSubAgent`149- **Claude Code**: also uses `Agent`150151### Recovery152- Read `{WORK_DIR}/progress.json` → resume from next incomplete module.153154### Timestamps155Every generated file includes: `<!-- Analyzed: {ISO timestamp} | Scope: {scope} -->`