1 ---
2 name: code_review
3 description: Spawn a code review (architect) subagent for deep analysis, planning, and debugging. The architect specializes in strategic guidance rather than implementation. Architect should be called after building major features. Relies on `delegation` skill.
4 ---
5
6 # Architect Skill
7
8 Spawn an code review (a.k.a architect) subagent for analysis and planning. The architect specializes in analysis and strategic guidance rather than implementation.
9
10 ## When to Use
11
12 Use this skill when:
13
14 - You need deep architectural analysis or code understanding
15 - You want strategic recommendations about system design or patterns
16 - You need comprehensive analysis of code quality or technical debt
17 - You want root cause analysis and debugging assistance
18
19 ## When NOT to Use
20
21 - Simple tasks that you can complete directly
22 - Tasks that require file edits or implementation (use delegation skill instead)
23 - Read-only operations (use ripgrep or glob/read tools instead)
24
25 ## Available Functions
26
27 ### architect(task, relevantFiles, ...)
28
29 Spawn an architect subagent for analysis and planning.
30
31 **Parameters:**
32
33 - `task` (str, required): The analytical task or question for the architect
34 - `relevantFiles` (list[str], required): Full file paths to analyze
35 - `responsibility` (str, default "evaluate_task"): Focus area: "debug", "plan", or "evaluate_task"
36 - `includeGitDiff` (bool, default False): Include current unstaged git diff
37 - `relevantGitCommits` (str, optional): Git commit range to analyze (e.g., "HEAD~3..HEAD")
38
39 **Returns:** Dict with analysis results
40
41 ```json
42 {
43 "success": true,
44 "message": "Analysis summary",
45 "subagentAlias": "architect_1",
46 "result": "Full analysis output..."
47 }
48 ```
49
50 **Responsibilities:**
51
52 - **evaluate_task**: Assess completed or ongoing work against goals
53 - **plan**: Create implementation plans with task decomposition and sequencing
54 - **debug**: Root cause analysis, reproduction steps, and recommended fixes
55
56 **Example:**
57
58 ```javascript
59 // Plan a new feature
60 const result = await architect({
61 task: "Create a plan for implementing rate limiting on API endpoints.",
62 relevantFiles: ["src/middleware/index.ts", "src/routes/api.ts"],
63 responsibility: "plan"
64 });
65 console.log(result.result);
66
67 // Debug an issue
68 const result2 = await architect({
69 task: "The UserAuthService.validateSession() returns false for valid tokens.",
70 relevantFiles: ["src/services/UserAuthService.ts", "src/utils/jwt.ts"],
71 responsibility: "debug",
72 includeGitDiff: true
73 });
74 ```
75
76 ## Best Practices
77
78 1. **Be specific in your task description**: Include concrete function names, error messages, or design goals
79 2. **Provide relevant files**: The architect can only analyze files you pass in `relevantFiles`
80 3. **Choose the right responsibility**: Use "plan" for new work, "debug" for issues, "evaluate_task" for reviewing progress
81 4. **Use `includeGitDiff`**: When debugging regressions, include the diff to help the architect identify recent changes
82 5. **Use `relevantGitCommits`**: When you need the architect to understand recent history (e.g., "HEAD~3..HEAD")