@atlashub/smartstack-cli 1.23.0 → 1.24.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.
Files changed (33) hide show
  1. package/dist/index.js +13 -0
  2. package/dist/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/skills/check-version/SKILL.md +183 -0
  5. package/templates/skills/debug/SKILL.md +161 -0
  6. package/templates/skills/explore/SKILL.md +96 -0
  7. package/templates/skills/quick-search/SKILL.md +87 -0
  8. package/templates/skills/refactor/SKILL.md +219 -0
  9. package/templates/skills/review-code/SKILL.md +72 -44
  10. package/templates/skills/review-code/references/smartstack-conventions.md +93 -33
  11. package/templates/skills/ui-components/responsive-guidelines.md +278 -0
  12. package/templates/skills/utils/SKILL.md +37 -0
  13. package/templates/{commands/utils → skills/utils/subcommands}/test-web-config.md +35 -43
  14. package/templates/{commands/utils → skills/utils/subcommands}/test-web.md +25 -53
  15. package/templates/{commands/validate.md → skills/validate/SKILL.md} +80 -139
  16. package/templates/commands/check-version.md +0 -267
  17. package/templates/commands/debug.md +0 -95
  18. package/templates/commands/efcore/_env-check.md +0 -153
  19. package/templates/commands/efcore/_shared.md +0 -352
  20. package/templates/commands/efcore/conflicts.md +0 -90
  21. package/templates/commands/efcore/db-deploy.md +0 -109
  22. package/templates/commands/efcore/db-reset.md +0 -180
  23. package/templates/commands/efcore/db-seed.md +0 -103
  24. package/templates/commands/efcore/db-status.md +0 -102
  25. package/templates/commands/efcore/migration.md +0 -186
  26. package/templates/commands/efcore/rebase-snapshot.md +0 -172
  27. package/templates/commands/efcore/scan.md +0 -94
  28. package/templates/commands/efcore/squash.md +0 -329
  29. package/templates/commands/efcore.md +0 -96
  30. package/templates/commands/explore.md +0 -45
  31. package/templates/commands/quick-search.md +0 -72
  32. package/templates/commands/refactor.md +0 -164
  33. /package/templates/{commands → skills}/_resources/formatting-guide.md +0 -0
@@ -0,0 +1,219 @@
1
+ ---
2
+ name: refactor
3
+ description: Refactor code by finding files, grouping them, and launching parallel Snipper agents
4
+ argument-hint: <search-pattern-or-description>
5
+ ---
6
+
7
+ <objective>
8
+ Refactor code matching the given pattern across the codebase using parallel Snipper agents for maximum speed.
9
+
10
+ This skill finds all relevant files, creates ONE instruction file, then launches Snipper agents in parallel with batches of max 3 files each.
11
+ </objective>
12
+
13
+ <quick_start>
14
+ ```bash
15
+ /refactor rename getUserData to fetchUserProfile
16
+ /refactor replace console.log with logger.info
17
+ /refactor convert class components to functional
18
+ /refactor update deprecated API calls
19
+ ```
20
+ </quick_start>
21
+
22
+ <workflow>
23
+
24
+ ## Phase 1: Discovery
25
+
26
+ ### 1. Parse the Refactor Request
27
+
28
+ Understand what the pattern means:
29
+ - Could be: method name, component name, pattern, code smell, etc.
30
+ - Identify the search strategy (Grep for code patterns, Glob for file patterns)
31
+
32
+ ### 2. Find All Affected Files
33
+
34
+ ```
35
+ Use Grep to search for the pattern in the codebase
36
+ Use Glob if searching by file name patterns
37
+ Exclude: node_modules, .git, dist, build, bin, obj
38
+ ```
39
+
40
+ ### 3. Analyze Scope
41
+
42
+ - Count total files found
43
+ - If more than 15 files, ask user to confirm or narrow scope
44
+ - Show preview of files to refactor
45
+
46
+ ## Phase 2: Create Instructions
47
+
48
+ ### 4. Create Task Folder
49
+
50
+ ```
51
+ Generate unique ID: refactor-{timestamp}
52
+ Create folder: .claude/tasks/refactor-{timestamp}/
53
+ ```
54
+
55
+ ### 5. Create ONE Instruction File
56
+
57
+ Create `.claude/tasks/refactor-{id}/instructions.md`:
58
+
59
+ ```markdown
60
+ # Refactor: {title}
61
+
62
+ ## Objective
63
+ {What needs to be refactored - derived from user request}
64
+
65
+ ## Pattern to Find
66
+ {Exact code pattern, method name, or structure to locate}
67
+
68
+ ## Transformation
69
+ {How to transform the found pattern - be specific and adaptive}
70
+
71
+ ## Examples
72
+ Before:
73
+ {example of current code}
74
+
75
+ After:
76
+ {example of refactored code}
77
+
78
+ ## Constraints
79
+ - Only modify code matching the pattern
80
+ - Preserve all existing functionality
81
+ - Follow codebase conventions
82
+ - No comments unless necessary
83
+ ```
84
+
85
+ **IMPORTANT**: Make instructions adaptive - they should work for ANY file in the list.
86
+
87
+ ## Phase 3: Group and Execute
88
+
89
+ ### 6. Group Files into Batches
90
+
91
+ - Maximum 3 files per batch
92
+ - Group by related functionality when possible
93
+
94
+ ### 7. Launch Snipper Agents in Parallel
95
+
96
+ For EACH batch, use Task tool with `subagent_type='Snipper'`:
97
+
98
+ ```
99
+ Using the instructions in .claude/tasks/refactor-{id}/instructions.md, refactor these files:
100
+ - {file_1}
101
+ - {file_2}
102
+ - {file_3}
103
+ ```
104
+
105
+ **CRITICAL**: Launch ALL batches in a SINGLE message with multiple Task calls.
106
+
107
+ ### 8. Wait for Completion
108
+
109
+ - All Snipper agents run in parallel
110
+ - Collect results from each
111
+
112
+ ## Phase 4: Verification
113
+
114
+ ### 9. Validate Changes
115
+
116
+ ```bash
117
+ # For TypeScript/JavaScript
118
+ pnpm lint || npm run lint
119
+ pnpm tsc || npx tsc
120
+
121
+ # For .NET
122
+ dotnet build
123
+ ```
124
+
125
+ Fix any errors immediately.
126
+
127
+ ### 10. Summary Report
128
+
129
+ ```
130
+ Refactor Complete: {title}
131
+
132
+ Files modified: {count}
133
+ Batches executed: {count}
134
+ Errors: {count}
135
+
136
+ Modified files:
137
+ - {file1}
138
+ - {file2}
139
+ ...
140
+
141
+ Next steps:
142
+ - Review changes: git diff
143
+ - Run tests: pnpm test
144
+ - Commit: /gitflow:commit
145
+ ```
146
+
147
+ </workflow>
148
+
149
+ <instructions_template>
150
+
151
+ Create ONE file at `.claude/tasks/refactor-{id}/instructions.md`:
152
+
153
+ ```markdown
154
+ # Refactor: {title}
155
+
156
+ ## Objective
157
+ {What needs to be refactored - derived from user request}
158
+
159
+ ## Pattern to Find
160
+ {Exact code pattern, method name, or structure to locate}
161
+
162
+ ## Transformation
163
+ {How to transform the found pattern - be specific and adaptive}
164
+
165
+ ## Examples
166
+ Before:
167
+ ```
168
+ {example of current code}
169
+ ```
170
+
171
+ After:
172
+ ```
173
+ {example of refactored code}
174
+ ```
175
+
176
+ ## Constraints
177
+ - Only modify code matching the pattern
178
+ - Preserve all existing functionality
179
+ - Follow codebase conventions
180
+ - No comments unless necessary
181
+ ```
182
+
183
+ </instructions_template>
184
+
185
+ <snipper_prompt_template>
186
+
187
+ For each batch, call Snipper with:
188
+
189
+ ```
190
+ Using the instructions in .claude/tasks/refactor-{id}/instructions.md, refactor these files:
191
+ - {file_path_1}
192
+ - {file_path_2}
193
+ - {file_path_3}
194
+
195
+ Read the instructions file first, then apply the refactor to each file.
196
+ ```
197
+
198
+ </snipper_prompt_template>
199
+
200
+ <execution_rules>
201
+
202
+ - **PARALLEL EXECUTION**: Launch all Snipper batches simultaneously
203
+ - **SINGLE INSTRUCTION FILE**: One instructions.md for all batches
204
+ - **MAX 3 FILES PER BATCH**: Keep Snipper agents focused
205
+ - **VALIDATE AFTER**: Run lint/typecheck after all batches complete
206
+ - **PRESERVE FUNCTIONALITY**: Never break existing behavior
207
+
208
+ </execution_rules>
209
+
210
+ <success_criteria>
211
+
212
+ - All target files identified
213
+ - ONE instruction file created in `.claude/tasks/refactor-{id}/instructions.md`
214
+ - Snipper agents launched in parallel (max 3 files per agent)
215
+ - All batches completed successfully
216
+ - Lint/type checks pass
217
+ - Summary provided to user
218
+
219
+ </success_criteria>
@@ -25,62 +25,90 @@ Based on research from Google, Microsoft, OWASP, and academic studies on code re
25
25
  </detection>
26
26
 
27
27
  <mcp_validation>
28
- **If SmartStack detected, run MCP validation FIRST:**
28
+ **If SmartStack detected, run comprehensive code review via MCP:**
29
29
 
30
- 1. **Validate conventions** (BLOCKING issues):
31
- ```
32
- mcp__smartstack__validate_conventions
33
- checks: ["all"]
34
- ```
35
-
36
- 2. **Validate security** (when available):
37
- ```
38
- mcp__smartstack__validate_security
39
- checks: ["all"]
40
- ```
41
-
42
- 3. **Analyze code quality** (when available):
43
- ```
44
- mcp__smartstack__analyze_code_quality
45
- metrics: ["all"]
46
- ```
30
+ **Primary tool - `review_code`** (NEW - unified review):
31
+ ```
32
+ mcp__smartstack__review_code
33
+ scope: "changed" # or "all" or "staged"
34
+ checks: ["all"] # 9 categories covered
35
+ severity: "all" # blocking, critical, warning, info
36
+ ```
47
37
 
48
- 4. **Validate test conventions**:
49
- ```
50
- mcp__smartstack__validate_test_conventions
51
- checks: ["all"]
52
- ```
38
+ **This single tool covers ALL categories:**
39
+ - Security (OWASP, secrets, SQL injection, XSS)
40
+ - Architecture (layer violations, DI bypass)
41
+ - Hardcoded values (magic numbers, URLs, feature flags)
42
+ - Tests (missing tests, test quality)
43
+ - AI Hallucinations (non-existent imports, phantom methods)
44
+ - Performance (N+1 queries, over-fetching)
45
+ - Dead Code (unused imports, functions)
46
+ - i18n (non-translated UI text)
47
+ - Accessibility (missing alt, ARIA issues)
48
+
49
+ **Optional: Additional convention checks:**
50
+ ```
51
+ mcp__smartstack__validate_conventions
52
+ checks: ["all"]
53
+ ```
53
54
  </mcp_validation>
54
55
 
55
56
  <mcp_checks>
56
- **SmartStack-specific checks via MCP:**
57
-
58
- | Category | MCP Tool | What it validates |
59
- |----------|----------|-------------------|
60
- | **Tables** | `validate_conventions` | Préfixes (auth_, nav_, cfg_), schemas (core/extensions) |
61
- | **Migrations** | `validate_conventions` | Nommage `{context}_v{version}_{sequence}_{Description}` |
62
- | **Services** | `validate_conventions` | Interfaces I*Service |
63
- | **Entities** | `validate_conventions` | ITenantEntity, factory methods, private constructors |
64
- | **Controllers** | `validate_conventions` | [NavRoute] attributes, route format |
65
- | **Multi-tenant** | `validate_conventions` | TenantId isolation, no cross-tenant access |
66
- | **Tests** | `validate_test_conventions` | Naming, structure, patterns AAA |
57
+ **SmartStack code review categories via MCP `review_code`:**
58
+
59
+ | Category | Check ID | What it detects |
60
+ |----------|----------|-----------------|
61
+ | **Security** | SEC-xxx | Hardcoded secrets, SQL injection, XSS, missing [Authorize] |
62
+ | **Architecture** | ARCH-xxx | Layer violations (Domain→Infrastructure), DI bypass |
63
+ | **Hardcoded** | HARD-xxx | Magic numbers, hardcoded URLs, feature flags |
64
+ | **Tests** | TEST-xxx | Missing tests, useless assertions, no coverage |
65
+ | **AI Hallucinations** | AI-xxx | Non-existent imports, phantom methods, placeholders |
66
+ | **Performance** | PERF-xxx | N+1 queries, ToList before Where, over-fetching |
67
+ | **Dead Code** | DEAD-xxx | Unused imports, functions, commented code, TODOs |
68
+ | **i18n** | I18N-xxx | Hardcoded UI text, missing translations |
69
+ | **Accessibility** | A11Y-xxx | Missing alt, no aria-label, focus issues |
70
+
71
+ **Severity levels:**
72
+ - `blocking` → Must fix before merge (security, hallucinations)
73
+ - `critical` → Should fix ASAP (architecture, tests)
74
+ - `warning` → Recommended fix (performance, dead code)
75
+ - `info` → Nice to have (i18n, a11y)
67
76
  </mcp_checks>
68
77
 
69
78
  <output_integration>
70
- **Merge MCP results into review output:**
79
+ **Merge MCP `review_code` results into review output:**
71
80
 
72
- ```markdown
73
- ## SmartStack Conventions (via MCP)
81
+ The MCP tool returns a structured report. Display it as-is or integrate key findings:
74
82
 
75
- | Severity | Issue | Location | Fix |
76
- |----------|-------|----------|-----|
77
- | BLOCKING | {MCP error} | `file:line` | {MCP suggestion} |
78
- | WARNING | {MCP warning} | `file:line` | {MCP suggestion} |
83
+ ```markdown
84
+ ## Code Review Results (via MCP)
85
+
86
+ ### Summary
87
+ | Metric | Value |
88
+ |--------|-------|
89
+ | Status | {PASSED/FAILED/WARNING} |
90
+ | Score | {score}/100 |
91
+ | Grade | {A/B/C/D/F} |
92
+
93
+ ### Blocking Issues ({count})
94
+ | ID | Issue | File:Line | Fix |
95
+ |----|-------|-----------|-----|
96
+ | SEC-001 | {title} | `{file}:{line}` | {suggestion} |
97
+
98
+ ### Critical Issues ({count})
99
+ | ID | Issue | File:Line | Fix |
100
+ |----|-------|-----------|-----|
101
+ | ARCH-001 | {title} | `{file}:{line}` | {suggestion} |
102
+
103
+ ### Warnings ({count})
104
+ (List or summarize)
79
105
  ```
80
106
 
81
- **Priority mapping:**
82
- - MCP errors → `[BLOCKING]`
83
- - MCP warnings → `[SUGGESTION]`
107
+ **Priority mapping from MCP:**
108
+ - `blocking` → `[BLOCKING]` - Must fix before merge
109
+ - `critical` → `[CRITICAL]` - Should fix ASAP
110
+ - `warning` → `[SUGGESTION]` - Recommended
111
+ - `info` → `[NIT]` - Nice to have
84
112
  </output_integration>
85
113
  </smartstack_integration>
86
114
 
@@ -7,13 +7,39 @@ SmartStack-specific conventions and patterns. This reference is used when review
7
7
  <mcp_tools>
8
8
  ## MCP SmartStack Tools for Code Review
9
9
 
10
+ ### Primary Tool - Unified Code Review
11
+
12
+ | Tool | Purpose | When to use |
13
+ |------|---------|-------------|
14
+ | `mcp__smartstack__review_code` | **Unified code review** covering 9 categories | Always use first |
15
+
16
+ **Parameters:**
17
+ ```
18
+ scope: "all" | "changed" | "staged" # Which files to review
19
+ checks: ["all"] | ["security", ...] # Categories to check
20
+ severity: "all" | "blocking" # Filter by severity
21
+ ```
22
+
23
+ **Categories covered:**
24
+ | Category | ID Prefix | Severity | What it detects |
25
+ |----------|-----------|----------|-----------------|
26
+ | Security | SEC-xxx | blocking | Secrets, SQL injection, XSS, missing [Authorize] |
27
+ | Architecture | ARCH-xxx | critical | Layer violations, DI bypass |
28
+ | Hardcoded Values | HARD-xxx | warning | Magic numbers, URLs, feature flags |
29
+ | Tests | TEST-xxx | critical | Missing tests, useless assertions |
30
+ | AI Hallucinations | AI-xxx | blocking | Phantom imports, non-existent methods |
31
+ | Performance | PERF-xxx | warning | N+1 queries, over-fetching |
32
+ | Dead Code | DEAD-xxx | warning | Unused imports, commented code, TODOs |
33
+ | i18n | I18N-xxx | info | Hardcoded UI text, missing translations |
34
+ | Accessibility | A11Y-xxx | info | Missing alt, ARIA, focus issues |
35
+
36
+ ### Additional Tools (Optional)
37
+
10
38
  | Tool | Purpose | When to use |
11
39
  |------|---------|-------------|
12
- | `mcp__smartstack__validate_conventions` | Validate all SmartStack conventions | Always run first |
13
- | `mcp__smartstack__validate_test_conventions` | Validate test patterns | When tests are in scope |
14
- | `mcp__smartstack__validate_security` | Security-specific checks | Security-focused reviews |
15
- | `mcp__smartstack__analyze_code_quality` | Code metrics analysis | Quality-focused reviews |
16
- | `mcp__smartstack__check_migrations` | EF Core migration conflicts | When migrations are modified |
40
+ | `mcp__smartstack__validate_conventions` | Detailed conventions validation | Deep convention checks |
41
+ | `mcp__smartstack__validate_test_conventions` | Test patterns validation | Test structure review |
42
+ | `mcp__smartstack__check_migrations` | EF Core migration conflicts | Migration changes |
17
43
  </mcp_tools>
18
44
 
19
45
  <architecture>
@@ -262,37 +288,71 @@ Tests/
262
288
  <review_checklist>
263
289
  ## SmartStack Code Review Checklist
264
290
 
265
- **Run MCP validation first:**
291
+ **Run unified code review first:**
266
292
  ```
267
- mcp__smartstack__validate_conventions checks: ["all"]
293
+ mcp__smartstack__review_code
294
+ scope: "changed" # or "all" or "staged"
295
+ checks: ["all"] # 9 categories
296
+ severity: "all"
268
297
  ```
269
298
 
270
- **Then verify manually:**
271
-
272
- <security_checks>
273
- ### Security (BLOCKING)
274
- - [ ] No hardcoded credentials or secrets
275
- - [ ] TenantId isolation enforced
276
- - [ ] Authorization on all endpoints
277
- - [ ] Input validation present
278
- - [ ] No SQL injection risks (use EF Core properly)
279
- </security_checks>
280
-
281
- <architecture_checks>
282
- ### Architecture (BLOCKING)
283
- - [ ] Entities use correct base class (BaseEntity/SystemEntity)
284
- - [ ] Services have interfaces
285
- - [ ] Controllers use [NavRoute]
286
- - [ ] Migrations follow naming convention
287
- </architecture_checks>
288
-
289
- <quality_checks>
290
- ### Quality (SUGGESTION)
291
- - [ ] Tests exist for new functionality
292
- - [ ] Factory methods used for entity creation
293
- - [ ] DTOs used for API boundaries
294
- - [ ] Async methods have CancellationToken
295
- </quality_checks>
299
+ **The tool automatically checks:**
300
+
301
+ <blocking_checks>
302
+ ### Blocking Issues (Must fix before merge)
303
+ **Security (SEC-xxx):**
304
+ - Hardcoded credentials or secrets
305
+ - SQL injection patterns
306
+ - XSS vulnerabilities
307
+ - Missing [Authorize] attributes
308
+
309
+ **AI Hallucinations (AI-xxx):**
310
+ - Non-existent imports/namespaces
311
+ - Phantom method calls
312
+ - Undefined types
313
+ </blocking_checks>
314
+
315
+ <critical_checks>
316
+ ### Critical Issues (Should fix ASAP)
317
+ **Architecture (ARCH-xxx):**
318
+ - Layer violations (Web → Infrastructure)
319
+ - Direct DbContext usage in controllers
320
+ - Service instantiation instead of DI
321
+
322
+ **Tests (TEST-xxx):**
323
+ - Missing tests for new entities/services
324
+ - Tests without real assertions
325
+ </critical_checks>
326
+
327
+ <warning_checks>
328
+ ### Warnings (Recommended fixes)
329
+ **Hardcoded Values (HARD-xxx):**
330
+ - Magic numbers
331
+ - Hardcoded URLs
332
+ - Feature flags in code
333
+
334
+ **Performance (PERF-xxx):**
335
+ - N+1 queries
336
+ - ToList() before Where()
337
+ - Multiple API calls per page
338
+
339
+ **Dead Code (DEAD-xxx):**
340
+ - Unused imports
341
+ - Commented code
342
+ - Old TODOs
343
+ </warning_checks>
344
+
345
+ <info_checks>
346
+ ### Info (Nice to have)
347
+ **i18n (I18N-xxx):**
348
+ - Hardcoded UI text
349
+ - Missing translations
350
+
351
+ **Accessibility (A11Y-xxx):**
352
+ - Missing alt attributes
353
+ - Missing ARIA labels
354
+ - Non-interactive click handlers
355
+ </info_checks>
296
356
  </review_checklist>
297
357
 
298
358
  <sources>