Full codebase audit + restructure:
/architect -a full codebase restructure
Audit only (no changes):
/architect -s audit auth module
What it does:
- AUDIT: Scans structure, detects architectural smells (god modules, circular deps, coupling)
- DESIGN: Proposes restructuring plan with file moves, splits, renames
- RESTRUCTURE: Executes safely with
git mv, import migration, incremental commits
- VERIFY: Build, tests, import validation
| Flag |
Description |
-a |
Auto mode: skip confirmations, execute full workflow |
-e |
Economy mode: no subagents, direct tools only |
-s |
Save mode: output to .claude/output/architect/ |
--audit-only |
Stop after audit step (no restructuring) |
--dry-run |
Show proposed changes without executing |
--standalone |
Use built-in RESTRUCTURE + VERIFY instead of APEX handoff |
AUDIT ─ Detect smells, map dependencies, measure complexity
DESIGN ─ Propose structure, file moves, module splits
HANDOFF ─ Save design context file, offer APEX implementation
RESTRUCTURE ─ git mv, update imports, incremental commits (--standalone)
VERIFY ─ Build, test, import validation (--standalone)
</workflow>
<state_variables>
| Variable | Type | Description |
|----------|------|-------------|
| `{scope}` | string | Target area to restructure |
| `{task_id}` | string | Kebab-case identifier |
| `{auto_mode}` | boolean | Skip confirmations |
| `{economy_mode}` | boolean | No subagents |
| `{save_mode}` | boolean | Save outputs |
| `{audit_only}` | boolean | Stop after audit |
| `{dry_run}` | boolean | Preview only |
| `{standalone_mode}` | boolean | Use built-in restructure + verify |
| `{smells}` | array | Detected architectural smells |
| `{dependency_map}` | object | File dependency graph |
| `{move_plan}` | array | Planned file operations |
</state_variables>
<reference_files>
| File | When Loaded |
|------|-------------|
| `references/architecture-smells.md` | Always (step-01) |
| `references/architecture-patterns.md` | Step-02 (design phase) |
| `references/restructuring-techniques.md` | Step-03 (execution phase) |
</reference_files>
<entry_point>
Load `steps/step-01-audit.md`
</entry_point>
<step_files>
| Step | File | Purpose |
|------|------|---------|
| 01 | `step-01-audit.md` | Structure analysis + smell detection |
| 02 | `step-02-design.md` | Restructuring plan |
| 03 | `step-03-handoff.md` | Save design context + offer APEX (default) |
| 03-alt | `step-03-restructure.md` | Safe execution (`--standalone` only) |
| 04-alt | `step-04-verify.md` | Build + validation (`--standalone` only) |
</step_files>
<execution_rules>
- Load one step at a time
- NEVER move files without reading them first
- ALWAYS use `git mv` to preserve history
- ALWAYS update imports after every move
- Use parallel agents in step-01 and step-03 (unless economy mode)
- Incremental commits after each logical group of changes
- Build must pass before marking complete
</execution_rules>
<success_criteria>
- Architectural smells correctly identified
- Dependency map accurately captures relationships
- Restructuring plan approved before execution
- All file moves use `git mv` (history preserved)
- All imports updated across codebase
- No circular dependencies introduced
- Build passes without errors
- Tests pass (if tests exist)
- Cleaner, simpler structure achieved
</success_criteria>
1---2name: architect-83description: Architectural refactoring - analyze codebase structure, detect architectural smells (god modules, circular deps, coupling), propose restructuring plan, safely move/rename files with git history, update imports, simplify architecture. Use when asked to "restructure", "reorganize", "simplify architecture", "move files", "split module", "fix structure", "reduce coupling", "reorganize folders", "clean up architecture", "refactor structure", "restructurer", "reorganiser", "simplifier".4---5
6<objective>
7Analyze codebase architecture, detect structural smells, and safely restructure code while preserving git history and updating all imports.
8</objective>
9
10<quick_start>
11**Restructure a specific area:**
12```bash
13/architect src/components
14```
15
16**Full codebase audit + restructure:**
17```bash
18/architect -a full codebase restructure
19```
20
21**Audit only (no changes):**
22```bash
23/architect -s audit auth module
24```
25
26**What it does:**
271. AUDIT: Scans structure, detects architectural smells (god modules, circular deps, coupling)
282. DESIGN: Proposes restructuring plan with file moves, splits, renames
293. RESTRUCTURE: Executes safely with `git mv`, import migration, incremental commits
304. VERIFY: Build, tests, import validation
31</quick_start>
32
33<parameters>
34
35| Flag | Description |
36|------|-------------|
37| `-a` | Auto mode: skip confirmations, execute full workflow |
38| `-e` | Economy mode: no subagents, direct tools only |
39| `-s` | Save mode: output to `.claude/output/architect/` |
40| `--audit-only` | Stop after audit step (no restructuring) |
41| `--dry-run` | Show proposed changes without executing |
42| `--standalone` | Use built-in RESTRUCTURE + VERIFY instead of APEX handoff |
43
44<examples>
45```bash
46/architect src/components # Audit + design → APEX handoff
47/architect -a reorganize api layer # Auto mode
48/architect -e simplify auth module # Economy mode
49/architect -s --audit-only src/ # Audit and save report
50/architect --dry-run split user module # Preview changes
51/architect --standalone src/components # Built-in restructure + verify
52```
53</examples>
54
55</parameters>
56
57<workflow>
58```
59DEFAULT: AUDIT → DESIGN → HANDOFF (saves design context, suggests /apex)
60--standalone: AUDIT → DESIGN → RESTRUCTURE → VERIFY
61
62AUDIT ─ Detect smells, map dependencies, measure complexity
63DESIGN ─ Propose structure, file moves, module splits
64HANDOFF ─ Save design context file, offer APEX implementation
65RESTRUCTURE ─ git mv, update imports, incremental commits (--standalone)
66VERIFY ─ Build, test, import validation (--standalone)
67```
68</workflow>
69
70<state_variables>
71
72| Variable | Type | Description |
73|----------|------|-------------|
74| `{scope}` | string | Target area to restructure |
75| `{task_id}` | string | Kebab-case identifier |
76| `{auto_mode}` | boolean | Skip confirmations |
77| `{economy_mode}` | boolean | No subagents |
78| `{save_mode}` | boolean | Save outputs |
79| `{audit_only}` | boolean | Stop after audit |
80| `{dry_run}` | boolean | Preview only |
81| `{standalone_mode}` | boolean | Use built-in restructure + verify |
82| `{smells}` | array | Detected architectural smells |
83| `{dependency_map}` | object | File dependency graph |
84| `{move_plan}` | array | Planned file operations |
85
86</state_variables>
87
88<reference_files>
89
90| File | When Loaded |
91|------|-------------|
92| `references/architecture-smells.md` | Always (step-01) |
93| `references/architecture-patterns.md` | Step-02 (design phase) |
94| `references/restructuring-techniques.md` | Step-03 (execution phase) |
95
96</reference_files>
97
98<entry_point>
99
100Load `steps/step-01-audit.md`
101
102</entry_point>
103
104<step_files>
105
106| Step | File | Purpose |
107|------|------|---------|
108| 01 | `step-01-audit.md` | Structure analysis + smell detection |
109| 02 | `step-02-design.md` | Restructuring plan |
110| 03 | `step-03-handoff.md` | Save design context + offer APEX (default) |
111| 03-alt | `step-03-restructure.md` | Safe execution (`--standalone` only) |
112| 04-alt | `step-04-verify.md` | Build + validation (`--standalone` only) |
113
114</step_files>
115
116<execution_rules>
117- Load one step at a time
118- NEVER move files without reading them first
119- ALWAYS use `git mv` to preserve history
120- ALWAYS update imports after every move
121- Use parallel agents in step-01 and step-03 (unless economy mode)
122- Incremental commits after each logical group of changes
123- Build must pass before marking complete
124</execution_rules>
125
126<success_criteria>
127- Architectural smells correctly identified
128- Dependency map accurately captures relationships
129- Restructuring plan approved before execution
130- All file moves use `git mv` (history preserved)
131- All imports updated across codebase
132- No circular dependencies introduced
133- Build passes without errors
134- Tests pass (if tests exist)
135- Cleaner, simpler structure achieved
136</success_criteria>