@atlashub/smartstack-cli 3.7.0 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +365 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
- package/templates/agents/action.md +1 -0
- package/templates/agents/ba-writer.md +33 -0
- package/templates/agents/explore-codebase.md +1 -0
- package/templates/agents/explore-docs.md +1 -0
- package/templates/agents/fix-grammar.md +1 -0
- package/templates/agents/snipper.md +1 -0
- package/templates/skills/admin/SKILL.md +6 -0
- package/templates/skills/ai-prompt/SKILL.md +32 -136
- package/templates/skills/ai-prompt/steps/step-01-implementation.md +122 -0
- package/templates/skills/apex/SKILL.md +120 -0
- package/templates/skills/apex/_shared.md +86 -0
- package/templates/skills/apex/references/agent-teams-protocol.md +164 -0
- package/templates/skills/apex/references/smartstack-layers.md +173 -0
- package/templates/skills/apex/steps/step-00-init.md +156 -0
- package/templates/skills/apex/steps/step-01-analyze.md +169 -0
- package/templates/skills/apex/steps/step-02-plan.md +160 -0
- package/templates/skills/apex/steps/step-03-execute.md +166 -0
- package/templates/skills/apex/steps/step-04-validate.md +138 -0
- package/templates/skills/apex/steps/step-05-examine.md +124 -0
- package/templates/skills/apex/steps/step-06-resolve.md +105 -0
- package/templates/skills/apex/steps/step-07-tests.md +130 -0
- package/templates/skills/apex/steps/step-08-run-tests.md +115 -0
- package/templates/skills/application/SKILL.md +10 -0
- package/templates/skills/application/references/backend-controller-hierarchy.md +58 -0
- package/templates/skills/application/references/backend-entity-seeding.md +72 -0
- package/templates/skills/application/references/backend-verification.md +88 -0
- package/templates/skills/application/references/frontend-verification.md +111 -0
- package/templates/skills/application/references/nav-fallback-procedure.md +200 -0
- package/templates/skills/application/references/provider-template.md +134 -0
- package/templates/skills/application/references/test-frontend.md +73 -0
- package/templates/skills/application/references/test-prerequisites.md +72 -0
- package/templates/skills/application/steps/step-01-navigation.md +7 -198
- package/templates/skills/application/steps/step-03b-provider.md +4 -128
- package/templates/skills/application/steps/step-04-backend.md +20 -350
- package/templates/skills/application/steps/step-05-frontend.md +12 -101
- package/templates/skills/application/steps/step-07-tests.md +12 -132
- package/templates/skills/business-analyse/SKILL.md +11 -2
- package/templates/skills/business-analyse/html/ba-interactive.html +3214 -2246
- package/templates/skills/business-analyse/html/build-html.js +77 -0
- package/templates/skills/business-analyse/html/src/scripts/01-data-init.js +130 -0
- package/templates/skills/business-analyse/html/src/scripts/02-navigation.js +22 -0
- package/templates/skills/business-analyse/html/src/scripts/03-render-cadrage.js +208 -0
- package/templates/skills/business-analyse/html/src/scripts/04-render-modules.js +211 -0
- package/templates/skills/business-analyse/html/src/scripts/05-render-specs.js +554 -0
- package/templates/skills/business-analyse/html/src/scripts/06-render-consolidation.js +110 -0
- package/templates/skills/business-analyse/html/src/scripts/07-render-handoff.js +90 -0
- package/templates/skills/business-analyse/html/src/scripts/08-editing.js +45 -0
- package/templates/skills/business-analyse/html/src/scripts/09-export.js +168 -0
- package/templates/skills/business-analyse/html/src/scripts/10-comments.js +171 -0
- package/templates/skills/business-analyse/html/src/scripts/11-review-panel.js +161 -0
- package/templates/skills/business-analyse/html/src/styles/01-variables.css +38 -0
- package/templates/skills/business-analyse/html/src/styles/02-layout.css +101 -0
- package/templates/skills/business-analyse/html/src/styles/03-navigation.css +62 -0
- package/templates/skills/business-analyse/html/src/styles/04-cards.css +196 -0
- package/templates/skills/business-analyse/html/src/styles/05-modules.css +325 -0
- package/templates/skills/business-analyse/html/src/styles/06-wireframes.css +230 -0
- package/templates/skills/business-analyse/html/src/styles/07-comments.css +184 -0
- package/templates/skills/business-analyse/html/src/styles/08-review-panel.css +241 -0
- package/templates/skills/business-analyse/html/src/template.html +623 -0
- package/templates/skills/business-analyse/references/cadrage-structure-cards.md +78 -0
- package/templates/skills/business-analyse/references/cadrage-vibe-coding.md +97 -0
- package/templates/skills/business-analyse/references/consolidation-structural-checks.md +92 -0
- package/templates/skills/business-analyse/references/deploy-data-build.md +121 -0
- package/templates/skills/business-analyse/references/deploy-modes.md +49 -0
- package/templates/skills/business-analyse/references/handoff-file-templates.md +119 -0
- package/templates/skills/business-analyse/references/handoff-mappings.md +81 -0
- package/templates/skills/business-analyse/references/html-data-mapping.md +10 -2
- package/templates/skills/business-analyse/references/init-schema-deployment.md +65 -0
- package/templates/skills/business-analyse/references/review-data-mapping.md +363 -0
- package/templates/skills/business-analyse/references/spec-auto-inference.md +57 -0
- package/templates/skills/business-analyse/references/ui-dashboard-spec.md +85 -0
- package/templates/skills/business-analyse/references/ui-resource-cards.md +110 -0
- package/templates/skills/business-analyse/references/validate-incremental-html.md +55 -0
- package/templates/skills/business-analyse/steps/step-00-init.md +35 -68
- package/templates/skills/business-analyse/steps/step-01-cadrage.md +5 -194
- package/templates/skills/business-analyse/steps/step-03a-data.md +6 -49
- package/templates/skills/business-analyse/steps/step-03b-ui.md +12 -178
- package/templates/skills/business-analyse/steps/step-03d-validate.md +3 -48
- package/templates/skills/business-analyse/steps/step-04-consolidation.md +9 -104
- package/templates/skills/business-analyse/steps/step-05a-handoff.md +25 -441
- package/templates/skills/business-analyse/steps/step-05b-deploy.md +19 -187
- package/templates/skills/business-analyse/steps/step-06-review.md +277 -0
- package/templates/skills/cc-agent/references/agent-behavior-patterns.md +95 -0
- package/templates/skills/cc-agent/steps/step-02-generate.md +5 -78
- package/templates/skills/check-version/SKILL.md +7 -0
- package/templates/skills/controller/references/controller-code-templates.md +159 -0
- package/templates/skills/controller/references/permission-sync-templates.md +152 -0
- package/templates/skills/controller/steps/step-03-generate.md +6 -158
- package/templates/skills/controller/steps/step-04-perms.md +5 -144
- package/templates/skills/debug/SKILL.md +7 -0
- package/templates/skills/explore/SKILL.md +6 -0
- package/templates/skills/feature-full/SKILL.md +39 -142
- package/templates/skills/feature-full/steps/step-01-implementation.md +120 -0
- package/templates/skills/gitflow/references/init-config-template.md +135 -0
- package/templates/skills/gitflow/references/init-name-normalization.md +103 -0
- package/templates/skills/gitflow/references/plan-template.md +69 -0
- package/templates/skills/gitflow/references/start-efcore-preflight.md +70 -0
- package/templates/skills/gitflow/references/start-local-config.md +110 -0
- package/templates/skills/gitflow/steps/step-init.md +18 -289
- package/templates/skills/gitflow/steps/step-plan.md +6 -63
- package/templates/skills/gitflow/steps/step-start.md +16 -126
- package/templates/skills/mcp/SKILL.md +9 -213
- package/templates/skills/mcp/steps/step-01-healthcheck.md +108 -0
- package/templates/skills/mcp/steps/step-02-tools.md +73 -0
- package/templates/skills/notification/SKILL.md +7 -0
- package/templates/skills/quick-search/SKILL.md +5 -0
- package/templates/skills/ralph-loop/SKILL.md +99 -381
- package/templates/skills/ralph-loop/references/category-rules.md +259 -0
- package/templates/skills/ralph-loop/references/compact-loop.md +182 -0
- package/templates/skills/ralph-loop/references/task-transform-legacy.md +259 -0
- package/templates/skills/ralph-loop/references/team-orchestration.md +189 -0
- package/templates/skills/ralph-loop/steps/step-00-init.md +111 -383
- package/templates/skills/ralph-loop/steps/step-01-task.md +79 -896
- package/templates/skills/ralph-loop/steps/step-02-execute.md +68 -680
- package/templates/skills/ralph-loop/steps/step-03-commit.md +47 -277
- package/templates/skills/ralph-loop/steps/step-04-check.md +124 -607
- package/templates/skills/ralph-loop/steps/step-05-report.md +68 -367
- package/templates/skills/refactor/SKILL.md +12 -176
- package/templates/skills/refactor/steps/step-01-discover.md +60 -0
- package/templates/skills/refactor/steps/step-02-execute.md +67 -0
- package/templates/skills/review-code/SKILL.md +19 -257
- package/templates/skills/review-code/steps/step-01-smartstack.md +96 -0
- package/templates/skills/review-code/steps/step-02-detailed-review.md +80 -0
- package/templates/skills/review-code/steps/step-03-react.md +44 -0
- package/templates/skills/ui-components/SKILL.md +7 -0
- package/templates/skills/utils/SKILL.md +6 -0
- package/templates/skills/validate/SKILL.md +6 -0
- package/templates/skills/validate-feature/SKILL.md +8 -0
- package/templates/skills/workflow/SKILL.md +40 -118
- package/templates/skills/workflow/steps/step-01-implementation.md +84 -0
|
@@ -23,198 +23,34 @@ This skill finds all relevant files, creates ONE instruction file, then launches
|
|
|
23
23
|
<workflow>
|
|
24
24
|
|
|
25
25
|
## Phase 1: Discovery
|
|
26
|
+
1. Parse the refactor request (method name, pattern, code smell)
|
|
27
|
+
2. Find all affected files (Grep for code, Glob for file patterns)
|
|
28
|
+
3. Analyze scope — if >15 files, confirm with user
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Understand what the pattern means:
|
|
30
|
-
- Could be: method name, component name, pattern, code smell, etc.
|
|
31
|
-
- Identify the search strategy (Grep for code patterns, Glob for file patterns)
|
|
32
|
-
|
|
33
|
-
### 2. Find All Affected Files
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
Use Grep to search for the pattern in the codebase
|
|
37
|
-
Use Glob if searching by file name patterns
|
|
38
|
-
Exclude: node_modules, .git, dist, build, bin, obj
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### 3. Analyze Scope
|
|
42
|
-
|
|
43
|
-
- Count total files found
|
|
44
|
-
- If more than 15 files, ask user to confirm or narrow scope
|
|
45
|
-
- Show preview of files to refactor
|
|
30
|
+
See [steps/step-01-discover.md](steps/step-01-discover.md) for search strategy and instruction file template.
|
|
46
31
|
|
|
47
32
|
## Phase 2: Create Instructions
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
Generate unique ID: refactor-{timestamp}
|
|
53
|
-
Create folder: .claude/tasks/refactor-{timestamp}/
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### 5. Create ONE Instruction File
|
|
57
|
-
|
|
58
|
-
Create `.claude/tasks/refactor-{id}/instructions.md`:
|
|
59
|
-
|
|
60
|
-
```markdown
|
|
61
|
-
# Refactor: {title}
|
|
62
|
-
|
|
63
|
-
## Objective
|
|
64
|
-
{What needs to be refactored - derived from user request}
|
|
65
|
-
|
|
66
|
-
## Pattern to Find
|
|
67
|
-
{Exact code pattern, method name, or structure to locate}
|
|
68
|
-
|
|
69
|
-
## Transformation
|
|
70
|
-
{How to transform the found pattern - be specific and adaptive}
|
|
71
|
-
|
|
72
|
-
## Examples
|
|
73
|
-
Before:
|
|
74
|
-
{example of current code}
|
|
75
|
-
|
|
76
|
-
After:
|
|
77
|
-
{example of refactored code}
|
|
78
|
-
|
|
79
|
-
## Constraints
|
|
80
|
-
- Only modify code matching the pattern
|
|
81
|
-
- Preserve all existing functionality
|
|
82
|
-
- Follow codebase conventions
|
|
83
|
-
- No comments unless necessary
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
**IMPORTANT**: Make instructions adaptive - they should work for ANY file in the list.
|
|
33
|
+
4. Create task folder: `.claude/tasks/refactor-{timestamp}/`
|
|
34
|
+
5. Create ONE `instructions.md` with: Objective, Pattern, Transformation, Examples, Constraints
|
|
87
35
|
|
|
88
36
|
## Phase 3: Group and Execute
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
- Maximum 3 files per batch
|
|
93
|
-
- Group by related functionality when possible
|
|
94
|
-
|
|
95
|
-
### 7. Launch Snipper Agents in Parallel
|
|
96
|
-
|
|
97
|
-
For EACH batch, use Task tool with `subagent_type='Snipper'`:
|
|
98
|
-
|
|
99
|
-
```
|
|
100
|
-
Using the instructions in .claude/tasks/refactor-{id}/instructions.md, refactor these files:
|
|
101
|
-
- {file_1}
|
|
102
|
-
- {file_2}
|
|
103
|
-
- {file_3}
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
**CRITICAL**: Launch ALL batches in a SINGLE message with multiple Task calls.
|
|
107
|
-
|
|
108
|
-
### 8. Wait for Completion
|
|
109
|
-
|
|
110
|
-
- All Snipper agents run in parallel
|
|
111
|
-
- Collect results from each
|
|
37
|
+
6. Group files into batches (max 3 per batch)
|
|
38
|
+
7. Launch ALL Snipper agents in parallel (single message, multiple Task calls)
|
|
39
|
+
8. Wait for completion
|
|
112
40
|
|
|
113
41
|
## Phase 4: Verification
|
|
42
|
+
9. Validate changes (lint/typecheck/build)
|
|
43
|
+
10. Provide summary report
|
|
114
44
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
# For TypeScript/JavaScript
|
|
119
|
-
pnpm lint || npm run lint
|
|
120
|
-
pnpm tsc || npx tsc
|
|
121
|
-
|
|
122
|
-
# For .NET
|
|
123
|
-
dotnet build
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
Fix any errors immediately.
|
|
127
|
-
|
|
128
|
-
### 10. Summary Report
|
|
129
|
-
|
|
130
|
-
```
|
|
131
|
-
Refactor Complete: {title}
|
|
132
|
-
|
|
133
|
-
Files modified: {count}
|
|
134
|
-
Batches executed: {count}
|
|
135
|
-
Errors: {count}
|
|
136
|
-
|
|
137
|
-
Modified files:
|
|
138
|
-
- {file1}
|
|
139
|
-
- {file2}
|
|
140
|
-
...
|
|
141
|
-
|
|
142
|
-
Next steps:
|
|
143
|
-
- Review changes: git diff
|
|
144
|
-
- Run tests: pnpm test
|
|
145
|
-
- Commit: /gitflow:commit
|
|
146
|
-
```
|
|
45
|
+
See [steps/step-02-execute.md](steps/step-02-execute.md) for execution details and report format.
|
|
147
46
|
|
|
148
47
|
</workflow>
|
|
149
48
|
|
|
150
|
-
<instructions_template>
|
|
151
|
-
|
|
152
|
-
Create ONE file at `.claude/tasks/refactor-{id}/instructions.md`:
|
|
153
|
-
|
|
154
|
-
```markdown
|
|
155
|
-
# Refactor: {title}
|
|
156
|
-
|
|
157
|
-
## Objective
|
|
158
|
-
{What needs to be refactored - derived from user request}
|
|
159
|
-
|
|
160
|
-
## Pattern to Find
|
|
161
|
-
{Exact code pattern, method name, or structure to locate}
|
|
162
|
-
|
|
163
|
-
## Transformation
|
|
164
|
-
{How to transform the found pattern - be specific and adaptive}
|
|
165
|
-
|
|
166
|
-
## Examples
|
|
167
|
-
Before:
|
|
168
|
-
```
|
|
169
|
-
{example of current code}
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
After:
|
|
173
|
-
```
|
|
174
|
-
{example of refactored code}
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
## Constraints
|
|
178
|
-
- Only modify code matching the pattern
|
|
179
|
-
- Preserve all existing functionality
|
|
180
|
-
- Follow codebase conventions
|
|
181
|
-
- No comments unless necessary
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
</instructions_template>
|
|
185
|
-
|
|
186
|
-
<snipper_prompt_template>
|
|
187
|
-
|
|
188
|
-
For each batch, call Snipper with:
|
|
189
|
-
|
|
190
|
-
```
|
|
191
|
-
Using the instructions in .claude/tasks/refactor-{id}/instructions.md, refactor these files:
|
|
192
|
-
- {file_path_1}
|
|
193
|
-
- {file_path_2}
|
|
194
|
-
- {file_path_3}
|
|
195
|
-
|
|
196
|
-
Read the instructions file first, then apply the refactor to each file.
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
</snipper_prompt_template>
|
|
200
|
-
|
|
201
|
-
<execution_rules>
|
|
202
|
-
|
|
203
|
-
- **PARALLEL EXECUTION**: Launch all Snipper batches simultaneously
|
|
204
|
-
- **SINGLE INSTRUCTION FILE**: One instructions.md for all batches
|
|
205
|
-
- **MAX 3 FILES PER BATCH**: Keep Snipper agents focused
|
|
206
|
-
- **VALIDATE AFTER**: Run lint/typecheck after all batches complete
|
|
207
|
-
- **PRESERVE FUNCTIONALITY**: Never break existing behavior
|
|
208
|
-
|
|
209
|
-
</execution_rules>
|
|
210
|
-
|
|
211
49
|
<success_criteria>
|
|
212
|
-
|
|
213
50
|
- All target files identified
|
|
214
51
|
- ONE instruction file created in `.claude/tasks/refactor-{id}/instructions.md`
|
|
215
52
|
- Snipper agents launched in parallel (max 3 files per agent)
|
|
216
53
|
- All batches completed successfully
|
|
217
54
|
- Lint/type checks pass
|
|
218
55
|
- Summary provided to user
|
|
219
|
-
|
|
220
56
|
</success_criteria>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Phase 1: Discovery & Instructions
|
|
2
|
+
|
|
3
|
+
## 1. Parse the Refactor Request
|
|
4
|
+
|
|
5
|
+
Understand what the pattern means:
|
|
6
|
+
- Could be: method name, component name, pattern, code smell, etc.
|
|
7
|
+
- Identify the search strategy (Grep for code patterns, Glob for file patterns)
|
|
8
|
+
|
|
9
|
+
## 2. Find All Affected Files
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
Use Grep to search for the pattern in the codebase
|
|
13
|
+
Use Glob if searching by file name patterns
|
|
14
|
+
Exclude: node_modules, .git, dist, build, bin, obj
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 3. Analyze Scope
|
|
18
|
+
|
|
19
|
+
- Count total files found
|
|
20
|
+
- If more than 15 files, ask user to confirm or narrow scope
|
|
21
|
+
- Show preview of files to refactor
|
|
22
|
+
|
|
23
|
+
## 4. Create Task Folder
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
Generate unique ID: refactor-{timestamp}
|
|
27
|
+
Create folder: .claude/tasks/refactor-{timestamp}/
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## 5. Create ONE Instruction File
|
|
31
|
+
|
|
32
|
+
Create `.claude/tasks/refactor-{id}/instructions.md`:
|
|
33
|
+
|
|
34
|
+
```markdown
|
|
35
|
+
# Refactor: {title}
|
|
36
|
+
|
|
37
|
+
## Objective
|
|
38
|
+
{What needs to be refactored - derived from user request}
|
|
39
|
+
|
|
40
|
+
## Pattern to Find
|
|
41
|
+
{Exact code pattern, method name, or structure to locate}
|
|
42
|
+
|
|
43
|
+
## Transformation
|
|
44
|
+
{How to transform the found pattern - be specific and adaptive}
|
|
45
|
+
|
|
46
|
+
## Examples
|
|
47
|
+
Before:
|
|
48
|
+
{example of current code}
|
|
49
|
+
|
|
50
|
+
After:
|
|
51
|
+
{example of refactored code}
|
|
52
|
+
|
|
53
|
+
## Constraints
|
|
54
|
+
- Only modify code matching the pattern
|
|
55
|
+
- Preserve all existing functionality
|
|
56
|
+
- Follow codebase conventions
|
|
57
|
+
- No comments unless necessary
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**IMPORTANT**: Make instructions adaptive - they should work for ANY file in the list.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Phase 3-4: Execute & Verify
|
|
2
|
+
|
|
3
|
+
## Group Files into Batches
|
|
4
|
+
|
|
5
|
+
- Maximum 3 files per batch
|
|
6
|
+
- Group by related functionality when possible
|
|
7
|
+
|
|
8
|
+
## Launch Snipper Agents in Parallel
|
|
9
|
+
|
|
10
|
+
For EACH batch, use Task tool with `subagent_type='Snipper'`:
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
Using the instructions in .claude/tasks/refactor-{id}/instructions.md, refactor these files:
|
|
14
|
+
- {file_1}
|
|
15
|
+
- {file_2}
|
|
16
|
+
- {file_3}
|
|
17
|
+
|
|
18
|
+
Read the instructions file first, then apply the refactor to each file.
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**CRITICAL**: Launch ALL batches in a SINGLE message with multiple Task calls.
|
|
22
|
+
|
|
23
|
+
## Wait for Completion
|
|
24
|
+
|
|
25
|
+
- All Snipper agents run in parallel
|
|
26
|
+
- Collect results from each
|
|
27
|
+
|
|
28
|
+
## Validate Changes
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# For TypeScript/JavaScript
|
|
32
|
+
pnpm lint || npm run lint
|
|
33
|
+
pnpm tsc || npx tsc
|
|
34
|
+
|
|
35
|
+
# For .NET
|
|
36
|
+
dotnet build
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Fix any errors immediately.
|
|
40
|
+
|
|
41
|
+
## Summary Report
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
Refactor Complete: {title}
|
|
45
|
+
|
|
46
|
+
Files modified: {count}
|
|
47
|
+
Batches executed: {count}
|
|
48
|
+
Errors: {count}
|
|
49
|
+
|
|
50
|
+
Modified files:
|
|
51
|
+
- {file1}
|
|
52
|
+
- {file2}
|
|
53
|
+
...
|
|
54
|
+
|
|
55
|
+
Next steps:
|
|
56
|
+
- Review changes: git diff
|
|
57
|
+
- Run tests: pnpm test
|
|
58
|
+
- Commit: /gitflow:commit
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Execution Rules
|
|
62
|
+
|
|
63
|
+
- **PARALLEL EXECUTION**: Launch all Snipper batches simultaneously
|
|
64
|
+
- **SINGLE INSTRUCTION FILE**: One instructions.md for all batches
|
|
65
|
+
- **MAX 3 FILES PER BATCH**: Keep Snipper agents focused
|
|
66
|
+
- **VALIDATE AFTER**: Run lint/typecheck after all batches complete
|
|
67
|
+
- **PRESERVE FUNCTIONALITY**: Never break existing behavior
|
|
@@ -15,111 +15,11 @@ Provide expert-level code review guidance that focuses on high-impact issues: se
|
|
|
15
15
|
Based on research from Google, Microsoft, OWASP, and academic studies on code review effectiveness.
|
|
16
16
|
|
|
17
17
|
**For SmartStack projects**: Automatically validates SmartStack-specific conventions via MCP.
|
|
18
|
+
See [steps/step-01-smartstack.md](steps/step-01-smartstack.md) for full MCP integration workflow.
|
|
18
19
|
</objective>
|
|
19
20
|
|
|
20
|
-
<smartstack_integration>
|
|
21
|
-
## SmartStack Project Detection & MCP Validation
|
|
22
|
-
|
|
23
|
-
**CRITICAL**: Before starting any code review, detect if this is a SmartStack project and run MCP validation.
|
|
24
|
-
|
|
25
|
-
<detection>
|
|
26
|
-
**Detect SmartStack project by checking for ANY of these:**
|
|
27
|
-
- `.claude/mcp-status.json` exists
|
|
28
|
-
- `SmartStack.Domain/` or `SmartStack.Application/` directories
|
|
29
|
-
- `*.sln` file containing "SmartStack"
|
|
30
|
-
- `package.json` with `@smartstack/` dependencies
|
|
31
|
-
</detection>
|
|
32
|
-
|
|
33
|
-
<mcp_validation>
|
|
34
|
-
**If SmartStack detected, run comprehensive code review via MCP:**
|
|
35
|
-
|
|
36
|
-
**Primary tool - `review_code`** (NEW - unified review):
|
|
37
|
-
```
|
|
38
|
-
mcp__smartstack__review_code
|
|
39
|
-
scope: "changed" # or "all" or "staged"
|
|
40
|
-
checks: ["all"] # 9 categories covered
|
|
41
|
-
severity: "all" # blocking, critical, warning, info
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
**This single tool covers ALL categories:**
|
|
45
|
-
- Security (OWASP, secrets, SQL injection, XSS)
|
|
46
|
-
- Architecture (layer violations, DI bypass)
|
|
47
|
-
- Hardcoded values (magic numbers, URLs, feature flags)
|
|
48
|
-
- Tests (missing tests, test quality)
|
|
49
|
-
- AI Hallucinations (non-existent imports, phantom methods)
|
|
50
|
-
- Performance (N+1 queries, over-fetching)
|
|
51
|
-
- Dead Code (unused imports, functions)
|
|
52
|
-
- i18n (non-translated UI text)
|
|
53
|
-
- Accessibility (missing alt, ARIA issues)
|
|
54
|
-
|
|
55
|
-
**Optional: Additional convention checks:**
|
|
56
|
-
```
|
|
57
|
-
mcp__smartstack__validate_conventions
|
|
58
|
-
checks: ["all"]
|
|
59
|
-
```
|
|
60
|
-
</mcp_validation>
|
|
61
|
-
|
|
62
|
-
<mcp_checks>
|
|
63
|
-
**SmartStack code review categories via MCP `review_code`:**
|
|
64
|
-
|
|
65
|
-
| Category | Check ID | What it detects |
|
|
66
|
-
|----------|----------|-----------------|
|
|
67
|
-
| **Security** | SEC-xxx | Hardcoded secrets, SQL injection, XSS, missing [Authorize] |
|
|
68
|
-
| **Architecture** | ARCH-xxx | Layer violations (Domain→Infrastructure), DI bypass |
|
|
69
|
-
| **Hardcoded** | HARD-xxx | Magic numbers, hardcoded URLs, feature flags |
|
|
70
|
-
| **Tests** | TEST-xxx | Missing tests, useless assertions, no coverage |
|
|
71
|
-
| **AI Hallucinations** | AI-xxx | Non-existent imports, phantom methods, placeholders |
|
|
72
|
-
| **Performance** | PERF-xxx | N+1 queries, ToList before Where, over-fetching |
|
|
73
|
-
| **Dead Code** | DEAD-xxx | Unused imports, functions, commented code, TODOs |
|
|
74
|
-
| **i18n** | I18N-xxx | Hardcoded UI text, missing translations |
|
|
75
|
-
| **Accessibility** | A11Y-xxx | Missing alt, no aria-label, focus issues |
|
|
76
|
-
|
|
77
|
-
**Severity levels:**
|
|
78
|
-
- `blocking` → Must fix before merge (security, hallucinations)
|
|
79
|
-
- `critical` → Should fix ASAP (architecture, tests)
|
|
80
|
-
- `warning` → Recommended fix (performance, dead code)
|
|
81
|
-
- `info` → Nice to have (i18n, a11y)
|
|
82
|
-
</mcp_checks>
|
|
83
|
-
|
|
84
|
-
<output_integration>
|
|
85
|
-
**Merge MCP `review_code` results into review output:**
|
|
86
|
-
|
|
87
|
-
The MCP tool returns a structured report. Display it as-is or integrate key findings:
|
|
88
|
-
|
|
89
|
-
```markdown
|
|
90
|
-
## Code Review Results (via MCP)
|
|
91
|
-
|
|
92
|
-
### Summary
|
|
93
|
-
| Metric | Value |
|
|
94
|
-
|--------|-------|
|
|
95
|
-
| Status | {PASSED/FAILED/WARNING} |
|
|
96
|
-
| Score | {score}/100 |
|
|
97
|
-
| Grade | {A/B/C/D/F} |
|
|
98
|
-
|
|
99
|
-
### Blocking Issues ({count})
|
|
100
|
-
| ID | Issue | File:Line | Fix |
|
|
101
|
-
|----|-------|-----------|-----|
|
|
102
|
-
| SEC-001 | {title} | `{file}:{line}` | {suggestion} |
|
|
103
|
-
|
|
104
|
-
### Critical Issues ({count})
|
|
105
|
-
| ID | Issue | File:Line | Fix |
|
|
106
|
-
|----|-------|-----------|-----|
|
|
107
|
-
| ARCH-001 | {title} | `{file}:{line}` | {suggestion} |
|
|
108
|
-
|
|
109
|
-
### Warnings ({count})
|
|
110
|
-
(List or summarize)
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
**Priority mapping from MCP:**
|
|
114
|
-
- `blocking` → `[BLOCKING]` - Must fix before merge
|
|
115
|
-
- `critical` → `[CRITICAL]` - Should fix ASAP
|
|
116
|
-
- `warning` → `[SUGGESTION]` - Recommended
|
|
117
|
-
- `info` → `[NIT]` - Nice to have
|
|
118
|
-
</output_integration>
|
|
119
|
-
</smartstack_integration>
|
|
120
|
-
|
|
121
21
|
<quick_start>
|
|
122
|
-
|
|
22
|
+
|
|
123
23
|
**Priority order**: Security > Correctness > Maintainability > Performance
|
|
124
24
|
|
|
125
25
|
**High-value feedback** (36-43% implementation rate):
|
|
@@ -132,180 +32,42 @@ The MCP tool returns a structured report. Display it as-is or integrate key find
|
|
|
132
32
|
- Formatting/whitespace
|
|
133
33
|
- Simple naming conventions
|
|
134
34
|
- Linting violations
|
|
135
|
-
</review_priority>
|
|
136
35
|
|
|
137
|
-
|
|
36
|
+
**Essential checks:**
|
|
138
37
|
1. **Security**: Input validation, auth checks, secrets exposure
|
|
139
38
|
2. **Logic**: Edge cases, error handling, null checks
|
|
140
39
|
3. **Architecture**: Single responsibility, proper abstractions
|
|
141
40
|
4. **Tests**: Coverage for new functionality
|
|
142
|
-
</essential_checks>
|
|
143
|
-
</quick_start>
|
|
144
|
-
|
|
145
|
-
<review_categories>
|
|
146
|
-
<category name="security" priority="critical">
|
|
147
|
-
**Must check in every review:**
|
|
148
|
-
- No hardcoded credentials (search: `password.*=.*['"]`, `api[_-]?key.*=`)
|
|
149
|
-
- Input validation on all user data
|
|
150
|
-
- Parameterized queries (no string concatenation for SQL)
|
|
151
|
-
- Authorization checks on every endpoint
|
|
152
|
-
- No `eval()`, `exec()`, dangerous functions
|
|
153
|
-
|
|
154
|
-
See [references/security-checklist.md](references/security-checklist.md) for OWASP Top 10 patterns (web application vulnerabilities).
|
|
155
|
-
See [references/owasp-api-top10.md](references/owasp-api-top10.md) for OWASP API Security Top 10 (API-specific threats: BOLA, mass assignment, SSRF, resource consumption).
|
|
156
|
-
</category>
|
|
157
41
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
- Business logic matches requirements
|
|
161
|
-
- Edge cases handled (null, empty, boundary values)
|
|
162
|
-
- Error handling present and appropriate
|
|
163
|
-
- Race conditions in async code
|
|
164
|
-
- Resource cleanup (connections, file handles)
|
|
165
|
-
</category>
|
|
166
|
-
|
|
167
|
-
<category name="clean_code" priority="high">
|
|
168
|
-
**Check for code smells:**
|
|
169
|
-
- Large functions (>50 lines) - violate Single Responsibility
|
|
170
|
-
- Deep nesting (>3 levels) - extract to functions
|
|
171
|
-
- Long parameter lists (>3 params) - use objects
|
|
172
|
-
- Duplicated code - extract to shared functions
|
|
173
|
-
- Magic numbers/strings - use named constants
|
|
174
|
-
|
|
175
|
-
See [references/clean-code-principles.md](references/clean-code-principles.md) for SOLID principles and code smells.
|
|
176
|
-
</category>
|
|
177
|
-
|
|
178
|
-
<category name="maintainability" priority="medium">
|
|
179
|
-
**Assess long-term health:**
|
|
180
|
-
- Cognitive complexity <15 per function
|
|
181
|
-
- Clear naming that reveals intent
|
|
182
|
-
- Appropriate abstractions (not over-engineered)
|
|
183
|
-
- Test coverage for critical paths
|
|
184
|
-
</category>
|
|
185
|
-
</review_categories>
|
|
42
|
+
See [steps/step-02-detailed-review.md](steps/step-02-detailed-review.md) for full review categories, metrics, and anti-patterns.
|
|
43
|
+
</quick_start>
|
|
186
44
|
|
|
187
45
|
<feedback_guidelines>
|
|
188
|
-
<valuable_feedback>
|
|
189
|
-
**Structure**: What + Why + How
|
|
190
|
-
|
|
191
|
-
✓ "This function is 80 lines with 5 responsibilities. Consider extracting the validation logic (lines 20-45) into `validateUserInput()` for testability."
|
|
192
46
|
|
|
193
|
-
|
|
47
|
+
**Structure**: What + Why + How
|
|
194
48
|
|
|
195
|
-
|
|
196
|
-
|
|
49
|
+
Good:
|
|
50
|
+
- "This function is 80 lines with 5 responsibilities. Consider extracting the validation logic (lines 20-45) into `validateUserInput()` for testability."
|
|
51
|
+
- "SQL query uses string concatenation (line 34). Use parameterized queries to prevent injection: `db.query('SELECT * FROM users WHERE id = ?', [userId])`"
|
|
52
|
+
- "Missing null check on `user.profile` (line 52). This will throw if user hasn't completed onboarding. Add: `if (!user.profile) return defaultProfile;`"
|
|
197
53
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
✗ "I would do this differently" (subjective without reason)
|
|
203
|
-
</wasteful_feedback>
|
|
54
|
+
Bad:
|
|
55
|
+
- "This could be cleaner" (vague)
|
|
56
|
+
- "Rename this variable" (nitpick - use linter)
|
|
57
|
+
- "I would do this differently" (subjective without reason)
|
|
204
58
|
|
|
205
|
-
|
|
206
|
-
Use clear labels to distinguish severity:
|
|
59
|
+
**Priority labels:**
|
|
207
60
|
- **[BLOCKING]**: Must fix before merge (security, bugs)
|
|
208
61
|
- **[SUGGESTION]**: Would improve code but not required
|
|
209
62
|
- **[NIT]**: Minor preference (mark clearly or skip entirely)
|
|
210
63
|
|
|
211
64
|
See [references/feedback-patterns.md](references/feedback-patterns.md) for communication strategies.
|
|
212
|
-
</priority_labels>
|
|
213
65
|
</feedback_guidelines>
|
|
214
66
|
|
|
215
|
-
<
|
|
216
|
-
|
|
217
|
-
-
|
|
218
|
-
|
|
219
|
-
- Prefer early returns over deep nesting
|
|
220
|
-
</metric>
|
|
221
|
-
|
|
222
|
-
<metric name="function_size">
|
|
223
|
-
- Target: <50 lines, ideally <20
|
|
224
|
-
- Should fit on one screen
|
|
225
|
-
- One function = one responsibility
|
|
226
|
-
</metric>
|
|
227
|
-
|
|
228
|
-
<metric name="cyclomatic_complexity">
|
|
229
|
-
- Target: <10 per function
|
|
230
|
-
- Count: 1 + (if + while + for + case + catch + && + ||)
|
|
231
|
-
- High complexity = hard to test
|
|
232
|
-
</metric>
|
|
233
|
-
|
|
234
|
-
See [references/code-quality-metrics.md](references/code-quality-metrics.md) for detailed calculations.
|
|
235
|
-
</code_quality_metrics>
|
|
236
|
-
|
|
237
|
-
<anti_patterns>
|
|
238
|
-
<pattern name="nitpicking">
|
|
239
|
-
**Problem**: Excessive minor comments bury critical issues
|
|
240
|
-
**Impact**: Developers become defensive, stop reading feedback
|
|
241
|
-
**Solution**: Automate style with linters; focus humans on logic/security
|
|
242
|
-
</pattern>
|
|
243
|
-
|
|
244
|
-
<pattern name="vague_criticism">
|
|
245
|
-
**Problem**: "This is wrong" without explanation
|
|
246
|
-
**Impact**: Developer doesn't know how to fix; creates friction
|
|
247
|
-
**Solution**: Always include What + Why + How
|
|
248
|
-
</pattern>
|
|
249
|
-
|
|
250
|
-
<pattern name="blocking_on_preferences">
|
|
251
|
-
**Problem**: Blocking merge for subjective style preferences
|
|
252
|
-
**Impact**: Delays delivery; damages team trust
|
|
253
|
-
**Solution**: Reserve blocking for security/correctness only
|
|
254
|
-
</pattern>
|
|
255
|
-
|
|
256
|
-
<pattern name="reviewing_unchanged_code">
|
|
257
|
-
**Problem**: Commenting on code outside the PR diff
|
|
258
|
-
**Impact**: Scope creep; unfair to author
|
|
259
|
-
**Solution**: Focus only on changed lines; file separate issues for existing problems
|
|
260
|
-
</pattern>
|
|
261
|
-
</anti_patterns>
|
|
262
|
-
|
|
263
|
-
<react_nextjs_review>
|
|
264
|
-
## React/Next.js Codebase Detection
|
|
265
|
-
|
|
266
|
-
**When reviewing a React or Next.js project**, launch an additional parallel agent for Vercel React best practices.
|
|
267
|
-
|
|
268
|
-
<detection>
|
|
269
|
-
**Detect React/Next.js codebase by checking:**
|
|
270
|
-
- `package.json` contains `"next"` or `"react"` dependencies
|
|
271
|
-
- Files with `.tsx`, `.jsx` extensions in changes
|
|
272
|
-
- `next.config.js` or `next.config.ts` exists
|
|
273
|
-
- `app/` or `pages/` directory structure (Next.js)
|
|
274
|
-
</detection>
|
|
275
|
-
|
|
276
|
-
<parallel_agent>
|
|
277
|
-
**If React/Next.js detected, launch parallel agent:**
|
|
278
|
-
|
|
279
|
-
```yaml
|
|
280
|
-
agent:
|
|
281
|
-
type: code-reviewer
|
|
282
|
-
focus: "vercel-react-best-practices"
|
|
283
|
-
task: |
|
|
284
|
-
Review the recent code changes using Vercel React best practices.
|
|
285
|
-
Focus on:
|
|
286
|
-
- Eliminating waterfalls (async patterns, Promise.all)
|
|
287
|
-
- Bundle size optimization (dynamic imports, barrel files)
|
|
288
|
-
- Server-side performance (caching, serialization)
|
|
289
|
-
- Re-render optimization (memoization, state management)
|
|
290
|
-
- Rendering performance patterns
|
|
291
|
-
|
|
292
|
-
Use the /vercel-react-best-practices skill as reference.
|
|
293
|
-
Report findings with [BLOCKING], [SUGGESTION], or [NIT] labels.
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
**Execution:**
|
|
297
|
-
1. Check for React/Next.js in `package.json`
|
|
298
|
-
2. If detected, use Task tool to launch parallel agent:
|
|
299
|
-
```
|
|
300
|
-
Task tool with subagent_type="code-reviewer":
|
|
301
|
-
"Review recent changes against Vercel React best practices from /vercel-react-best-practices skill.
|
|
302
|
-
Focus on: async patterns, bundle optimization, server performance, re-renders.
|
|
303
|
-
Check changed files for violations of rules like async-parallel, bundle-barrel-imports,
|
|
304
|
-
server-cache-react, rerender-memo. Report with priority labels."
|
|
305
|
-
```
|
|
306
|
-
3. Merge findings into main review output
|
|
307
|
-
</parallel_agent>
|
|
308
|
-
</react_nextjs_review>
|
|
67
|
+
<react_nextjs>
|
|
68
|
+
**When reviewing a React or Next.js project**, launch an additional parallel code-reviewer agent.
|
|
69
|
+
See [steps/step-03-react.md](steps/step-03-react.md) for detection and agent configuration.
|
|
70
|
+
</react_nextjs>
|
|
309
71
|
|
|
310
72
|
<success_criteria>
|
|
311
73
|
A good code review:
|