myaidev-method 0.3.1 → 0.3.3
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/plugin.json +52 -48
- package/CHANGELOG.md +5 -0
- package/DEV_WORKFLOW_GUIDE.md +6 -6
- package/MCP_INTEGRATION.md +4 -4
- package/README.md +140 -66
- package/TECHNICAL_ARCHITECTURE.md +112 -18
- package/USER_GUIDE.md +270 -39
- package/bin/cli.js +47 -13
- package/dist/mcp/gutenberg-converter.js +667 -413
- package/dist/mcp/wordpress-admin-mcp.js +0 -1
- package/dist/mcp/wordpress-integration.js +0 -1
- package/dist/mcp/wordpress-server.js +1558 -1182
- package/dist/server/.tsbuildinfo +1 -1
- package/extension.json +3 -3
- package/package.json +9 -2
- package/skills/content-writer/SKILL.md +130 -178
- package/skills/infographic/SKILL.md +191 -0
- package/skills/myaidev-analyze/SKILL.md +242 -0
- package/skills/myaidev-architect/SKILL.md +389 -0
- package/skills/myaidev-coder/SKILL.md +291 -0
- package/skills/myaidev-debug/SKILL.md +308 -0
- package/skills/myaidev-documenter/SKILL.md +194 -0
- package/skills/myaidev-migrate/SKILL.md +300 -0
- package/skills/myaidev-performance/SKILL.md +270 -0
- package/skills/myaidev-refactor/SKILL.md +296 -0
- package/skills/myaidev-reviewer/SKILL.md +385 -0
- package/skills/myaidev-tester/SKILL.md +331 -0
- package/skills/myaidev-workflow/SKILL.md +567 -0
- package/skills/security-auditor/SKILL.md +1 -1
- package/src/cli/commands/addon.js +60 -12
- package/src/cli/commands/auth.js +10 -2
- package/src/config/workflows.js +11 -6
- package/src/lib/ascii-banner.js +3 -3
- package/src/lib/coolify-utils.js +0 -1
- package/src/lib/payloadcms-utils.js +0 -1
- package/src/lib/visual-generation-utils.js +0 -1
- package/src/lib/wordpress-admin-utils.js +0 -1
- package/src/mcp/gutenberg-converter.js +667 -413
- package/src/mcp/wordpress-admin-mcp.js +0 -1
- package/src/mcp/wordpress-integration.js +0 -1
- package/src/mcp/wordpress-server.js +1558 -1182
- package/src/scripts/test-coolify-deploy.js +0 -1
- package/src/statusline/statusline.sh +279 -0
- package/skills/content-writer/agents/editor-agent.md +0 -138
- package/skills/content-writer/agents/planner-agent.md +0 -121
- package/skills/content-writer/agents/research-agent.md +0 -83
- package/skills/content-writer/agents/seo-agent.md +0 -139
- package/skills/content-writer/agents/visual-planner-agent.md +0 -110
- package/skills/content-writer/agents/writer-agent.md +0 -85
- package/skills/sparc-architect/SKILL.md +0 -127
- package/skills/sparc-coder/SKILL.md +0 -90
- package/skills/sparc-documenter/SKILL.md +0 -155
- package/skills/sparc-reviewer/SKILL.md +0 -138
- package/skills/sparc-tester/SKILL.md +0 -100
- package/skills/sparc-workflow/SKILL.md +0 -130
- /package/{marketplace.json → .claude-plugin/marketplace.json} +0 -0
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: myaidev-architect
|
|
3
|
+
description: "Multi-agent system architecture design with requirements analysis, component design, and compliance checking. Supports microservices, monolith, serverless, and event-driven patterns."
|
|
4
|
+
argument-hint: "[requirement] [--scope=file|module|project|system] [--style=microservices|monolith|serverless|event-driven] [--depth=shallow|standard|deep]"
|
|
5
|
+
allowed-tools: [Read, Write, Edit, Glob, Grep, Task, WebSearch, AskUserQuestion]
|
|
6
|
+
context: fork
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# MyAIDev Architect Skill v2 — Orchestrator Pattern
|
|
10
|
+
|
|
11
|
+
You are the **Architecture Orchestrator**, a coordinator that decomposes system design into specialized subagent tasks. You maintain a lightweight planning context while delegating requirements analysis, system design, and compliance validation to isolated subagents.
|
|
12
|
+
|
|
13
|
+
## Architecture Overview
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
┌─────────────────────────────────────────────────────────┐
|
|
17
|
+
│ ORCHESTRATOR (this skill) │
|
|
18
|
+
│ * Parses arguments & loads codebase context │
|
|
19
|
+
│ * Creates execution plan │
|
|
20
|
+
│ * Dispatches subagents │
|
|
21
|
+
│ * Aggregates results into architecture document │
|
|
22
|
+
│ * Manages scratchpad state files │
|
|
23
|
+
└──────────────┬──────────────────────────────────────────┘
|
|
24
|
+
│ spawns
|
|
25
|
+
┌──────────┼──────────────────────┐
|
|
26
|
+
v v v
|
|
27
|
+
┌──────────┐ ┌──────────────┐ ┌────────────────┐
|
|
28
|
+
│Require- │ │ System │ │ Compliance │
|
|
29
|
+
│ments │ │ Designer │ │ Checker │
|
|
30
|
+
│ Analyst │ │ Agent │ │ Agent │
|
|
31
|
+
└──────────┘ └──────────────┘ └────────────────┘
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Execution Phases
|
|
35
|
+
|
|
36
|
+
### Phase 0: Initialize
|
|
37
|
+
|
|
38
|
+
- Parse `$ARGUMENTS` for requirement, flags, and parameters
|
|
39
|
+
- Read `.sparc-session/analysis/` if available (output from `myaidev-analyze` skill)
|
|
40
|
+
- `project-profile.md` — tech stack, patterns, conventions
|
|
41
|
+
- `dependency-map.md` — existing module dependencies
|
|
42
|
+
- `risk-areas.md` — identified code smells and risks
|
|
43
|
+
- If no analysis exists, perform lightweight codebase scan:
|
|
44
|
+
- Detect language(s) and frameworks from config files
|
|
45
|
+
- Read project structure (top-level directories)
|
|
46
|
+
- Identify existing architectural patterns
|
|
47
|
+
- Determine scope and depth from arguments
|
|
48
|
+
- Create scratchpad directory: `.sparc-session/` (shared with SPARC workflow, or standalone)
|
|
49
|
+
- Save configuration to `.sparc-session/arch-config.json`
|
|
50
|
+
|
|
51
|
+
### Phase 1: Requirements (Subagent)
|
|
52
|
+
|
|
53
|
+
Spawn a **requirements-analyst subagent** to decompose the requirement:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
Task(subagent_type: "general-purpose", prompt: "...")
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The analyst:
|
|
60
|
+
- Takes the high-level requirement or feature description
|
|
61
|
+
- Decomposes into functional and non-functional requirements
|
|
62
|
+
- Identifies constraints (technology, budget, timeline, team size)
|
|
63
|
+
- Documents assumptions and dependencies
|
|
64
|
+
- Defines acceptance criteria for each requirement
|
|
65
|
+
- Identifies stakeholders and their needs
|
|
66
|
+
- Maps dependencies on existing systems
|
|
67
|
+
- Writes requirements to `.sparc-session/requirements.md`
|
|
68
|
+
- Returns a concise requirements summary
|
|
69
|
+
|
|
70
|
+
### Phase 2: Design (Subagent)
|
|
71
|
+
|
|
72
|
+
Spawn a **system-designer subagent** with requirements + codebase context:
|
|
73
|
+
|
|
74
|
+
The designer:
|
|
75
|
+
- Reads requirements and codebase analysis (if available)
|
|
76
|
+
- Designs component structure and responsibilities
|
|
77
|
+
- Defines API contracts (REST endpoints, GraphQL schemas, function signatures)
|
|
78
|
+
- Creates data models and schema definitions
|
|
79
|
+
- Plans state management approach
|
|
80
|
+
- Generates Mermaid diagrams (architecture, sequence, entity-relationship)
|
|
81
|
+
- Applies the chosen architectural style:
|
|
82
|
+
- **Microservices**: bounded contexts, API gateway, service mesh, inter-service communication
|
|
83
|
+
- **Monolith**: layered architecture, modular boundaries, shared database patterns
|
|
84
|
+
- **Serverless**: function decomposition, event triggers, cold start optimization
|
|
85
|
+
- **Event-driven**: event schemas, pub/sub topology, CQRS patterns, saga orchestration
|
|
86
|
+
- Makes technology recommendations based on existing stack
|
|
87
|
+
- Produces file/directory structure for implementation
|
|
88
|
+
- Writes design to `.sparc-session/architecture.md`
|
|
89
|
+
- Returns design summary
|
|
90
|
+
|
|
91
|
+
### Phase 3: Validate (Subagent)
|
|
92
|
+
|
|
93
|
+
Spawn a **compliance-checker subagent** to verify the design:
|
|
94
|
+
|
|
95
|
+
The checker:
|
|
96
|
+
- Reads the architecture design and project profile
|
|
97
|
+
- Validates against SOLID principles
|
|
98
|
+
- Checks separation of concerns and dependency direction
|
|
99
|
+
- Verifies no circular dependencies exist in the design
|
|
100
|
+
- Validates consistent API patterns across components
|
|
101
|
+
- Assesses security posture (auth, data protection, input validation)
|
|
102
|
+
- Evaluates scalability (bottlenecks, horizontal scaling capability)
|
|
103
|
+
- Checks alignment with existing project conventions
|
|
104
|
+
- Produces pass/fail assessment per criterion
|
|
105
|
+
- Writes review to `.sparc-session/architecture-review.md`
|
|
106
|
+
- Returns compliance summary with any blocking issues
|
|
107
|
+
|
|
108
|
+
### Phase 4: Assemble & Finalize
|
|
109
|
+
|
|
110
|
+
The orchestrator (this skill):
|
|
111
|
+
- Reads all scratchpad files
|
|
112
|
+
- If compliance checker found blocking issues:
|
|
113
|
+
- Re-dispatches the designer with specific fixes required
|
|
114
|
+
- Maximum **2 revision cycles** to prevent infinite loops
|
|
115
|
+
- Logs revisions to `.sparc-session/revisions.md`
|
|
116
|
+
- Produces the final architecture document with:
|
|
117
|
+
- Requirements summary
|
|
118
|
+
- System design with diagrams
|
|
119
|
+
- API contracts
|
|
120
|
+
- Data models
|
|
121
|
+
- Implementation plan with phases
|
|
122
|
+
- Testing strategy
|
|
123
|
+
- Security considerations
|
|
124
|
+
- Compliance review results
|
|
125
|
+
- Saves to `.sparc-session/architecture.md` (for SPARC workflow consumption)
|
|
126
|
+
- Also saves to `specs/{feature-slug}.md` if running standalone
|
|
127
|
+
- Cleans up intermediate scratchpad files (keeps final outputs)
|
|
128
|
+
|
|
129
|
+
## Parameters
|
|
130
|
+
|
|
131
|
+
| Parameter | Description | Default |
|
|
132
|
+
|-----------|-------------|---------|
|
|
133
|
+
| `requirement` | Feature description or requirement to design | Required |
|
|
134
|
+
| `--scope` | Design scope: `file`, `module`, `project`, `system` | `module` |
|
|
135
|
+
| `--style` | Architecture style: `microservices`, `monolith`, `serverless`, `event-driven` | Auto-detected or `monolith` |
|
|
136
|
+
| `--depth` | Analysis depth: `shallow`, `standard`, `deep` | `standard` |
|
|
137
|
+
| `--output` | Output file path | `.sparc-session/architecture.md` |
|
|
138
|
+
| `--diagrams` | Generate Mermaid diagrams | `true` |
|
|
139
|
+
| `--verbose` | Show detailed progress from each phase | `false` |
|
|
140
|
+
|
|
141
|
+
## Scope Definitions
|
|
142
|
+
|
|
143
|
+
| Scope | Coverage | Depth Guide | Typical Output |
|
|
144
|
+
|-------|----------|-------------|----------------|
|
|
145
|
+
| `file` | Single file change | Function signatures, types | 1-2 page spec |
|
|
146
|
+
| `module` | Module or package | Component design, interfaces | 3-5 page spec |
|
|
147
|
+
| `project` | Entire application | Full architecture, data models | 8-15 page spec |
|
|
148
|
+
| `system` | Multi-service system | Service boundaries, infra, deployment | 15-25 page spec |
|
|
149
|
+
|
|
150
|
+
## Depth Definitions
|
|
151
|
+
|
|
152
|
+
| Depth | Analysis Level | Diagrams | NFRs | Implementation Plan |
|
|
153
|
+
|-------|---------------|----------|------|---------------------|
|
|
154
|
+
| `shallow` | High-level overview | 1 architecture diagram | Basic list | Phase summary only |
|
|
155
|
+
| `standard` | Detailed design | Architecture + sequence | Detailed with criteria | Phased with milestones |
|
|
156
|
+
| `deep` | Exhaustive specification | All diagram types + ER | Full analysis with benchmarks | Detailed with estimates |
|
|
157
|
+
|
|
158
|
+
## Subagent Prompt Templates
|
|
159
|
+
|
|
160
|
+
Each subagent has a detailed prompt template in the `agents/` directory. Load the appropriate file when spawning each subagent, injecting dynamic variables.
|
|
161
|
+
|
|
162
|
+
| Phase | Prompt File | Key Variables |
|
|
163
|
+
|-------|-------------|---------------|
|
|
164
|
+
| Requirements | [agents/requirements-analyst-agent.md](agents/requirements-analyst-agent.md) | requirement, scope, depth, existing_analysis |
|
|
165
|
+
| Design | [agents/system-designer-agent.md](agents/system-designer-agent.md) | requirements, scope, style, depth, codebase_context |
|
|
166
|
+
| Validate | [agents/compliance-checker-agent.md](agents/compliance-checker-agent.md) | architecture, project_profile, scope |
|
|
167
|
+
|
|
168
|
+
## State Management (Scratchpad Pattern)
|
|
169
|
+
|
|
170
|
+
All intermediate work is written to `.sparc-session/` directory:
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
.sparc-session/
|
|
174
|
+
├── arch-config.json # Parsed arguments and settings
|
|
175
|
+
├── requirements.md # Requirements analyst output
|
|
176
|
+
├── architecture.md # System designer output (final)
|
|
177
|
+
├── architecture-review.md # Compliance checker output
|
|
178
|
+
├── revisions.md # Revision history (if design was revised)
|
|
179
|
+
└── diagrams/ # Generated Mermaid diagram source files
|
|
180
|
+
├── architecture.mmd
|
|
181
|
+
├── sequence.mmd
|
|
182
|
+
└── er-diagram.mmd
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
This keeps the orchestrator's context lean -- it reads only what it needs for each phase.
|
|
186
|
+
|
|
187
|
+
## Execution Flow
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
1. INIT → Parse args, load codebase context, create session dir
|
|
191
|
+
2. REQUIREMENTS → Spawn requirements analyst
|
|
192
|
+
3. DESIGN → Spawn system designer with requirements + context
|
|
193
|
+
4. VALIDATE → Spawn compliance checker
|
|
194
|
+
5. REVISE → If blocking issues, re-dispatch designer (max 2 cycles)
|
|
195
|
+
6. ASSEMBLE → Read all outputs, produce final architecture document
|
|
196
|
+
7. OUTPUT → Save to .sparc-session/architecture.md and optionally specs/
|
|
197
|
+
8. CLEANUP → Remove intermediate files (keep final outputs)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Error Handling
|
|
201
|
+
|
|
202
|
+
- If requirements analysis fails, ask the user for clarification on the requirement
|
|
203
|
+
- If designer fails, fall back to a simpler scope (project -> module -> file)
|
|
204
|
+
- If compliance checker finds blocking issues, trigger revision cycle
|
|
205
|
+
- If revision limit reached, output design with compliance warnings attached
|
|
206
|
+
- Never block the entire pipeline on a single failure
|
|
207
|
+
- Log all errors to `.sparc-session/revisions.md`
|
|
208
|
+
|
|
209
|
+
## Context Management (Long-Running Agent Patterns)
|
|
210
|
+
|
|
211
|
+
### Context Regurgitation
|
|
212
|
+
Before dispatching each subagent, briefly restate in your prompt:
|
|
213
|
+
- Current phase number and what has been completed so far
|
|
214
|
+
- Key decisions made (scope determined, style chosen, constraints identified)
|
|
215
|
+
- What this subagent needs to accomplish and how its output feeds the next phase
|
|
216
|
+
|
|
217
|
+
This keeps critical context fresh at the end of the context window where LLM attention is strongest.
|
|
218
|
+
|
|
219
|
+
### File Buffering
|
|
220
|
+
All subagent outputs go to `.sparc-session/` files -- never pass raw subagent output directly into the next prompt. Read only the specific file sections needed for each phase. This keeps the orchestrator's active context lean.
|
|
221
|
+
|
|
222
|
+
### Dynamic Plan Updates
|
|
223
|
+
If the compliance checker returns blocking issues:
|
|
224
|
+
1. Parse the specific issues from the review
|
|
225
|
+
2. Re-dispatch the designer with the issues as additional constraints
|
|
226
|
+
3. Resume validation from the current phase
|
|
227
|
+
4. Maximum **2 revision cycles** to prevent infinite loops
|
|
228
|
+
5. Log each revision to `.sparc-session/revisions.md`
|
|
229
|
+
|
|
230
|
+
## Progress Reporting
|
|
231
|
+
|
|
232
|
+
At each phase transition, report to the user:
|
|
233
|
+
|
|
234
|
+
```
|
|
235
|
+
-> Phase 1/4: Analyzing requirements...
|
|
236
|
+
OK: Decomposed into 5 functional, 3 non-functional requirements
|
|
237
|
+
-> Phase 2/4: Designing system architecture ({style})...
|
|
238
|
+
OK: 4 components, 8 API endpoints, 3 data models designed
|
|
239
|
+
-> Phase 3/4: Validating architecture compliance...
|
|
240
|
+
OK: 12/14 checks passed, 2 warnings (no blockers)
|
|
241
|
+
-> Phase 4/4: Assembling architecture document...
|
|
242
|
+
OK: Saved to .sparc-session/architecture.md
|
|
243
|
+
|
|
244
|
+
Architecture Summary:
|
|
245
|
+
Scope: {scope} | Style: {style} | Depth: {depth}
|
|
246
|
+
Components: {count} | APIs: {count} endpoints
|
|
247
|
+
Data Models: {count} | Diagrams: {count}
|
|
248
|
+
Compliance: {passed}/{total} checks passed
|
|
249
|
+
Warnings: {count} | Blockers: {count}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Output Format
|
|
253
|
+
|
|
254
|
+
Final architecture document follows this structure:
|
|
255
|
+
|
|
256
|
+
```markdown
|
|
257
|
+
# Architecture: {Feature Name}
|
|
258
|
+
|
|
259
|
+
## 1. Overview
|
|
260
|
+
{Brief description of the feature and its purpose}
|
|
261
|
+
|
|
262
|
+
## 2. Requirements
|
|
263
|
+
|
|
264
|
+
### Functional Requirements
|
|
265
|
+
- FR-1: {requirement with acceptance criteria}
|
|
266
|
+
- FR-2: ...
|
|
267
|
+
|
|
268
|
+
### Non-Functional Requirements
|
|
269
|
+
- NFR-1: {requirement with measurable criteria}
|
|
270
|
+
- NFR-2: ...
|
|
271
|
+
|
|
272
|
+
### Constraints
|
|
273
|
+
- {technology, budget, timeline, team constraints}
|
|
274
|
+
|
|
275
|
+
### Assumptions
|
|
276
|
+
- {documented assumptions}
|
|
277
|
+
|
|
278
|
+
## 3. Architecture
|
|
279
|
+
|
|
280
|
+
### Component Diagram
|
|
281
|
+
```mermaid
|
|
282
|
+
{architecture diagram}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Components
|
|
286
|
+
- **{Component A}**: {responsibility, interfaces, dependencies}
|
|
287
|
+
- **{Component B}**: ...
|
|
288
|
+
|
|
289
|
+
### Data Flow
|
|
290
|
+
```mermaid
|
|
291
|
+
{sequence diagram for primary flow}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
## 4. API Contracts
|
|
295
|
+
|
|
296
|
+
### {Endpoint Group}
|
|
297
|
+
| Method | Path | Request | Response | Auth |
|
|
298
|
+
|--------|------|---------|----------|------|
|
|
299
|
+
| POST | /api/resource | {body schema} | {response schema} | {auth type} |
|
|
300
|
+
|
|
301
|
+
## 5. Data Models
|
|
302
|
+
|
|
303
|
+
### {Model Name}
|
|
304
|
+
```mermaid
|
|
305
|
+
{ER diagram}
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
| Field | Type | Constraints | Description |
|
|
309
|
+
|-------|------|-------------|-------------|
|
|
310
|
+
| id | UUID | PK | Primary identifier |
|
|
311
|
+
| ... | ... | ... | ... |
|
|
312
|
+
|
|
313
|
+
## 6. File Structure
|
|
314
|
+
```
|
|
315
|
+
{proposed directory and file layout}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
## 7. Implementation Plan
|
|
319
|
+
1. Phase 1: {description, deliverables, dependencies}
|
|
320
|
+
2. Phase 2: ...
|
|
321
|
+
|
|
322
|
+
## 8. Testing Strategy
|
|
323
|
+
- Unit tests for: {components}
|
|
324
|
+
- Integration tests for: {flows}
|
|
325
|
+
- E2E tests for: {scenarios}
|
|
326
|
+
|
|
327
|
+
## 9. Security Considerations
|
|
328
|
+
- {authentication approach}
|
|
329
|
+
- {authorization model}
|
|
330
|
+
- {data protection measures}
|
|
331
|
+
- {input validation boundaries}
|
|
332
|
+
|
|
333
|
+
## 10. Compliance Review
|
|
334
|
+
| Check | Status | Notes |
|
|
335
|
+
|-------|--------|-------|
|
|
336
|
+
| SOLID compliance | PASS/WARN/FAIL | {details} |
|
|
337
|
+
| Separation of concerns | PASS/WARN/FAIL | {details} |
|
|
338
|
+
| ... | ... | ... |
|
|
339
|
+
|
|
340
|
+
## 11. Open Questions
|
|
341
|
+
- [ ] {unresolved question needing stakeholder input}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
## SPARC Phase Support
|
|
345
|
+
|
|
346
|
+
This skill supports two SPARC phases:
|
|
347
|
+
|
|
348
|
+
| SPARC Phase | Usage | Output Location |
|
|
349
|
+
|-------------|-------|-----------------|
|
|
350
|
+
| Specification (S) | Requirements analysis and high-level design | `.sparc-session/spec.md` |
|
|
351
|
+
| Architecture (A) | Detailed system design and contracts | `.sparc-session/architecture.md` |
|
|
352
|
+
|
|
353
|
+
When invoked from the `myaidev-workflow` orchestrator:
|
|
354
|
+
- Phase S: Run requirements analyst only, output to `spec.md`
|
|
355
|
+
- Phase A: Run full pipeline (requirements -> design -> validate), output to `architecture.md`
|
|
356
|
+
- When running standalone: full pipeline, output to both locations
|
|
357
|
+
|
|
358
|
+
## Integration
|
|
359
|
+
|
|
360
|
+
- Consumes analysis from `/myaidev-method:myaidev-analyze` (codebase context)
|
|
361
|
+
- Output feeds into `/myaidev-method:myaidev-coder` for implementation
|
|
362
|
+
- Works with `/myaidev-method:myaidev-workflow` for full SPARC orchestration
|
|
363
|
+
- Shares `.sparc-session/` with other SPARC phases when in workflow mode
|
|
364
|
+
- Architecture document is consumed by tester for test strategy planning
|
|
365
|
+
|
|
366
|
+
## Example Usage
|
|
367
|
+
|
|
368
|
+
```bash
|
|
369
|
+
# Design a new feature (auto-detected style)
|
|
370
|
+
/myaidev-method:myaidev-architect "User authentication with OAuth2 and JWT"
|
|
371
|
+
|
|
372
|
+
# System-level microservices architecture
|
|
373
|
+
/myaidev-method:myaidev-architect "E-commerce platform with inventory management" --scope=system --style=microservices --depth=deep
|
|
374
|
+
|
|
375
|
+
# Quick module design
|
|
376
|
+
/myaidev-method:myaidev-architect "Add Redis caching layer for API responses" --scope=module --depth=shallow
|
|
377
|
+
|
|
378
|
+
# Serverless architecture
|
|
379
|
+
/myaidev-method:myaidev-architect "Image processing pipeline with thumbnails and watermarks" --style=serverless
|
|
380
|
+
|
|
381
|
+
# Event-driven system
|
|
382
|
+
/myaidev-method:myaidev-architect "Real-time notification system with email, SMS, and push" --style=event-driven --scope=project
|
|
383
|
+
|
|
384
|
+
# Deep analysis for migration
|
|
385
|
+
/myaidev-method:myaidev-architect "Migrate monolith to modular architecture" --scope=system --depth=deep
|
|
386
|
+
|
|
387
|
+
# File-scope quick spec
|
|
388
|
+
/myaidev-method:myaidev-architect "Add rate limiting middleware" --scope=file --depth=shallow
|
|
389
|
+
```
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: myaidev-coder
|
|
3
|
+
description: "Pattern-aware multi-agent code implementation that analyzes existing codebase conventions before generating code. Supports TDD mode and incremental generation."
|
|
4
|
+
argument-hint: "[spec-or-task] [--implement] [--tdd] [--chunk-size=small|medium|large] [--module=path]"
|
|
5
|
+
allowed-tools: [Read, Write, Edit, Glob, Grep, Bash, Task, AskUserQuestion]
|
|
6
|
+
context: fork
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# MyAIDev Coder Skill v2 — Orchestrator Pattern
|
|
10
|
+
|
|
11
|
+
You are the **Code Implementation Orchestrator**, a coordinator that decomposes code generation into specialized subagent tasks. You maintain a lightweight planning context while delegating intensive work to isolated subagents, ensuring generated code matches the conventions of the target codebase.
|
|
12
|
+
|
|
13
|
+
## Architecture Overview
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
+---------------------------------------------------------+
|
|
17
|
+
| ORCHESTRATOR (this skill) |
|
|
18
|
+
| * Parses arguments & loads codebase context |
|
|
19
|
+
| * Checks .sparc-session/analysis/ for prior analysis |
|
|
20
|
+
| * Creates execution plan |
|
|
21
|
+
| * Dispatches subagents in sequence |
|
|
22
|
+
| * Manages scratchpad state files |
|
|
23
|
+
| * Reports progress at each phase |
|
|
24
|
+
+-------------------+-------------------------------------+
|
|
25
|
+
| spawns
|
|
26
|
+
+----------+----------+--------------+
|
|
27
|
+
v v v v
|
|
28
|
+
+-----------+ +----------+ +----------+ +----------+
|
|
29
|
+
| Pattern | |Implement-| |Integrat- | | Self- |
|
|
30
|
+
| Scanner | |er Agent | |ion Agent | | Reviewer |
|
|
31
|
+
+-----------+ +----------+ +----------+ +----------+
|
|
32
|
+
^
|
|
33
|
+
| re-run if issues found
|
|
34
|
+
+--- Self-Reviewer feedback loop
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Execution Phases
|
|
38
|
+
|
|
39
|
+
### Phase 0: Initialize
|
|
40
|
+
- Parse `$ARGUMENTS` for spec path, flags, and parameters
|
|
41
|
+
- Determine session directory:
|
|
42
|
+
- If `.sparc-session/` exists (running inside myaidev-workflow): use it as scratchpad
|
|
43
|
+
- Otherwise: create `.coder-session/` (standalone mode, ephemeral, gitignored)
|
|
44
|
+
- Check for prior codebase analysis in `.sparc-session/analysis/` or `.coder-session/analysis/`
|
|
45
|
+
- If `--module` is specified, scope all work to that path
|
|
46
|
+
- Determine chunk size strategy from `--chunk-size` (default: medium)
|
|
47
|
+
- Save parsed config to `{session}/config.json`
|
|
48
|
+
|
|
49
|
+
### Phase 1: Pattern Scan (Subagent — conditional)
|
|
50
|
+
**Skip if**: `{session}/analysis/convention-guide.md` already exists (created by myaidev-workflow or prior run)
|
|
51
|
+
|
|
52
|
+
Spawn a **pattern-scanner subagent** to analyze the existing codebase:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
Task(subagent_type: "general-purpose", prompt: "...")
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Load [agents/pattern-scanner-agent.md](agents/pattern-scanner-agent.md) and inject:
|
|
59
|
+
- `{target_module}`: the `--module` path or project root
|
|
60
|
+
- `{session_dir}`: path to the active session directory
|
|
61
|
+
|
|
62
|
+
The pattern scanner:
|
|
63
|
+
- Reads 5-10 representative source files from the target area
|
|
64
|
+
- Detects naming conventions, import styles, error handling patterns
|
|
65
|
+
- Identifies directory organization strategy
|
|
66
|
+
- Writes findings to `{session}/analysis/convention-guide.md`
|
|
67
|
+
- Returns a concise summary of detected conventions
|
|
68
|
+
|
|
69
|
+
### Phase 2: Implementation (Subagent — main workload)
|
|
70
|
+
Spawn an **implementer subagent** with the spec + convention guide:
|
|
71
|
+
|
|
72
|
+
Load [agents/implementer-agent.md](agents/implementer-agent.md) and inject:
|
|
73
|
+
- `{spec_content}`: the specification or task description
|
|
74
|
+
- `{convention_guide}`: contents of `{session}/analysis/convention-guide.md`
|
|
75
|
+
- `{architecture}`: contents of `{session}/architecture.md` (if exists)
|
|
76
|
+
- `{task_type}`: detected or specified task type (feature, api-endpoint, data-model, utility, component)
|
|
77
|
+
- `{chunk_size}`: small (1-2 files), medium (3-5 files), large (6+ files)
|
|
78
|
+
- `{tdd_mode}`: whether `--tdd` flag is active
|
|
79
|
+
- `{test_files}`: contents of `{session}/tests/` (if `--tdd` mode)
|
|
80
|
+
|
|
81
|
+
The implementer:
|
|
82
|
+
- Generates production code following detected conventions
|
|
83
|
+
- Creates files in the correct project directories
|
|
84
|
+
- Applies SOLID principles and appropriate error handling
|
|
85
|
+
- If `--tdd`: reads test files and implements code to pass them
|
|
86
|
+
- Writes manifest to `{session}/implementation-manifest.md` listing all created/modified files
|
|
87
|
+
- Returns list of created files and completion status
|
|
88
|
+
|
|
89
|
+
### Phase 3: Integration (Subagent)
|
|
90
|
+
Spawn an **integration subagent** to wire the new code into the existing codebase:
|
|
91
|
+
|
|
92
|
+
Load [agents/integration-agent.md](agents/integration-agent.md) and inject:
|
|
93
|
+
- `{implementation_manifest}`: contents of `{session}/implementation-manifest.md`
|
|
94
|
+
- `{convention_guide}`: contents of `{session}/analysis/convention-guide.md`
|
|
95
|
+
- `{target_module}`: the `--module` path or project root
|
|
96
|
+
|
|
97
|
+
The integration agent:
|
|
98
|
+
- Updates barrel exports (index.ts/index.js)
|
|
99
|
+
- Adds route registrations if applicable
|
|
100
|
+
- Updates dependency injection containers
|
|
101
|
+
- Modifies config files (webpack, vite, tsconfig, etc.) if needed
|
|
102
|
+
- Updates type definitions and module declarations
|
|
103
|
+
- Writes integration log to `{session}/integration-log.md`
|
|
104
|
+
- Returns list of files modified for integration
|
|
105
|
+
|
|
106
|
+
### Phase 4: Self-Review (Subagent)
|
|
107
|
+
Spawn a **self-reviewer subagent** for a quick quality check:
|
|
108
|
+
|
|
109
|
+
Load [agents/self-reviewer-agent.md](agents/self-reviewer-agent.md) and inject:
|
|
110
|
+
- `{implementation_manifest}`: contents of `{session}/implementation-manifest.md`
|
|
111
|
+
- `{integration_log}`: contents of `{session}/integration-log.md`
|
|
112
|
+
- `{convention_guide}`: contents of `{session}/analysis/convention-guide.md`
|
|
113
|
+
|
|
114
|
+
The self-reviewer:
|
|
115
|
+
- Checks for missing error handling, unused imports, hardcoded values
|
|
116
|
+
- Verifies type safety and return type completeness
|
|
117
|
+
- Scans for debug statements left in code
|
|
118
|
+
- Writes findings to `{session}/self-review.md` with severity-tagged issues
|
|
119
|
+
- Returns `{issues_found: int, critical: int, warnings: int}`
|
|
120
|
+
|
|
121
|
+
### Phase 4b: Fix Loop (Conditional)
|
|
122
|
+
If the self-reviewer found critical issues:
|
|
123
|
+
1. Read `{session}/self-review.md` for specific issues
|
|
124
|
+
2. Re-dispatch the **implementer subagent** with the original spec PLUS the self-review findings
|
|
125
|
+
3. Re-run the self-reviewer (maximum **2 fix loops** to prevent infinite cycles)
|
|
126
|
+
4. Log each iteration to `{session}/fix-iterations.md`
|
|
127
|
+
|
|
128
|
+
### Phase 5: Finalize
|
|
129
|
+
The orchestrator (this skill):
|
|
130
|
+
- Reads all session files to compile a summary
|
|
131
|
+
- Runs linter/formatter if project has one configured (`npm run lint`, `cargo fmt`, etc.)
|
|
132
|
+
- Reports final status to the user
|
|
133
|
+
- Optionally cleans up session directory (keep if `--verbose`)
|
|
134
|
+
|
|
135
|
+
## Parameters
|
|
136
|
+
|
|
137
|
+
| Parameter | Description | Default |
|
|
138
|
+
|-----------|-------------|---------|
|
|
139
|
+
| `spec-or-task` | Spec file path, task description, or inline spec | Required |
|
|
140
|
+
| `--implement` | Start implementation immediately (skip confirmation) | false |
|
|
141
|
+
| `--tdd` | TDD mode: read tests from session dir, implement to pass them | false |
|
|
142
|
+
| `--chunk-size` | Generation granularity: small (1-2 files), medium (3-5), large (6+) | medium |
|
|
143
|
+
| `--module` | Target module/directory to scope work | auto-detect |
|
|
144
|
+
| `--dry-run` | Show implementation plan without writing code | false |
|
|
145
|
+
| `--verbose` | Show detailed progress and keep session files | false |
|
|
146
|
+
|
|
147
|
+
## Subagent Prompt Templates
|
|
148
|
+
|
|
149
|
+
Each subagent has a detailed prompt in the `agents/` directory. Load the appropriate file when spawning each subagent, injecting the dynamic variables.
|
|
150
|
+
|
|
151
|
+
| Phase | Prompt File | Key Variables |
|
|
152
|
+
|-------|-------------|---------------|
|
|
153
|
+
| Pattern Scan | [agents/pattern-scanner-agent.md](agents/pattern-scanner-agent.md) | target_module, session_dir |
|
|
154
|
+
| Implementation | [agents/implementer-agent.md](agents/implementer-agent.md) | spec_content, convention_guide, architecture, task_type, chunk_size, tdd_mode, test_files |
|
|
155
|
+
| Integration | [agents/integration-agent.md](agents/integration-agent.md) | implementation_manifest, convention_guide, target_module |
|
|
156
|
+
| Self-Review | [agents/self-reviewer-agent.md](agents/self-reviewer-agent.md) | implementation_manifest, integration_log, convention_guide |
|
|
157
|
+
|
|
158
|
+
## Chunk Size Strategy
|
|
159
|
+
|
|
160
|
+
| Size | Scope | When to Use |
|
|
161
|
+
|------|-------|-------------|
|
|
162
|
+
| `small` | 1-2 files per dispatch | Surgical changes, single function, hotfix |
|
|
163
|
+
| `medium` | 3-5 files per dispatch | Standard feature, API endpoint with tests |
|
|
164
|
+
| `large` | 6+ files per dispatch | Full module, multi-component feature |
|
|
165
|
+
|
|
166
|
+
For `large` chunks, the implementer may be dispatched multiple times with sub-specs to keep each invocation focused.
|
|
167
|
+
|
|
168
|
+
## TDD Mode
|
|
169
|
+
|
|
170
|
+
When `--tdd` is active:
|
|
171
|
+
1. Orchestrator reads test files from `{session}/tests/` (placed by myaidev-tester or manually)
|
|
172
|
+
2. Test file contents are injected into the implementer prompt
|
|
173
|
+
3. Implementer writes code specifically to make tests pass
|
|
174
|
+
4. After implementation, orchestrator runs `npm test` / `pytest` / `cargo test` (auto-detected)
|
|
175
|
+
5. If tests fail, re-dispatch implementer with test output (maximum 3 attempts)
|
|
176
|
+
6. Report test results in final summary
|
|
177
|
+
|
|
178
|
+
## State Management (Scratchpad Pattern)
|
|
179
|
+
|
|
180
|
+
All intermediate work is written to the session directory:
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
{session}/
|
|
184
|
+
+-- config.json # Parsed arguments and settings
|
|
185
|
+
+-- analysis/
|
|
186
|
+
| +-- convention-guide.md # Pattern scanner output
|
|
187
|
+
+-- architecture.md # From myaidev-workflow (if available)
|
|
188
|
+
+-- tests/ # Test files for TDD mode
|
|
189
|
+
+-- implementation-manifest.md # List of created/modified files
|
|
190
|
+
+-- integration-log.md # Integration changes made
|
|
191
|
+
+-- self-review.md # Quality check findings
|
|
192
|
+
+-- fix-iterations.md # Fix loop history (if any)
|
|
193
|
+
+-- summary.md # Final implementation summary
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
This keeps the orchestrator's context lean -- it reads only what it needs for each phase.
|
|
197
|
+
|
|
198
|
+
## Execution Flow
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
1. INIT -> Parse args, detect session dir, load prior analysis
|
|
202
|
+
2. PATTERN SCAN -> Spawn scanner (skip if convention-guide exists)
|
|
203
|
+
3. IMPLEMENT -> Spawn implementer with spec + conventions
|
|
204
|
+
4. INTEGRATE -> Spawn integration agent to wire into codebase
|
|
205
|
+
5. SELF-REVIEW -> Spawn reviewer for quality check
|
|
206
|
+
6. FIX LOOP -> Re-implement if critical issues found (max 2 loops)
|
|
207
|
+
7. FINALIZE -> Run linter, compile summary, report to user
|
|
208
|
+
8. CLEANUP -> Remove session dir (unless --verbose)
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Error Handling
|
|
212
|
+
|
|
213
|
+
- If pattern scanner fails: proceed with generic best-practice conventions
|
|
214
|
+
- If implementer fails: report error with context, ask user for guidance
|
|
215
|
+
- If integration fails: leave new files in place but report unlinked status
|
|
216
|
+
- If self-reviewer fails: proceed without quality check (warn user)
|
|
217
|
+
- If TDD tests fail after 3 attempts: report failing tests and partial implementation
|
|
218
|
+
- Never silently swallow errors -- always report to the user
|
|
219
|
+
|
|
220
|
+
## Context Management (Long-Running Agent Patterns)
|
|
221
|
+
|
|
222
|
+
### Context Regurgitation
|
|
223
|
+
Before dispatching each subagent, briefly restate in your prompt:
|
|
224
|
+
- Current phase number and what has been completed so far
|
|
225
|
+
- Key decisions made (detected conventions, chosen file paths, implementation approach)
|
|
226
|
+
- What this subagent needs to accomplish and how its output feeds the next phase
|
|
227
|
+
|
|
228
|
+
This keeps critical context fresh at the end of the context window where LLM attention is strongest.
|
|
229
|
+
|
|
230
|
+
### Dynamic Plan Updates
|
|
231
|
+
If a subagent returns indicating the plan needs revision (e.g., implementer discovers missing dependency, convention conflict):
|
|
232
|
+
1. Parse the update request from the subagent's output
|
|
233
|
+
2. Re-run the affected earlier phase with the new context
|
|
234
|
+
3. Resume the pipeline from the current phase
|
|
235
|
+
4. Maximum **2 plan revisions per session** to prevent infinite loops
|
|
236
|
+
5. Log each revision to `{session}/revisions.md`
|
|
237
|
+
|
|
238
|
+
### File Buffering
|
|
239
|
+
All subagent outputs go to session files -- never pass raw subagent output directly into the next prompt. Read only the specific file sections needed for each phase. This keeps the orchestrator's active context lean.
|
|
240
|
+
|
|
241
|
+
## Progress Reporting
|
|
242
|
+
|
|
243
|
+
At each phase transition, report to the user:
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
-> Phase 1/5: Scanning codebase patterns in {module}...
|
|
247
|
+
OK Detected: camelCase naming, ESM imports, feature-based dirs
|
|
248
|
+
-> Phase 2/5: Implementing {task_type}: "{spec_summary}"...
|
|
249
|
+
OK Created 4 files, modified 1 existing
|
|
250
|
+
-> Phase 3/5: Integrating into codebase...
|
|
251
|
+
OK Updated 2 barrel exports, 1 route registration
|
|
252
|
+
-> Phase 4/5: Self-review quality check...
|
|
253
|
+
OK 0 critical, 2 warnings, 1 suggestion
|
|
254
|
+
-> Phase 5/5: Finalizing...
|
|
255
|
+
OK Linter passed, all files formatted
|
|
256
|
+
|
|
257
|
+
Summary:
|
|
258
|
+
Files Created: {count} | Files Modified: {count}
|
|
259
|
+
Convention Compliance: {score}
|
|
260
|
+
Self-Review: {critical} critical, {warnings} warnings
|
|
261
|
+
TDD: {passed}/{total} tests passing (if --tdd)
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Integration
|
|
265
|
+
|
|
266
|
+
- Receives input from `/myaidev-method:myaidev-workflow` (architecture phase output)
|
|
267
|
+
- Output reviewed by `/myaidev-method:myaidev-reviewer`
|
|
268
|
+
- Tests created/validated by `/myaidev-method:tester`
|
|
269
|
+
- Part of `/myaidev-method:myaidev-workflow` full pipeline
|
|
270
|
+
|
|
271
|
+
## Example Usage
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
# Implement from specification
|
|
275
|
+
/myaidev-method:myaidev-coder "./specs/auth-feature.md" --implement
|
|
276
|
+
|
|
277
|
+
# TDD mode: implement to pass existing tests
|
|
278
|
+
/myaidev-method:myaidev-coder "./specs/payment-service.md" --tdd --module=src/payments
|
|
279
|
+
|
|
280
|
+
# Preview implementation plan
|
|
281
|
+
/myaidev-method:myaidev-coder "./specs/api-endpoints.md" --dry-run
|
|
282
|
+
|
|
283
|
+
# Small surgical change
|
|
284
|
+
/myaidev-method:myaidev-coder "Add rate limiting middleware to /api/auth routes" --chunk-size=small --module=src/middleware
|
|
285
|
+
|
|
286
|
+
# Large feature with verbose output
|
|
287
|
+
/myaidev-method:myaidev-coder "./specs/notification-system.md" --implement --chunk-size=large --verbose
|
|
288
|
+
|
|
289
|
+
# Inline task (no spec file)
|
|
290
|
+
/myaidev-method:myaidev-coder "Create a Redis caching layer for user sessions" --implement --module=src/cache
|
|
291
|
+
```
|