specialist-agent 2.9.0 → 2.11.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 +5 -5
- package/.claude-plugin/plugin.json +2 -2
- package/.cursor-plugin/marketplace.json +1 -1
- package/.cursor-plugin/plugin.json +2 -2
- package/.opencode/INSTALL.md +74 -79
- package/.opencode/opencode.json +141 -0
- package/README.md +128 -250
- package/agents/analyst.md +1 -0
- package/agents/api.md +4 -4
- package/agents/architect-lite.md +2 -2
- package/agents/architect.md +29 -20
- package/agents/cloud-lite.md +1 -1
- package/agents/cloud.md +4 -4
- package/agents/data-lite.md +1 -1
- package/agents/data.md +4 -4
- package/agents/debugger.md +1 -0
- package/agents/deps.md +4 -4
- package/agents/designer-lite.md +1 -1
- package/agents/designer.md +4 -4
- package/agents/devops-lite.md +1 -1
- package/agents/devops.md +4 -4
- package/agents/docs.md +4 -4
- package/agents/executor.md +95 -0
- package/agents/explorer-lite.md +1 -1
- package/agents/explorer.md +4 -4
- package/agents/finance-lite.md +1 -1
- package/agents/finance.md +4 -4
- package/agents/i18n.md +4 -4
- package/agents/legal-lite.md +1 -1
- package/agents/legal.md +4 -4
- package/agents/marketing-lite.md +25 -0
- package/agents/marketing.md +179 -0
- package/agents/memory.md +13 -12
- package/agents/orchestrator.md +102 -0
- package/agents/pair.md +1 -0
- package/agents/perf.md +4 -4
- package/agents/planner.md +1 -0
- package/agents/product-lite.md +25 -0
- package/agents/product.md +186 -0
- package/agents/refactor.md +4 -4
- package/agents/ripple.md +1 -0
- package/agents/scout.md +1 -0
- package/agents/security-lite.md +1 -1
- package/agents/security.md +4 -4
- package/agents/sentry-triage-lite.md +54 -0
- package/agents/sentry-triage.md +214 -0
- package/agents/starter-lite.md +4 -4
- package/agents/starter.md +8 -8
- package/agents/support-lite.md +24 -0
- package/agents/support.md +190 -0
- package/agents/tdd.md +1 -0
- package/agents/tester-lite.md +1 -1
- package/agents/tester.md +43 -10
- package/cli/architectures.mjs +713 -0
- package/cli/detect-architecture.mjs +752 -0
- package/cli/generate-architecture.mjs +1096 -0
- package/cli/index.mjs +681 -179
- package/cli/recommend-architecture.mjs +870 -0
- package/hooks/native/auto-dispatch.mjs +22 -23
- package/hooks/native/auto-format.mjs +5 -25
- package/hooks/native/mcp-discovery.mjs +168 -0
- package/hooks/native/security-config.json +7 -0
- package/hooks/native/security-guard.mjs +77 -27
- package/hooks/native/session-context.mjs +61 -18
- package/hooks/native/settings-template.json +9 -0
- package/package.json +1 -1
- package/packs/angular/agents/builder.md +10 -54
- package/packs/angular/agents/doctor.md +7 -61
- package/packs/angular/agents/migrator.md +7 -101
- package/packs/angular/agents/reviewer.md +22 -33
- package/packs/angular/skills/review-check-architecture/SKILL.md +7 -7
- package/packs/angular/skills/review-review/SKILL.md +1 -0
- package/packs/astro/agents/builder.md +10 -79
- package/packs/astro/agents/doctor.md +7 -61
- package/packs/astro/agents/migrator.md +7 -111
- package/packs/astro/agents/reviewer.md +22 -32
- package/packs/astro/skills/review-check-architecture/SKILL.md +9 -9
- package/packs/astro/skills/review-review/SKILL.md +1 -0
- package/packs/nextjs/agents/builder.md +11 -108
- package/packs/nextjs/agents/doctor.md +7 -62
- package/packs/nextjs/agents/migrator.md +6 -194
- package/packs/nextjs/agents/reviewer.md +22 -76
- package/packs/nextjs/skills/review-check-architecture/SKILL.md +15 -15
- package/packs/nextjs/skills/review-review/SKILL.md +1 -0
- package/packs/nuxt/agents/builder.md +10 -55
- package/packs/nuxt/agents/doctor.md +7 -61
- package/packs/nuxt/agents/migrator.md +7 -109
- package/packs/nuxt/agents/reviewer.md +22 -42
- package/packs/nuxt/skills/review-check-architecture/SKILL.md +11 -11
- package/packs/nuxt/skills/review-review/SKILL.md +1 -0
- package/packs/react/agents/builder.md +10 -55
- package/packs/react/agents/doctor.md +7 -61
- package/packs/react/agents/migrator.md +7 -106
- package/packs/react/agents/reviewer.md +22 -55
- package/packs/react/skills/review-check-architecture/SKILL.md +10 -10
- package/packs/react/skills/review-review/SKILL.md +1 -0
- package/packs/svelte/agents/builder.md +10 -58
- package/packs/svelte/agents/doctor.md +7 -60
- package/packs/svelte/agents/migrator.md +7 -118
- package/packs/svelte/agents/reviewer.md +22 -42
- package/packs/svelte/skills/review-check-architecture/SKILL.md +12 -12
- package/packs/svelte/skills/review-review/SKILL.md +1 -0
- package/packs/vue/agents/builder.md +10 -55
- package/packs/vue/agents/doctor.md +7 -61
- package/packs/vue/agents/migrator.md +7 -93
- package/packs/vue/agents/reviewer.md +20 -32
- package/packs/vue/skills/review-check-architecture/SKILL.md +10 -10
- package/packs/vue/skills/review-review/SKILL.md +1 -0
- package/skills/autofix/SKILL.md +166 -0
- package/skills/discovery/SKILL.md +218 -0
- package/skills/migrate-architecture/SKILL.md +242 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: discovery
|
|
3
|
+
description: "Use when starting a new product, feature, or initiative and you need structured discovery before planning - covers market analysis, technical feasibility, architecture, and go-to-market strategy."
|
|
4
|
+
user-invocable: true
|
|
5
|
+
argument-hint: "[product or feature description]"
|
|
6
|
+
allowed-tools: Read, Glob, Grep, Bash, Write
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /discovery - Product & Feature Discovery
|
|
10
|
+
|
|
11
|
+
Structured discovery before planning. Covers feasibility, architecture, risks, and strategy in a single pass.
|
|
12
|
+
|
|
13
|
+
**Target:** $ARGUMENTS
|
|
14
|
+
|
|
15
|
+
## When to Use
|
|
16
|
+
|
|
17
|
+
- Starting a new product or major feature
|
|
18
|
+
- Evaluating technical feasibility of an initiative
|
|
19
|
+
- Before `/plan` when scope is unclear or ambitious
|
|
20
|
+
- When stakeholders need a go/no-go decision
|
|
21
|
+
- NOT for: small features, bug fixes, or tasks with clear scope
|
|
22
|
+
|
|
23
|
+
## Workflow
|
|
24
|
+
|
|
25
|
+
### Phase 0: Scope Definition
|
|
26
|
+
|
|
27
|
+
Define what we're discovering:
|
|
28
|
+
|
|
29
|
+
```markdown
|
|
30
|
+
## Discovery Scope
|
|
31
|
+
- **What:** [product/feature description]
|
|
32
|
+
- **Why:** [business motivation]
|
|
33
|
+
- **Who:** [target users]
|
|
34
|
+
- **Constraints:** [time, budget, team, tech]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Phase 1: Technical Feasibility
|
|
38
|
+
|
|
39
|
+
Analyze the current codebase and evaluate feasibility:
|
|
40
|
+
|
|
41
|
+
1. **Codebase scan** - Identify existing modules, patterns, and dependencies
|
|
42
|
+
2. **Integration points** - What existing systems does this touch?
|
|
43
|
+
3. **Technology gaps** - What new libraries, services, or infrastructure is needed?
|
|
44
|
+
4. **Complexity estimate** - TRIVIAL / SIMPLE / MEDIUM / COMPLEX / EPIC
|
|
45
|
+
|
|
46
|
+
**Output:**
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
## Technical Feasibility
|
|
50
|
+
|
|
51
|
+
### Existing Assets
|
|
52
|
+
- [Reusable modules, services, components]
|
|
53
|
+
|
|
54
|
+
### New Requirements
|
|
55
|
+
- [New packages, services, infrastructure]
|
|
56
|
+
|
|
57
|
+
### Integration Points
|
|
58
|
+
- [APIs, databases, third-party services]
|
|
59
|
+
|
|
60
|
+
### Complexity: [TRIVIAL | SIMPLE | MEDIUM | COMPLEX | EPIC]
|
|
61
|
+
|
|
62
|
+
### Feasibility: [GO | CONDITIONAL | NO-GO]
|
|
63
|
+
- [Reasoning with evidence]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**BLOCKED** until feasibility assessment is complete with evidence.
|
|
67
|
+
|
|
68
|
+
### Phase 2: Architecture Assessment
|
|
69
|
+
|
|
70
|
+
Design the high-level architecture:
|
|
71
|
+
|
|
72
|
+
1. **Component map** - What modules/services are needed?
|
|
73
|
+
2. **Data model** - What entities, relationships, and storage?
|
|
74
|
+
3. **API surface** - What endpoints or interfaces?
|
|
75
|
+
4. **Non-functional requirements** - Performance, security, scalability targets
|
|
76
|
+
|
|
77
|
+
**Output:**
|
|
78
|
+
|
|
79
|
+
```markdown
|
|
80
|
+
## Architecture Assessment
|
|
81
|
+
|
|
82
|
+
### Component Map
|
|
83
|
+
- [Module 1]: [responsibility]
|
|
84
|
+
- [Module 2]: [responsibility]
|
|
85
|
+
|
|
86
|
+
### Data Model
|
|
87
|
+
- [Entity 1]: [key fields and relationships]
|
|
88
|
+
- [Entity 2]: [key fields and relationships]
|
|
89
|
+
|
|
90
|
+
### API Surface
|
|
91
|
+
- [Endpoint/Interface 1]: [purpose]
|
|
92
|
+
- [Endpoint/Interface 2]: [purpose]
|
|
93
|
+
|
|
94
|
+
### Non-Functional Requirements
|
|
95
|
+
| Requirement | Target | Rationale |
|
|
96
|
+
|-------------|--------|-----------|
|
|
97
|
+
| Response time | < 200ms p95 | User experience |
|
|
98
|
+
| Availability | 99.9% | Business SLA |
|
|
99
|
+
| Data retention | 90 days | Compliance |
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Phase 3: Risk Analysis
|
|
103
|
+
|
|
104
|
+
Identify and classify risks:
|
|
105
|
+
|
|
106
|
+
1. **Technical risks** - New technology, complex integrations, performance unknowns
|
|
107
|
+
2. **Business risks** - Market timing, regulatory, competition
|
|
108
|
+
3. **Operational risks** - Team capacity, skill gaps, dependencies on external teams
|
|
109
|
+
|
|
110
|
+
**Output:**
|
|
111
|
+
|
|
112
|
+
```markdown
|
|
113
|
+
## Risk Analysis
|
|
114
|
+
|
|
115
|
+
| Risk | Impact | Likelihood | Mitigation |
|
|
116
|
+
|------|--------|------------|------------|
|
|
117
|
+
| [Risk 1] | High/Med/Low | High/Med/Low | [Strategy] |
|
|
118
|
+
| [Risk 2] | High/Med/Low | High/Med/Low | [Strategy] |
|
|
119
|
+
|
|
120
|
+
### Blockers
|
|
121
|
+
- [Any hard blockers that prevent proceeding]
|
|
122
|
+
|
|
123
|
+
### Open Questions
|
|
124
|
+
- [Questions that need answers before planning]
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Phase 4: Effort & Cost Estimate
|
|
128
|
+
|
|
129
|
+
Estimate the work required:
|
|
130
|
+
|
|
131
|
+
1. **Task decomposition** - Break into major work streams
|
|
132
|
+
2. **Agent mapping** - Which agents handle which work
|
|
133
|
+
3. **Token estimate** - Approximate AI cost
|
|
134
|
+
4. **Timeline** - Suggested phases and milestones
|
|
135
|
+
|
|
136
|
+
**Output:**
|
|
137
|
+
|
|
138
|
+
```markdown
|
|
139
|
+
## Effort Estimate
|
|
140
|
+
|
|
141
|
+
### Work Streams
|
|
142
|
+
| Stream | Agent(s) | Estimated Tokens | Priority |
|
|
143
|
+
|--------|----------|------------------|----------|
|
|
144
|
+
| [Stream 1] | @builder, @data | ~X tokens | P0 |
|
|
145
|
+
| [Stream 2] | @api, @builder | ~X tokens | P1 |
|
|
146
|
+
| [Stream 3] | @tester | ~X tokens | P1 |
|
|
147
|
+
|
|
148
|
+
### Total Estimate
|
|
149
|
+
- Tokens: ~X total (~$Y)
|
|
150
|
+
- Suggested phases: [count]
|
|
151
|
+
- Recommended approach: Sequential / Parallel / Hybrid
|
|
152
|
+
|
|
153
|
+
### Suggested Timeline
|
|
154
|
+
- Phase 1: [scope] - [duration]
|
|
155
|
+
- Phase 2: [scope] - [duration]
|
|
156
|
+
- Phase 3: [scope] - [duration]
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Phase 5: Discovery Verdict
|
|
160
|
+
|
|
161
|
+
Synthesize all findings into a go/no-go recommendation:
|
|
162
|
+
|
|
163
|
+
```markdown
|
|
164
|
+
## Discovery Verdict
|
|
165
|
+
|
|
166
|
+
### Recommendation: [GO | CONDITIONAL GO | NO-GO]
|
|
167
|
+
|
|
168
|
+
### Summary
|
|
169
|
+
[2-3 sentence executive summary]
|
|
170
|
+
|
|
171
|
+
### Key Findings
|
|
172
|
+
1. [Most important finding]
|
|
173
|
+
2. [Second finding]
|
|
174
|
+
3. [Third finding]
|
|
175
|
+
|
|
176
|
+
### Conditions (if CONDITIONAL GO)
|
|
177
|
+
- [Condition that must be met]
|
|
178
|
+
- [Another condition]
|
|
179
|
+
|
|
180
|
+
### Next Steps
|
|
181
|
+
- [ ] [Immediate action 1]
|
|
182
|
+
- [ ] [Immediate action 2]
|
|
183
|
+
- [ ] Run `/plan [refined scope]` to create implementation plan
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Output
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
---- /discovery ----
|
|
190
|
+
Target: [product/feature]
|
|
191
|
+
Feasibility: [GO | CONDITIONAL | NO-GO]
|
|
192
|
+
Complexity: [TRIVIAL | SIMPLE | MEDIUM | COMPLEX | EPIC]
|
|
193
|
+
Estimated tokens: ~X (~$Y)
|
|
194
|
+
Risks: [count] (H:[n] M:[n] L:[n])
|
|
195
|
+
|
|
196
|
+
Verdict: [GO | CONDITIONAL GO | NO-GO]
|
|
197
|
+
|
|
198
|
+
[Full discovery document above]
|
|
199
|
+
|
|
200
|
+
Next: /plan [refined scope] (if GO)
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Anti-Rationalization
|
|
204
|
+
|
|
205
|
+
| Excuse | Reality |
|
|
206
|
+
|--------|---------|
|
|
207
|
+
| "We already know what to build" | Discovery reveals unknowns you don't know you have. |
|
|
208
|
+
| "Discovery is too slow" | Discovering a fatal flaw in 30 min beats building for 2 weeks then pivoting. |
|
|
209
|
+
| "The scope is obvious" | Obvious scope still has hidden integration points, data model decisions, and risks. |
|
|
210
|
+
| "We can discover as we build" | That's called rework. Discovery-first prevents 3-5x cost overruns. |
|
|
211
|
+
|
|
212
|
+
## Rules
|
|
213
|
+
|
|
214
|
+
1. **Evidence-based** - Every finding must reference codebase scans, docs, or research
|
|
215
|
+
2. **No assumptions** - Flag unknowns as open questions, don't guess
|
|
216
|
+
3. **Concrete estimates** - Token counts, timelines, and costs - not "it depends"
|
|
217
|
+
4. **Actionable verdict** - GO/NO-GO with clear reasoning
|
|
218
|
+
5. **Flows into /plan** - Discovery output is the input for planning
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: migrate-architecture
|
|
3
|
+
description: "Use when transforming a project's architecture pattern - e.g., Flat to Modular, MVC to Clean Architecture, Monolith to Modular Monolith."
|
|
4
|
+
user-invocable: true
|
|
5
|
+
argument-hint: "[current-architecture] to [target-architecture] [variant: full|lite] [scope: file|module|project]"
|
|
6
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /migrate-architecture - Architecture Pattern Migration
|
|
10
|
+
|
|
11
|
+
Migrate a project's architecture from one pattern to another while preserving all functionality.
|
|
12
|
+
|
|
13
|
+
**Arguments:** $ARGUMENTS (e.g., "flat to modular full project", "mvc to clean lite src/modules/auth")
|
|
14
|
+
|
|
15
|
+
## Supported Architecture Patterns
|
|
16
|
+
|
|
17
|
+
### Frontend
|
|
18
|
+
|
|
19
|
+
| Pattern | Description |
|
|
20
|
+
|---------|-------------|
|
|
21
|
+
| Flat / Component-Driven | Single components/ dir, minimal structure |
|
|
22
|
+
| Modular (Feature-Based) | Vertical slicing by feature with services/adapters/types |
|
|
23
|
+
| Feature-Sliced Design (FSD) | Strict layered: app > pages > features > entities > shared |
|
|
24
|
+
| Atomic Design | Components by granularity: atoms > molecules > organisms |
|
|
25
|
+
| Clean Architecture | Domain > Use Cases > Adapters > Frameworks |
|
|
26
|
+
| Hexagonal (Ports & Adapters) | Core with ports, infrastructure in adapters |
|
|
27
|
+
|
|
28
|
+
### Backend / Fullstack
|
|
29
|
+
|
|
30
|
+
| Pattern | Description |
|
|
31
|
+
|---------|-------------|
|
|
32
|
+
| MVC / Layered | Horizontal: controllers, services, repositories |
|
|
33
|
+
| Modular Monolith | Single deployment, strict module boundaries |
|
|
34
|
+
| Clean Architecture | Concentric layers, dependency rule inward |
|
|
35
|
+
| Hexagonal | Ports & Adapters, domain isolated |
|
|
36
|
+
| DDD | Bounded contexts, aggregates, domain events |
|
|
37
|
+
| CQRS | Separate command/query paths |
|
|
38
|
+
| Event-Driven | Async communication via events |
|
|
39
|
+
| Microservices | Independent services, own databases |
|
|
40
|
+
|
|
41
|
+
### Variants
|
|
42
|
+
|
|
43
|
+
| Variant | Description |
|
|
44
|
+
|---------|-------------|
|
|
45
|
+
| **Full** | Complete implementation with all layers and patterns |
|
|
46
|
+
| **Lite (Simplified)** | Fewer layers, same principles. For smaller teams |
|
|
47
|
+
|
|
48
|
+
## Workflow
|
|
49
|
+
|
|
50
|
+
### Phase 1: Assessment
|
|
51
|
+
|
|
52
|
+
1. **Read** `docs/ARCHITECTURE.md` if it exists
|
|
53
|
+
2. **Scan** the project structure:
|
|
54
|
+
- List all directories under `src/` (or root if no `src/`)
|
|
55
|
+
- Identify current architecture pattern by matching directory names
|
|
56
|
+
- Count modules/features/components
|
|
57
|
+
- Check for barrel exports (index.ts)
|
|
58
|
+
- Check import patterns between directories
|
|
59
|
+
3. **Identify** the current architecture pattern and confidence level
|
|
60
|
+
4. **Report** findings:
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
── Architecture Assessment ──
|
|
64
|
+
Current: [detected pattern] (confidence: high/medium/low)
|
|
65
|
+
Target: [requested pattern] ([variant])
|
|
66
|
+
Scope: [project | specific module/path]
|
|
67
|
+
Estimated files to move: X
|
|
68
|
+
Estimated files to create: X
|
|
69
|
+
Risk: low/medium/high
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
5. **Ask** for confirmation before proceeding
|
|
73
|
+
|
|
74
|
+
### Phase 2: Planning
|
|
75
|
+
|
|
76
|
+
1. **Generate** the target directory structure based on:
|
|
77
|
+
- Target architecture pattern
|
|
78
|
+
- Detected framework (React, Vue, Next.js, etc.)
|
|
79
|
+
- Chosen variant (Full or Lite)
|
|
80
|
+
2. **Map** existing files to their new locations:
|
|
81
|
+
- Components → appropriate layer/module
|
|
82
|
+
- Services → service layer or domain layer
|
|
83
|
+
- Types → types layer
|
|
84
|
+
- Tests → co-located __tests__/
|
|
85
|
+
- Utils/Helpers → shared/
|
|
86
|
+
3. **Identify** new files to create:
|
|
87
|
+
- Barrel exports (index.ts) per module
|
|
88
|
+
- Adapter layer (if Full variant)
|
|
89
|
+
- Type separation (.types.ts + .contracts.ts for Full)
|
|
90
|
+
4. **Create** migration plan with ordered steps:
|
|
91
|
+
- Phase 2a: Create target directory structure
|
|
92
|
+
- Phase 2b: Move files (least coupled first)
|
|
93
|
+
- Phase 2c: Create new files (barrel exports, adapters)
|
|
94
|
+
- Phase 2d: Update imports
|
|
95
|
+
- Phase 2e: Validate
|
|
96
|
+
|
|
97
|
+
### Phase 3: Execution
|
|
98
|
+
|
|
99
|
+
Execute the migration plan step by step:
|
|
100
|
+
|
|
101
|
+
1. **Create** target directory structure (mkdir -p)
|
|
102
|
+
2. **Move** files one module at a time:
|
|
103
|
+
- Start with the LEAST coupled module
|
|
104
|
+
- Move component files
|
|
105
|
+
- Move service files
|
|
106
|
+
- Move type files
|
|
107
|
+
- Move test files
|
|
108
|
+
3. **Create** new architectural files:
|
|
109
|
+
- Barrel exports (index.ts) for each module
|
|
110
|
+
- Adapter files (if migrating to Modular Full, Clean, or Hexagonal)
|
|
111
|
+
- Type separation files (.types.ts + .contracts.ts)
|
|
112
|
+
4. **Update** all import paths:
|
|
113
|
+
- Use Grep to find all imports referencing moved files
|
|
114
|
+
- Update each import to the new path
|
|
115
|
+
- Use barrel exports where possible
|
|
116
|
+
5. **Generate** or update `docs/ARCHITECTURE.md` for the target pattern
|
|
117
|
+
|
|
118
|
+
### Phase 4: Validation
|
|
119
|
+
|
|
120
|
+
1. **Check** directory structure matches target pattern
|
|
121
|
+
2. **Verify** no broken imports:
|
|
122
|
+
```bash
|
|
123
|
+
npx tsc --noEmit 2>&1 | head -50
|
|
124
|
+
```
|
|
125
|
+
3. **Validate** import rules:
|
|
126
|
+
- Modules don't import from each other (Modular)
|
|
127
|
+
- Dependencies point inward (Clean/Hexagonal)
|
|
128
|
+
- FSD layers import top-down only
|
|
129
|
+
4. **Run** tests if they exist:
|
|
130
|
+
```bash
|
|
131
|
+
npm test 2>&1 | tail -20
|
|
132
|
+
```
|
|
133
|
+
5. **Report** results:
|
|
134
|
+
|
|
135
|
+
```text
|
|
136
|
+
── Architecture Migration Complete ──
|
|
137
|
+
From: [source pattern]
|
|
138
|
+
To: [target pattern] ([variant])
|
|
139
|
+
|
|
140
|
+
Files moved: X
|
|
141
|
+
Files created: X
|
|
142
|
+
Imports updated: X
|
|
143
|
+
Barrel exports created: X
|
|
144
|
+
|
|
145
|
+
Validation:
|
|
146
|
+
TypeScript: ✓ compiles
|
|
147
|
+
Import rules: ✓ no violations
|
|
148
|
+
Tests: ✓ passing (or N/A)
|
|
149
|
+
|
|
150
|
+
docs/ARCHITECTURE.md: ✓ generated
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Migration Strategies by Pattern
|
|
154
|
+
|
|
155
|
+
### Flat → Modular
|
|
156
|
+
|
|
157
|
+
1. Group components by domain/feature
|
|
158
|
+
2. Create `modules/[feature]/components/` for each group
|
|
159
|
+
3. Move related services, types into module
|
|
160
|
+
4. Create index.ts for each module
|
|
161
|
+
5. Move shared components to `shared/components/`
|
|
162
|
+
|
|
163
|
+
### MVC → Modular
|
|
164
|
+
|
|
165
|
+
1. For each controller+service pair, create a module
|
|
166
|
+
2. Move controller logic to module's hooks/composables
|
|
167
|
+
3. Move models to module's types/
|
|
168
|
+
4. Create service layer in each module
|
|
169
|
+
5. Move shared middleware to shared/
|
|
170
|
+
|
|
171
|
+
### MVC → Clean Architecture
|
|
172
|
+
|
|
173
|
+
1. Extract domain entities (pure business objects, no framework deps)
|
|
174
|
+
2. Create use-case classes for each business operation
|
|
175
|
+
3. Define port interfaces for external dependencies
|
|
176
|
+
4. Move database/HTTP code to infrastructure/ as adapter implementations
|
|
177
|
+
5. Wire use cases to ports in the composition root
|
|
178
|
+
|
|
179
|
+
### Modular → Clean Architecture
|
|
180
|
+
|
|
181
|
+
1. For each module, add domain/ and application/ sub-layers
|
|
182
|
+
2. Extract entities from services into domain/entities/
|
|
183
|
+
3. Create use-cases from service methods
|
|
184
|
+
4. Define port interfaces for external deps
|
|
185
|
+
5. Move HTTP/DB code to infrastructure/
|
|
186
|
+
|
|
187
|
+
### Modular → Hexagonal
|
|
188
|
+
|
|
189
|
+
1. Create core/ with domain/ and ports/
|
|
190
|
+
2. Extract entities to core/domain/
|
|
191
|
+
3. Define driving ports (use case interfaces) in core/ports/in/
|
|
192
|
+
4. Define driven ports (repository interfaces) in core/ports/out/
|
|
193
|
+
5. Move components to adapters/in/web/
|
|
194
|
+
6. Move HTTP/DB to adapters/out/
|
|
195
|
+
|
|
196
|
+
### Modular → Feature-Sliced Design
|
|
197
|
+
|
|
198
|
+
1. Map modules to FSD layers:
|
|
199
|
+
- Shared components → shared/ui/
|
|
200
|
+
- Feature-specific → features/[feature]/
|
|
201
|
+
- Business entities → entities/[entity]/
|
|
202
|
+
- Page compositions → pages/
|
|
203
|
+
2. Enforce top-down import rules
|
|
204
|
+
3. Split cross-cutting features into widgets/
|
|
205
|
+
|
|
206
|
+
### Modular → DDD
|
|
207
|
+
|
|
208
|
+
1. Identify bounded contexts from modules
|
|
209
|
+
2. Add aggregates/ with aggregate roots
|
|
210
|
+
3. Extract value objects from entity properties
|
|
211
|
+
4. Create domain events for state changes
|
|
212
|
+
5. Add command/query handlers in application layer
|
|
213
|
+
|
|
214
|
+
### Any → Modular Monolith
|
|
215
|
+
|
|
216
|
+
1. Start with Modular structure
|
|
217
|
+
2. Add domain/application/infrastructure layers per module
|
|
218
|
+
3. Enforce module boundaries with barrel exports
|
|
219
|
+
4. Validate no cross-module internal imports
|
|
220
|
+
5. Each module = potential future microservice
|
|
221
|
+
|
|
222
|
+
## Anti-Patterns to Avoid
|
|
223
|
+
|
|
224
|
+
| Mistake | Correct Approach |
|
|
225
|
+
|---------|-----------------|
|
|
226
|
+
| Moving files without updating imports | Use TypeScript compiler to verify after each move |
|
|
227
|
+
| Creating empty architectural layers | Only create layers with actual content |
|
|
228
|
+
| Migrating everything at once | One module at a time, least coupled first |
|
|
229
|
+
| Skipping barrel exports | Always create index.ts - it enforces boundaries |
|
|
230
|
+
| Copying patterns blindly | Adapt to the project's actual needs (Full vs Lite) |
|
|
231
|
+
| Ignoring existing tests | Move tests alongside their source files |
|
|
232
|
+
|
|
233
|
+
## Rules
|
|
234
|
+
|
|
235
|
+
1. ALWAYS assess before migrating - understand current state first
|
|
236
|
+
2. NEVER migrate without user confirmation
|
|
237
|
+
3. ONE module at a time - never parallel moves
|
|
238
|
+
4. VALIDATE after each module migration (TypeScript + imports)
|
|
239
|
+
5. PRESERVE all existing tests (move them, don't delete)
|
|
240
|
+
6. CREATE docs/ARCHITECTURE.md for the target pattern
|
|
241
|
+
7. USE the appropriate variant (Full for established teams, Lite for small teams)
|
|
242
|
+
8. If TypeScript errors appear, FIX them before continuing
|