|
| 1 | +--- |
| 2 | +last_mapped: 2026-02-16T13:39:48Z |
| 3 | +total_files: 4 |
| 4 | +total_tokens: 2334 |
| 5 | +--- |
| 6 | + |
| 7 | +# Codebase Map |
| 8 | + |
| 9 | +> Auto-generated by Cartographer. Last mapped: 2026-02-16T13:39:48Z |
| 10 | +
|
| 11 | +## System Overview |
| 12 | + |
| 13 | +Schematic is a Claude Code / Codex **skill** that reverse-engineers detailed product & technical spec documents from git branch diffs. It spawns 2-4 parallel agents to read changed files, cross-checks for gaps, and outputs an 11-section structured specification. |
| 14 | + |
| 15 | +```mermaid |
| 16 | +graph TB |
| 17 | + subgraph Trigger |
| 18 | + User["User Request"] |
| 19 | + end |
| 20 | +
|
| 21 | + subgraph "Phase 1: Scope" |
| 22 | + Git["git log / git diff --stat"] |
| 23 | + Classify["File Classification"] |
| 24 | + end |
| 25 | +
|
| 26 | + subgraph "Phase 2: Parallel Exploration" |
| 27 | + A1["Agent 1: Core Implementation"] |
| 28 | + A2["Agent 2: Integration Points"] |
| 29 | + A3["Agent 3: Tests"] |
| 30 | + A4["Agent 4: Config & Infra"] |
| 31 | + end |
| 32 | +
|
| 33 | + subgraph "Phase 3-5: Synthesis" |
| 34 | + CrossCheck["Cross-Check Gaps"] |
| 35 | + WriteSpec["Write 11-Section Spec"] |
| 36 | + Verify["Verify Completeness"] |
| 37 | + end |
| 38 | +
|
| 39 | + Output["docs/ spec document"] |
| 40 | +
|
| 41 | + User --> Git --> Classify |
| 42 | + Classify --> A1 & A2 & A3 & A4 |
| 43 | + A1 & A2 & A3 & A4 --> CrossCheck --> WriteSpec --> Verify --> Output |
| 44 | +``` |
| 45 | + |
| 46 | +## Directory Structure |
| 47 | + |
| 48 | +``` |
| 49 | +schematic/ |
| 50 | +├── .claude/ |
| 51 | +│ └── settings.local.json # Claude Code permissions (allows uv run:*) |
| 52 | +├── docs/ |
| 53 | +│ └── CODEBASE_MAP.md # This file |
| 54 | +├── LICENSE # MIT License |
| 55 | +├── README.md # User-facing docs: install & usage |
| 56 | +└── SKILL.md # Core skill definition (11-section spec workflow) |
| 57 | +``` |
| 58 | + |
| 59 | +## File Guide |
| 60 | + |
| 61 | +| File | Purpose | Tokens | |
| 62 | +|------|---------|--------| |
| 63 | +| `.claude/settings.local.json` | Execution permissions — allows `uv run:*` Bash commands | 26 | |
| 64 | +| `LICENSE` | MIT License (Copyright 2026) | 217 | |
| 65 | +| `README.md` | User-facing install/usage guide for Claude Code & Codex | 380 | |
| 66 | +| `SKILL.md` | Full skill specification: 5-phase workflow, 11-section output template | 1,711 | |
| 67 | + |
| 68 | +### SKILL.md — Core Skill Definition |
| 69 | + |
| 70 | +**Purpose**: The "source code" of this project. Defines the complete workflow Claude Code/Codex follows when triggered. |
| 71 | + |
| 72 | +**Key Sections**: |
| 73 | +- **Metadata**: name, version (1.0.0), tags |
| 74 | +- **Trigger conditions**: phrases like "analyze this branch", "reverse engineer a spec" |
| 75 | +- **5-Phase workflow**: |
| 76 | + 1. Scope the branch (git diff --stat, file classification) |
| 77 | + 2. Parallel deep exploration (2-4 agents reading file groups) |
| 78 | + 3. Cross-check for gaps (compare analyzed vs full file list) |
| 79 | + 4. Write the spec (11 structured sections) |
| 80 | + 5. Verify completeness |
| 81 | +- **11 Output Sections**: Problem Statement, Solution Overview, Product Requirements, Architecture, Technical Design, New Files, Modified Files, Testing Strategy, Rollout Strategy, Risks, Summary |
| 82 | +- **Validation criteria**: every changed file documented, architecture diagrams match data flow, product requirements match test assertions |
| 83 | + |
| 84 | +**File Classification Categories**: |
| 85 | +- Core implementation (new modules, business logic) |
| 86 | +- Integration points (selectors, reducers, hooks, components) |
| 87 | +- Tests (unit, integration, e2e) |
| 88 | +- Configuration (feature flags, env vars, types) |
| 89 | +- Incidental (formatting, imports, minor refactors) |
| 90 | + |
| 91 | +### README.md — User Guide |
| 92 | + |
| 93 | +**Purpose**: Quick-start guide for installing and using the skill. |
| 94 | + |
| 95 | +**Install paths**: |
| 96 | +- Claude Code: `~/.claude/skills/schematic` |
| 97 | +- Codex: `~/.codex/skills/schematic` |
| 98 | + |
| 99 | +**Trigger phrases**: "Reverse engineer a spec", "Analyze this branch", "Write a spec from the code", "Document what this branch does" |
| 100 | + |
| 101 | +## Data Flow |
| 102 | + |
| 103 | +```mermaid |
| 104 | +sequenceDiagram |
| 105 | + participant U as User |
| 106 | + participant CC as Claude Code/Codex |
| 107 | + participant Git as Git CLI |
| 108 | + participant Agents as Parallel Agents |
| 109 | +
|
| 110 | + U->>CC: "Analyze this branch" |
| 111 | + CC->>Git: git log --oneline base..HEAD |
| 112 | + CC->>Git: git diff --stat base...HEAD |
| 113 | + Git-->>CC: Diff stats & file list |
| 114 | + CC->>CC: Classify files into groups |
| 115 | + CC->>Agents: Spawn 2-4 parallel read agents |
| 116 | + Agents->>Agents: Read & analyze assigned files |
| 117 | + Agents-->>CC: Analysis reports |
| 118 | + CC->>Git: git diff base...HEAD -- uncovered-files |
| 119 | + Git-->>CC: Remaining diffs |
| 120 | + CC->>CC: Synthesize 11-section spec |
| 121 | + CC->>CC: Verify all files documented |
| 122 | + CC-->>U: Spec document in docs/ |
| 123 | +``` |
| 124 | + |
| 125 | +## Conventions |
| 126 | + |
| 127 | +- **No executable code**: The entire project is markdown-driven; SKILL.md serves as the "program" for Claude Code/Codex |
| 128 | +- **Parallel-first**: Design principle — always prefer multi-agent parallel analysis over sequential |
| 129 | +- **Table-heavy output**: File lists, requirements, risks all use markdown tables for scannability |
| 130 | +- **Three-dot diff**: Uses `git diff base...HEAD` (merge-base) for branch comparison |
| 131 | +- **Structured output**: Fixed 11-section template ensures consistency across runs |
| 132 | + |
| 133 | +## Gotchas |
| 134 | + |
| 135 | +1. **No Python scripts exist** despite `settings.local.json` allowing `uv run:*` — this permission is reserved for potential future use or scanner scripts |
| 136 | +2. **Examples assume TypeScript/React/Redux** — file classification categories (selectors, reducers, hooks, components) are framework-specific; other stacks may need adapted categories |
| 137 | +3. **No error handling defined** — SKILL.md doesn't specify what to do when git commands fail or agents return incomplete data |
| 138 | +4. **Linear git history assumed** — complex merge histories may produce confusing diffs |
| 139 | +5. **Branch context required** — the skill assumes the user is on the correct branch when triggered |
| 140 | + |
| 141 | +## Navigation Guide |
| 142 | + |
| 143 | +**To modify the skill workflow**: Edit `SKILL.md` — all 5 phases and the 11-section output template are defined there |
| 144 | +**To change execution permissions**: Edit `.claude/settings.local.json` |
| 145 | +**To update user-facing docs**: Edit `README.md` |
| 146 | +**To add a new output section**: Add to the Phase 4 section template in `SKILL.md` |
0 commit comments