specialist-agent 1.6.0 → 1.7.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/.claude-plugin/marketplace.json +77 -0
- package/.claude-plugin/plugin.json +43 -0
- package/.codex/INSTALL.md +113 -0
- package/.cursor-plugin/marketplace.json +9 -0
- package/.cursor-plugin/plugin.json +35 -0
- package/.opencode/INSTALL.md +123 -0
- package/README.md +204 -263
- package/agents/analyst-lite.md +48 -0
- package/agents/analyst.md +391 -0
- package/agents/api-lite.md +43 -0
- package/agents/api.md +145 -0
- package/agents/cloud-lite.md +1 -1
- package/agents/cloud.md +1 -1
- package/agents/data-lite.md +1 -1
- package/agents/data.md +1 -1
- package/agents/debugger-lite.md +46 -0
- package/agents/debugger.md +406 -0
- package/agents/deps-lite.md +41 -0
- package/agents/deps.md +206 -0
- package/agents/designer-lite.md +1 -1
- package/agents/designer.md +1 -1
- package/agents/devops-lite.md +1 -1
- package/agents/devops.md +1 -1
- package/agents/docs-lite.md +42 -0
- package/agents/docs.md +197 -0
- package/agents/executor-lite.md +61 -0
- package/agents/executor.md +456 -0
- package/agents/explorer-lite.md +1 -1
- package/agents/explorer.md +1 -1
- package/agents/finance-lite.md +1 -1
- package/agents/finance.md +1 -1
- package/agents/i18n-lite.md +44 -0
- package/agents/i18n.md +198 -0
- package/agents/legal-lite.md +1 -1
- package/agents/legal.md +1 -1
- package/agents/memory.md +240 -0
- package/agents/orchestrator-lite.md +40 -0
- package/agents/orchestrator.md +387 -0
- package/agents/pair-lite.md +38 -0
- package/agents/pair.md +308 -0
- package/agents/perf-lite.md +42 -0
- package/agents/perf.md +141 -0
- package/agents/planner-lite.md +59 -0
- package/agents/planner.md +265 -0
- package/agents/refactor-lite.md +42 -0
- package/agents/refactor.md +178 -0
- package/agents/scout-lite.md +37 -0
- package/agents/scout.md +222 -0
- package/agents/security-lite.md +1 -1
- package/agents/security.md +1 -1
- package/agents/starter-lite.md +1 -1
- package/agents/starter.md +1 -1
- package/agents/tdd-lite.md +43 -0
- package/agents/tdd.md +317 -0
- package/agents/tester-lite.md +1 -1
- package/agents/tester.md +1 -1
- package/cli/index.mjs +636 -15
- package/hooks/after-review.mjs +130 -0
- package/hooks/after-task.mjs +117 -0
- package/hooks/before-plan.mjs +155 -0
- package/hooks/before-review.mjs +139 -0
- package/hooks/hooks.json +81 -0
- package/hooks/native/auto-dispatch.mjs +197 -0
- package/hooks/native/auto-format.mjs +193 -0
- package/hooks/native/security-config.json +31 -0
- package/hooks/native/security-guard.mjs +267 -0
- package/hooks/native/session-context.mjs +136 -0
- package/hooks/native/settings-template.json +50 -0
- package/hooks/native/utils.mjs +62 -0
- package/hooks/on-error.mjs +129 -0
- package/hooks/session-end.mjs +185 -0
- package/hooks/session-start.mjs +154 -0
- package/package.json +16 -3
- package/packs/nextjs/agents/builder.md +24 -1
- package/packs/nextjs/agents/doctor.md +70 -4
- package/packs/nextjs/agents/migrator.md +24 -1
- package/packs/nextjs/agents/reviewer.md +93 -3
- package/packs/nextjs/agents-lite/builder.md +1 -1
- package/packs/nextjs/agents-lite/doctor.md +1 -1
- package/packs/nextjs/agents-lite/migrator.md +1 -1
- package/packs/nextjs/agents-lite/reviewer.md +1 -1
- package/packs/nextjs/skills/dev-create-component/SKILL.md +1 -1
- package/packs/nextjs/skills/dev-create-hook/SKILL.md +1 -1
- package/packs/nextjs/skills/dev-create-module/SKILL.md +1 -1
- package/packs/nextjs/skills/dev-create-service/SKILL.md +1 -1
- package/packs/nextjs/skills/dev-create-test/SKILL.md +1 -1
- package/packs/nextjs/skills/dev-generate-types/SKILL.md +1 -1
- package/packs/nextjs/skills/docs-onboard/SKILL.md +1 -1
- package/packs/nextjs/skills/migration-migrate-component/SKILL.md +1 -1
- package/packs/nextjs/skills/migration-migrate-module/SKILL.md +1 -1
- package/packs/nextjs/skills/review-check-architecture/SKILL.md +1 -1
- package/packs/nextjs/skills/review-fix-violations/SKILL.md +1 -1
- package/packs/nextjs/skills/review-review/SKILL.md +1 -1
- package/packs/react/agents/builder.md +24 -1
- package/packs/react/agents/doctor.md +107 -13
- package/packs/react/agents/migrator.md +24 -1
- package/packs/react/agents/reviewer.md +113 -9
- package/packs/react/agents-lite/builder.md +1 -1
- package/packs/react/agents-lite/doctor.md +1 -1
- package/packs/react/agents-lite/migrator.md +1 -1
- package/packs/react/agents-lite/reviewer.md +1 -1
- package/packs/react/skills/dev-create-component/SKILL.md +1 -1
- package/packs/react/skills/dev-create-hook/SKILL.md +1 -1
- package/packs/react/skills/dev-create-module/SKILL.md +1 -1
- package/packs/react/skills/dev-create-service/SKILL.md +1 -1
- package/packs/react/skills/dev-create-test/SKILL.md +1 -1
- package/packs/react/skills/dev-generate-types/SKILL.md +1 -1
- package/packs/react/skills/docs-onboard/SKILL.md +1 -1
- package/packs/react/skills/migration-migrate-component/SKILL.md +1 -1
- package/packs/react/skills/migration-migrate-module/SKILL.md +1 -1
- package/packs/react/skills/review-check-architecture/SKILL.md +1 -1
- package/packs/react/skills/review-fix-violations/SKILL.md +1 -1
- package/packs/react/skills/review-review/SKILL.md +1 -1
- package/packs/svelte/agents/builder.md +24 -1
- package/packs/svelte/agents/doctor.md +70 -4
- package/packs/svelte/agents/migrator.md +24 -1
- package/packs/svelte/agents/reviewer.md +93 -3
- package/packs/svelte/agents-lite/builder.md +1 -1
- package/packs/svelte/agents-lite/doctor.md +1 -1
- package/packs/svelte/agents-lite/migrator.md +1 -1
- package/packs/svelte/agents-lite/reviewer.md +1 -1
- package/packs/svelte/skills/dev-create-component/SKILL.md +1 -1
- package/packs/svelte/skills/dev-create-module/SKILL.md +1 -1
- package/packs/svelte/skills/dev-create-service/SKILL.md +1 -1
- package/packs/svelte/skills/dev-create-store/SKILL.md +1 -1
- package/packs/svelte/skills/dev-create-test/SKILL.md +1 -1
- package/packs/svelte/skills/dev-generate-types/SKILL.md +1 -1
- package/packs/svelte/skills/docs-onboard/SKILL.md +1 -1
- package/packs/svelte/skills/migration-migrate-component/SKILL.md +1 -1
- package/packs/svelte/skills/migration-migrate-module/SKILL.md +1 -1
- package/packs/svelte/skills/review-check-architecture/SKILL.md +1 -1
- package/packs/svelte/skills/review-fix-violations/SKILL.md +1 -1
- package/packs/svelte/skills/review-review/SKILL.md +1 -1
- package/packs/vue/agents/builder.md +24 -1
- package/packs/vue/agents/doctor.md +107 -13
- package/packs/vue/agents/migrator.md +24 -1
- package/packs/vue/agents/reviewer.md +113 -9
- package/packs/vue/agents-lite/builder.md +1 -1
- package/packs/vue/agents-lite/doctor.md +1 -1
- package/packs/vue/agents-lite/migrator.md +1 -1
- package/packs/vue/agents-lite/reviewer.md +1 -1
- package/packs/vue/skills/dev-create-component/SKILL.md +1 -1
- package/packs/vue/skills/dev-create-composable/SKILL.md +1 -1
- package/packs/vue/skills/dev-create-module/SKILL.md +1 -1
- package/packs/vue/skills/dev-create-service/SKILL.md +1 -1
- package/packs/vue/skills/dev-create-test/SKILL.md +1 -1
- package/packs/vue/skills/dev-generate-types/SKILL.md +1 -1
- package/packs/vue/skills/docs-onboard/SKILL.md +1 -1
- package/packs/vue/skills/migration-migrate-component/SKILL.md +1 -1
- package/packs/vue/skills/migration-migrate-module/SKILL.md +1 -1
- package/packs/vue/skills/review-check-architecture/SKILL.md +1 -1
- package/packs/vue/skills/review-fix-violations/SKILL.md +1 -1
- package/packs/vue/skills/review-review/SKILL.md +1 -1
- package/skills/audit/SKILL.md +169 -0
- package/skills/brainstorm/SKILL.md +245 -0
- package/skills/checkpoint/SKILL.md +209 -0
- package/skills/debug/SKILL.md +210 -0
- package/skills/estimate/SKILL.md +145 -0
- package/skills/finish/SKILL.md +211 -0
- package/skills/health/SKILL.md +242 -0
- package/skills/learn/SKILL.md +260 -0
- package/skills/migrate-framework/SKILL.md +172 -0
- package/skills/onboard/SKILL.md +168 -0
- package/skills/plan/SKILL.md +132 -0
- package/skills/recall/SKILL.md +150 -0
- package/skills/remember/SKILL.md +158 -0
- package/skills/tdd/SKILL.md +156 -0
- package/skills/tutorial/SKILL.md +346 -0
- package/skills/verify/SKILL.md +168 -0
- package/skills/worktree/SKILL.md +168 -0
- package/skills/write-skill/SKILL.md +213 -0
- package/templates/industry/ecommerce.md +127 -0
- package/templates/industry/fintech.md +161 -0
- package/templates/industry/saas.md +134 -0
- package/templates/session-memory.json +48 -0
- package/templates/skill-template/SKILL.md +90 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: health
|
|
3
|
+
description: "Use when assessing overall project quality, onboarding onto a new codebase, or before major refactoring to establish a baseline."
|
|
4
|
+
user-invocable: true
|
|
5
|
+
argument-hint: "[module or 'full']"
|
|
6
|
+
allowed-tools: Read, Bash, Glob, Grep
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /health — Project Health Score
|
|
10
|
+
|
|
11
|
+
Generate a comprehensive health score for your project or a specific module.
|
|
12
|
+
|
|
13
|
+
**Scope:** $ARGUMENTS (default: full project)
|
|
14
|
+
|
|
15
|
+
## Scoring Categories
|
|
16
|
+
|
|
17
|
+
| Category | Weight | What it measures |
|
|
18
|
+
|----------|--------|------------------|
|
|
19
|
+
| Architecture | 25% | ARCHITECTURE.md conformance |
|
|
20
|
+
| Tests | 20% | Coverage, test presence |
|
|
21
|
+
| Security | 20% | OWASP compliance, secrets |
|
|
22
|
+
| Performance | 15% | Bundle size, caching |
|
|
23
|
+
| Maintainability | 20% | Code complexity, docs |
|
|
24
|
+
|
|
25
|
+
## Workflow
|
|
26
|
+
|
|
27
|
+
### Step 1: Gather Metrics
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# File counts
|
|
31
|
+
find src -name "*.ts" -o -name "*.tsx" | wc -l
|
|
32
|
+
find src -name "*.test.ts" -o -name "*.spec.ts" | wc -l
|
|
33
|
+
|
|
34
|
+
# TypeScript check
|
|
35
|
+
npx tsc --noEmit 2>&1 | grep -c "error"
|
|
36
|
+
|
|
37
|
+
# Test coverage (if available)
|
|
38
|
+
npm test -- --coverage --json 2>/dev/null
|
|
39
|
+
|
|
40
|
+
# Bundle analysis
|
|
41
|
+
npm run build 2>&1 | grep -E "size|chunk"
|
|
42
|
+
|
|
43
|
+
# Security checks
|
|
44
|
+
grep -rn "dangerouslySetInnerHTML\|v-html\|eval(" src/ 2>/dev/null | wc -l
|
|
45
|
+
grep -rn "password\|secret\|token" src/ --include="*.ts" 2>/dev/null | wc -l
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Step 2: Calculate Scores
|
|
49
|
+
|
|
50
|
+
#### Architecture Score (25 points)
|
|
51
|
+
```
|
|
52
|
+
+5 ARCHITECTURE.md exists
|
|
53
|
+
+5 Module structure follows patterns
|
|
54
|
+
+5 No cross-module imports
|
|
55
|
+
+5 Correct layer usage (service→adapter→hook→component)
|
|
56
|
+
+5 Naming conventions followed
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### Test Score (20 points)
|
|
60
|
+
```
|
|
61
|
+
+5 Test files exist
|
|
62
|
+
+5 Coverage > 50%
|
|
63
|
+
+5 Coverage > 70%
|
|
64
|
+
+5 Coverage > 80%
|
|
65
|
+
+5 All tests passing
|
|
66
|
+
-2 Each failing test
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
#### Security Score (20 points)
|
|
70
|
+
```
|
|
71
|
+
+5 No hardcoded secrets
|
|
72
|
+
+5 No dangerous HTML methods
|
|
73
|
+
+5 Input validation present
|
|
74
|
+
+5 Auth implementation exists
|
|
75
|
+
+5 Secure headers configured
|
|
76
|
+
-5 Each critical vulnerability
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### Performance Score (15 points)
|
|
80
|
+
```
|
|
81
|
+
+5 Lazy loading implemented
|
|
82
|
+
+5 Query caching present (staleTime)
|
|
83
|
+
+5 Bundle < 500KB
|
|
84
|
+
+5 No N+1 queries detected
|
|
85
|
+
-3 Each performance warning
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### Maintainability Score (20 points)
|
|
89
|
+
```
|
|
90
|
+
+5 README.md exists
|
|
91
|
+
+5 Files < 200 lines (average)
|
|
92
|
+
+5 Low cyclomatic complexity
|
|
93
|
+
+5 TypeScript strict mode
|
|
94
|
+
+5 No 'any' types
|
|
95
|
+
-2 Each 'any' type found
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Step 3: Generate Report
|
|
99
|
+
|
|
100
|
+
## Output Format
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
═══════════════════════════════════════════════════════════════
|
|
104
|
+
PROJECT HEALTH REPORT
|
|
105
|
+
═══════════════════════════════════════════════════════════════
|
|
106
|
+
|
|
107
|
+
██████████████████████████████████████░░░░░░░░ 78/100
|
|
108
|
+
|
|
109
|
+
═══════════════════════════════════════════════════════════════
|
|
110
|
+
|
|
111
|
+
CATEGORY BREAKDOWN
|
|
112
|
+
───────────────────────────────────────────────────────────────
|
|
113
|
+
|
|
114
|
+
Architecture ████████████████████░░░░░ 20/25
|
|
115
|
+
✓ ARCHITECTURE.md exists
|
|
116
|
+
✓ Module structure correct
|
|
117
|
+
✗ Cross-module imports found (3 violations)
|
|
118
|
+
✓ Layer usage correct
|
|
119
|
+
✓ Naming conventions followed
|
|
120
|
+
|
|
121
|
+
Tests ████████████████░░░░░░░░░ 16/20
|
|
122
|
+
✓ Test files exist (42 specs)
|
|
123
|
+
✓ Coverage: 72%
|
|
124
|
+
✗ Coverage < 80% target
|
|
125
|
+
✓ All tests passing
|
|
126
|
+
|
|
127
|
+
Security █████████████████████████ 20/20
|
|
128
|
+
✓ No hardcoded secrets
|
|
129
|
+
✓ No dangerous HTML methods
|
|
130
|
+
✓ Input validation present
|
|
131
|
+
✓ Auth implementation exists
|
|
132
|
+
✓ Secure headers configured
|
|
133
|
+
|
|
134
|
+
Performance █████████████░░░░░░░░░░░░ 10/15
|
|
135
|
+
✓ Lazy loading implemented
|
|
136
|
+
✗ Missing staleTime in 5 queries
|
|
137
|
+
✓ Bundle: 320KB
|
|
138
|
+
✗ Potential N+1 in user.service.ts
|
|
139
|
+
|
|
140
|
+
Maintainability ████████████░░░░░░░░░░░░░ 12/20
|
|
141
|
+
✓ README.md exists
|
|
142
|
+
✗ 3 files > 200 lines
|
|
143
|
+
✓ Low complexity
|
|
144
|
+
✓ TypeScript strict mode
|
|
145
|
+
✗ 12 'any' types found
|
|
146
|
+
|
|
147
|
+
═══════════════════════════════════════════════════════════════
|
|
148
|
+
|
|
149
|
+
TOP ISSUES TO FIX (by impact)
|
|
150
|
+
───────────────────────────────────────────────────────────────
|
|
151
|
+
|
|
152
|
+
1. 🔴 [Architecture] Cross-module imports
|
|
153
|
+
Files: src/modules/orders/components/UserCard.tsx
|
|
154
|
+
Fix: Move shared components to src/shared/
|
|
155
|
+
|
|
156
|
+
2. 🟡 [Performance] Missing staleTime in queries
|
|
157
|
+
Files: src/modules/*/hooks/use*.ts (5 files)
|
|
158
|
+
Fix: Add staleTime to all useQuery calls
|
|
159
|
+
|
|
160
|
+
3. 🟡 [Maintainability] Files exceeding 200 lines
|
|
161
|
+
Files: src/modules/auth/components/LoginForm.tsx (284 lines)
|
|
162
|
+
Fix: Split into smaller components
|
|
163
|
+
|
|
164
|
+
4. 🟡 [Tests] Coverage below 80%
|
|
165
|
+
Current: 72%
|
|
166
|
+
Fix: Add tests for uncovered modules
|
|
167
|
+
|
|
168
|
+
═══════════════════════════════════════════════════════════════
|
|
169
|
+
|
|
170
|
+
TREND (if previous scans exist)
|
|
171
|
+
───────────────────────────────────────────────────────────────
|
|
172
|
+
|
|
173
|
+
Previous: 71/100 (2024-01-10)
|
|
174
|
+
Current: 78/100 (2024-01-20)
|
|
175
|
+
Change: +7 points ↑
|
|
176
|
+
|
|
177
|
+
═══════════════════════════════════════════════════════════════
|
|
178
|
+
|
|
179
|
+
RECOMMENDATIONS
|
|
180
|
+
───────────────────────────────────────────────────────────────
|
|
181
|
+
|
|
182
|
+
@reviewer — Run /review-fix-violations to auto-fix
|
|
183
|
+
@tester — Add tests for auth module
|
|
184
|
+
@builder — Refactor LoginForm.tsx
|
|
185
|
+
|
|
186
|
+
═══════════════════════════════════════════════════════════════
|
|
187
|
+
Generated: 2024-01-20 14:30 | Scan time: 12s
|
|
188
|
+
═══════════════════════════════════════════════════════════════
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Score Interpretation
|
|
192
|
+
|
|
193
|
+
| Score | Grade | Status |
|
|
194
|
+
|-------|-------|--------|
|
|
195
|
+
| 90-100 | A | Excellent |
|
|
196
|
+
| 80-89 | B | Good |
|
|
197
|
+
| 70-79 | C | Acceptable |
|
|
198
|
+
| 60-69 | D | Needs Work |
|
|
199
|
+
| 0-59 | F | Critical |
|
|
200
|
+
|
|
201
|
+
## Save History
|
|
202
|
+
|
|
203
|
+
Save scan to `.claude/health-history.json`:
|
|
204
|
+
|
|
205
|
+
```json
|
|
206
|
+
{
|
|
207
|
+
"scans": [
|
|
208
|
+
{
|
|
209
|
+
"date": "2024-01-20T14:30:00Z",
|
|
210
|
+
"score": 78,
|
|
211
|
+
"categories": {
|
|
212
|
+
"architecture": 20,
|
|
213
|
+
"tests": 16,
|
|
214
|
+
"security": 20,
|
|
215
|
+
"performance": 10,
|
|
216
|
+
"maintainability": 12
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
]
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Quick Mode
|
|
224
|
+
|
|
225
|
+
For fast feedback (< 5 seconds):
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
/health quick
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Only checks:
|
|
232
|
+
- TypeScript errors
|
|
233
|
+
- Test status
|
|
234
|
+
- File count
|
|
235
|
+
|
|
236
|
+
## Rules
|
|
237
|
+
|
|
238
|
+
1. **Be objective** — Numbers, not opinions
|
|
239
|
+
2. **Prioritize issues** — Most impactful first
|
|
240
|
+
3. **Show trends** — Compare to previous scans
|
|
241
|
+
4. **Actionable** — Suggest specific fixes
|
|
242
|
+
5. **Save history** — Track progress over time
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: learn
|
|
3
|
+
description: "Use when implementing a feature and want to understand the code as it's built — during onboarding, teaching, or learning a new pattern."
|
|
4
|
+
user-invocable: true
|
|
5
|
+
argument-hint: "[feature to implement and learn]"
|
|
6
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /learn — Learning Mode Implementation
|
|
10
|
+
|
|
11
|
+
Implement features while explaining concepts, patterns, and decisions along the way.
|
|
12
|
+
|
|
13
|
+
**Target:** $ARGUMENTS
|
|
14
|
+
|
|
15
|
+
## What Makes This Different
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
Normal Implementation:
|
|
19
|
+
"Here's the code" → Done
|
|
20
|
+
|
|
21
|
+
Learning Mode:
|
|
22
|
+
"Here's WHY we do this" → "Here's HOW it works" → "Here's the code" → Done
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Workflow
|
|
26
|
+
|
|
27
|
+
### Step 1: Context Setting
|
|
28
|
+
|
|
29
|
+
Before writing any code, explain:
|
|
30
|
+
|
|
31
|
+
```markdown
|
|
32
|
+
## What We're Building
|
|
33
|
+
|
|
34
|
+
[Feature name] is a [type of thing] that [what it does].
|
|
35
|
+
|
|
36
|
+
**Why it matters:**
|
|
37
|
+
[Business/technical reason]
|
|
38
|
+
|
|
39
|
+
**Where it fits:**
|
|
40
|
+
[Location in architecture]
|
|
41
|
+
|
|
42
|
+
**Concepts you'll learn:**
|
|
43
|
+
- Concept 1
|
|
44
|
+
- Concept 2
|
|
45
|
+
- Concept 3
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Step 2: Architecture Explanation
|
|
49
|
+
|
|
50
|
+
```markdown
|
|
51
|
+
## Architecture Deep Dive
|
|
52
|
+
|
|
53
|
+
In this codebase, we follow [pattern name].
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
┌─────────────┐
|
|
57
|
+
│ Component │ ← UI layer, handles display
|
|
58
|
+
└─────┬───────┘
|
|
59
|
+
│ uses
|
|
60
|
+
┌─────▼───────┐
|
|
61
|
+
│ Hook │ ← Logic layer, manages state
|
|
62
|
+
└─────┬───────┘
|
|
63
|
+
│ calls
|
|
64
|
+
┌─────▼───────┐
|
|
65
|
+
│ Service │ ← Data layer, API calls
|
|
66
|
+
└─────────────┘
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Why this pattern?**
|
|
70
|
+
[Explanation of benefits]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Step 3: Incremental Implementation with Teaching
|
|
74
|
+
|
|
75
|
+
For each piece of code:
|
|
76
|
+
|
|
77
|
+
```markdown
|
|
78
|
+
## Step N: [What we're doing]
|
|
79
|
+
|
|
80
|
+
**The concept:**
|
|
81
|
+
[Explain the pattern/concept being used]
|
|
82
|
+
|
|
83
|
+
**Why this approach:**
|
|
84
|
+
[Explain the decision]
|
|
85
|
+
|
|
86
|
+
**The code:**
|
|
87
|
+
```typescript
|
|
88
|
+
// This creates a [thing] that [does what]
|
|
89
|
+
// We use [pattern] because [reason]
|
|
90
|
+
export const myFunction = () => {
|
|
91
|
+
// First, we [action] to [achieve goal]
|
|
92
|
+
const result = doSomething();
|
|
93
|
+
|
|
94
|
+
// Then we [action] because [reason]
|
|
95
|
+
return transform(result);
|
|
96
|
+
};
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**What just happened:**
|
|
100
|
+
1. We created [thing]
|
|
101
|
+
2. It does [action]
|
|
102
|
+
3. This enables [capability]
|
|
103
|
+
|
|
104
|
+
**Try it yourself:**
|
|
105
|
+
- What would happen if we [changed X]?
|
|
106
|
+
- How would you add [feature Y]?
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Step 4: Common Patterns
|
|
110
|
+
|
|
111
|
+
When using a pattern, explain it:
|
|
112
|
+
|
|
113
|
+
```markdown
|
|
114
|
+
## Pattern: [Pattern Name]
|
|
115
|
+
|
|
116
|
+
**What it is:**
|
|
117
|
+
[One sentence explanation]
|
|
118
|
+
|
|
119
|
+
**When to use it:**
|
|
120
|
+
- Situation 1
|
|
121
|
+
- Situation 2
|
|
122
|
+
|
|
123
|
+
**Example in our code:**
|
|
124
|
+
```typescript
|
|
125
|
+
// Here's how we apply [pattern]
|
|
126
|
+
const example = ...;
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Alternatives considered:**
|
|
130
|
+
- [Alternative] — didn't use because [reason]
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Step 5: Gotchas and Best Practices
|
|
134
|
+
|
|
135
|
+
```markdown
|
|
136
|
+
## Watch Out For
|
|
137
|
+
|
|
138
|
+
**Common mistake #1:**
|
|
139
|
+
```typescript
|
|
140
|
+
// ❌ Don't do this
|
|
141
|
+
const bad = wrongApproach();
|
|
142
|
+
|
|
143
|
+
// ✓ Do this instead
|
|
144
|
+
const good = correctApproach();
|
|
145
|
+
```
|
|
146
|
+
Why: [Explanation]
|
|
147
|
+
|
|
148
|
+
**Common mistake #2:**
|
|
149
|
+
[...]
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Step 6: Summary and Next Steps
|
|
153
|
+
|
|
154
|
+
```markdown
|
|
155
|
+
## What You Learned
|
|
156
|
+
|
|
157
|
+
1. **[Concept 1]:** [Brief explanation]
|
|
158
|
+
2. **[Concept 2]:** [Brief explanation]
|
|
159
|
+
3. **[Concept 3]:** [Brief explanation]
|
|
160
|
+
|
|
161
|
+
## Practice Exercises
|
|
162
|
+
|
|
163
|
+
1. Try adding [feature] using the same pattern
|
|
164
|
+
2. What would you change if [scenario]?
|
|
165
|
+
3. How does this connect to [related concept]?
|
|
166
|
+
|
|
167
|
+
## Further Reading
|
|
168
|
+
|
|
169
|
+
- [Link or reference 1]
|
|
170
|
+
- [Link or reference 2]
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Teaching Style Guidelines
|
|
174
|
+
|
|
175
|
+
### Do:
|
|
176
|
+
- Explain WHY before HOW
|
|
177
|
+
- Use analogies for complex concepts
|
|
178
|
+
- Show wrong approaches and why they're wrong
|
|
179
|
+
- Build complexity incrementally
|
|
180
|
+
- Ask thought-provoking questions
|
|
181
|
+
- Connect to broader patterns
|
|
182
|
+
|
|
183
|
+
### Don't:
|
|
184
|
+
- Dump code without explanation
|
|
185
|
+
- Assume prior knowledge
|
|
186
|
+
- Skip over "obvious" concepts
|
|
187
|
+
- Use jargon without defining it
|
|
188
|
+
- Rush through complex topics
|
|
189
|
+
|
|
190
|
+
## Output Format
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
──── /learn ────
|
|
194
|
+
Topic: [feature name]
|
|
195
|
+
|
|
196
|
+
## Concepts Covered
|
|
197
|
+
1. [Concept]
|
|
198
|
+
2. [Concept]
|
|
199
|
+
3. [Concept]
|
|
200
|
+
|
|
201
|
+
## Implementation
|
|
202
|
+
[Code with inline teaching]
|
|
203
|
+
|
|
204
|
+
## Key Takeaways
|
|
205
|
+
- [Takeaway 1]
|
|
206
|
+
- [Takeaway 2]
|
|
207
|
+
|
|
208
|
+
## Practice
|
|
209
|
+
- [Exercise 1]
|
|
210
|
+
- [Exercise 2]
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Example Session
|
|
214
|
+
|
|
215
|
+
```markdown
|
|
216
|
+
──── /learn ────
|
|
217
|
+
Topic: Creating a User Service
|
|
218
|
+
|
|
219
|
+
## What We're Building
|
|
220
|
+
|
|
221
|
+
A UserService that fetches user data from an API and handles
|
|
222
|
+
loading states, errors, and caching.
|
|
223
|
+
|
|
224
|
+
**Concepts you'll learn:**
|
|
225
|
+
- Service layer pattern
|
|
226
|
+
- TypeScript generics
|
|
227
|
+
- Error handling strategies
|
|
228
|
+
|
|
229
|
+
## Let's Start
|
|
230
|
+
|
|
231
|
+
### Step 1: The Types
|
|
232
|
+
|
|
233
|
+
Before any logic, we define our types. This is called
|
|
234
|
+
"types-first development" — we describe the shape of our
|
|
235
|
+
data before we write code that uses it.
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
// Why interface over type?
|
|
239
|
+
// Interfaces are better for object shapes because they:
|
|
240
|
+
// 1. Have better error messages
|
|
241
|
+
// 2. Can be extended
|
|
242
|
+
// 3. Are more familiar to OOP developers
|
|
243
|
+
|
|
244
|
+
interface User {
|
|
245
|
+
id: string;
|
|
246
|
+
name: string;
|
|
247
|
+
email: string;
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
[... continues with teaching ...]
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Rules
|
|
255
|
+
|
|
256
|
+
1. **Never skip the "why"** — Every piece needs justification
|
|
257
|
+
2. **Build incrementally** — Complex → Simple steps
|
|
258
|
+
3. **Use visuals** — Diagrams help understanding
|
|
259
|
+
4. **Ask questions** — Engage the learner
|
|
260
|
+
5. **Connect concepts** — Show the bigger picture
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: migrate-framework
|
|
3
|
+
description: "Use when switching a project or component between frameworks — React to Vue, Vue to Svelte, or any supported framework pair."
|
|
4
|
+
user-invocable: true
|
|
5
|
+
argument-hint: "[source-framework] to [target-framework] [file-or-directory]"
|
|
6
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /migrate-framework — Cross-Framework Migration
|
|
10
|
+
|
|
11
|
+
Migrate code from one framework to another while preserving functionality.
|
|
12
|
+
|
|
13
|
+
**Arguments:** $ARGUMENTS (e.g., "react to vue src/components/Button.tsx")
|
|
14
|
+
|
|
15
|
+
## Supported Migrations
|
|
16
|
+
|
|
17
|
+
| From | To | Status |
|
|
18
|
+
|------|----|--------|
|
|
19
|
+
| React | Vue 3 | Full |
|
|
20
|
+
| React | Svelte | Full |
|
|
21
|
+
| Vue 2 | Vue 3 | Full |
|
|
22
|
+
| Vue 3 | React | Full |
|
|
23
|
+
| Vue 3 | Svelte | Full |
|
|
24
|
+
| Angular | React | Partial |
|
|
25
|
+
| Angular | Vue 3 | Partial |
|
|
26
|
+
|
|
27
|
+
## Workflow
|
|
28
|
+
|
|
29
|
+
### Phase 1: Analysis
|
|
30
|
+
|
|
31
|
+
1. Parse source framework code
|
|
32
|
+
2. Identify:
|
|
33
|
+
- Component structure
|
|
34
|
+
- Props and state
|
|
35
|
+
- Lifecycle hooks
|
|
36
|
+
- Event handlers
|
|
37
|
+
- Computed values
|
|
38
|
+
- Side effects
|
|
39
|
+
|
|
40
|
+
### Phase 2: Mapping
|
|
41
|
+
|
|
42
|
+
#### React → Vue 3
|
|
43
|
+
|
|
44
|
+
| React | Vue 3 |
|
|
45
|
+
|-------|-------|
|
|
46
|
+
| `useState` | `ref()` / `reactive()` |
|
|
47
|
+
| `useEffect` | `onMounted`, `watch` |
|
|
48
|
+
| `useMemo` | `computed()` |
|
|
49
|
+
| `useCallback` | Regular function |
|
|
50
|
+
| `useContext` | `provide/inject` |
|
|
51
|
+
| `props` | `defineProps()` |
|
|
52
|
+
| `children` | `<slot />` |
|
|
53
|
+
| `className` | `class` |
|
|
54
|
+
| `onClick` | `@click` |
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
// React
|
|
58
|
+
function Button({ label, onClick }) {
|
|
59
|
+
const [count, setCount] = useState(0)
|
|
60
|
+
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
console.log('mounted')
|
|
63
|
+
}, [])
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<button className="btn" onClick={() => setCount(c => c + 1)}>
|
|
67
|
+
{label}: {count}
|
|
68
|
+
</button>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Vue 3
|
|
73
|
+
<script setup lang="ts">
|
|
74
|
+
import { ref, onMounted } from 'vue'
|
|
75
|
+
|
|
76
|
+
const props = defineProps<{ label: string }>()
|
|
77
|
+
const emit = defineEmits<{ click: [] }>()
|
|
78
|
+
|
|
79
|
+
const count = ref(0)
|
|
80
|
+
|
|
81
|
+
onMounted(() => {
|
|
82
|
+
console.log('mounted')
|
|
83
|
+
})
|
|
84
|
+
</script>
|
|
85
|
+
|
|
86
|
+
<template>
|
|
87
|
+
<button class="btn" @click="count++">
|
|
88
|
+
{{ label }}: {{ count }}
|
|
89
|
+
</button>
|
|
90
|
+
</template>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
#### Vue 3 → React
|
|
94
|
+
|
|
95
|
+
| Vue 3 | React |
|
|
96
|
+
|-------|-------|
|
|
97
|
+
| `ref()` | `useState` |
|
|
98
|
+
| `reactive()` | `useState` with object |
|
|
99
|
+
| `computed()` | `useMemo` |
|
|
100
|
+
| `watch` | `useEffect` |
|
|
101
|
+
| `onMounted` | `useEffect(fn, [])` |
|
|
102
|
+
| `provide/inject` | `useContext` |
|
|
103
|
+
| `<slot />` | `children` |
|
|
104
|
+
| `v-if` | `{condition && ...}` |
|
|
105
|
+
| `v-for` | `.map()` |
|
|
106
|
+
| `@click` | `onClick` |
|
|
107
|
+
|
|
108
|
+
#### React → Svelte
|
|
109
|
+
|
|
110
|
+
| React | Svelte |
|
|
111
|
+
|-------|--------|
|
|
112
|
+
| `useState` | `let variable` |
|
|
113
|
+
| `useEffect` | `onMount`, `$:` |
|
|
114
|
+
| `useMemo` | `$: derived` |
|
|
115
|
+
| `props` | `export let` |
|
|
116
|
+
| `children` | `<slot />` |
|
|
117
|
+
| `className` | `class` |
|
|
118
|
+
| `onClick` | `on:click` |
|
|
119
|
+
|
|
120
|
+
### Phase 3: Migration
|
|
121
|
+
|
|
122
|
+
1. Create target file structure
|
|
123
|
+
2. Convert component syntax
|
|
124
|
+
3. Migrate state management
|
|
125
|
+
4. Update imports
|
|
126
|
+
5. Convert templates/JSX
|
|
127
|
+
6. Adapt styling approach
|
|
128
|
+
|
|
129
|
+
### Phase 4: Validation
|
|
130
|
+
|
|
131
|
+
1. Check TypeScript types
|
|
132
|
+
2. Verify props match
|
|
133
|
+
3. Test component renders
|
|
134
|
+
4. Compare behavior
|
|
135
|
+
|
|
136
|
+
## Output
|
|
137
|
+
|
|
138
|
+
```text
|
|
139
|
+
──── Migration Complete ────
|
|
140
|
+
|
|
141
|
+
Source: React (src/components/Button.tsx)
|
|
142
|
+
Target: Vue 3 (src/components/Button.vue)
|
|
143
|
+
|
|
144
|
+
Conversions:
|
|
145
|
+
✓ useState → ref (2 instances)
|
|
146
|
+
✓ useEffect → onMounted (1 instance)
|
|
147
|
+
✓ Props interface → defineProps
|
|
148
|
+
✓ JSX → Vue template
|
|
149
|
+
✓ className → class
|
|
150
|
+
|
|
151
|
+
Manual review needed:
|
|
152
|
+
- Line 15: Complex useEffect dependency array
|
|
153
|
+
- Line 23: Custom hook needs separate migration
|
|
154
|
+
|
|
155
|
+
Files created:
|
|
156
|
+
- src/components/Button.vue
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Rules
|
|
160
|
+
|
|
161
|
+
1. **Preserve behavior** — Functionality must match
|
|
162
|
+
2. **Type safety** — Maintain TypeScript types
|
|
163
|
+
3. **Idiomatic code** — Use target framework patterns
|
|
164
|
+
4. **Flag manual work** — Mark complex conversions
|
|
165
|
+
5. **Keep original** — Don't delete source files
|
|
166
|
+
|
|
167
|
+
## Limitations
|
|
168
|
+
|
|
169
|
+
- Custom hooks require separate migration
|
|
170
|
+
- Third-party component libraries may not have equivalents
|
|
171
|
+
- Some patterns don't translate directly
|
|
172
|
+
- CSS-in-JS needs manual adaptation
|