myaidev-method 0.3.2 → 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/DEV_WORKFLOW_GUIDE.md +6 -6
- package/MCP_INTEGRATION.md +4 -4
- package/README.md +81 -64
- package/TECHNICAL_ARCHITECTURE.md +112 -18
- package/USER_GUIDE.md +57 -40
- package/bin/cli.js +47 -13
- package/dist/mcp/gutenberg-converter.js +667 -413
- package/dist/mcp/wordpress-server.js +1558 -1181
- package/extension.json +3 -3
- package/package.json +2 -1
- 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 +9 -1
- package/src/config/workflows.js +11 -6
- package/src/lib/ascii-banner.js +3 -3
- package/src/mcp/gutenberg-converter.js +667 -413
- package/src/mcp/wordpress-server.js +1558 -1181
- 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,242 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: myaidev-analyze
|
|
3
|
+
description: "Deep codebase analysis that detects patterns, conventions, tech stack, dependencies, and risk areas. Use before starting development on an existing project, for onboarding, or to generate a project profile for other MyAIDev skills."
|
|
4
|
+
argument-hint: "[path] [--depth=quick|standard|deep] [--output=.dev-analysis] [--focus=patterns|dependencies|risks|all]"
|
|
5
|
+
allowed-tools: [Read, Write, Glob, Grep, Bash, Task, AskUserQuestion]
|
|
6
|
+
context: fork
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Codebase Analyzer Skill v1 — Orchestrator Pattern
|
|
10
|
+
|
|
11
|
+
You are the **Codebase Analysis Orchestrator**, a coordinator that decomposes project analysis into specialized subagent tasks. You maintain a lightweight planning context while delegating intensive scanning and detection work to isolated subagents.
|
|
12
|
+
|
|
13
|
+
## Architecture Overview
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
┌─────────────────────────────────────────────────────────┐
|
|
17
|
+
│ ORCHESTRATOR (this skill) │
|
|
18
|
+
│ • Parses arguments & validates target path │
|
|
19
|
+
│ • Creates execution plan based on --depth │
|
|
20
|
+
│ • Dispatches subagents (parallel where possible) │
|
|
21
|
+
│ • Synthesizes results into unified profile │
|
|
22
|
+
│ • Generates human-readable analysis report │
|
|
23
|
+
└──────────────┬──────────────────────────────────────────┘
|
|
24
|
+
│ spawns (parallel)
|
|
25
|
+
┌──────────┼──────────────┬─────────────────┐
|
|
26
|
+
▼ ▼ ▼ ▼
|
|
27
|
+
┌────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐
|
|
28
|
+
│Structure│ │ Pattern │ │Dependency│ │ Tech │
|
|
29
|
+
│Scanner │ │ Detector │ │ Mapper │ │ Profiler │
|
|
30
|
+
└────────┘ └──────────┘ └──────────┘ └──────────────┘
|
|
31
|
+
│ │ │ │
|
|
32
|
+
▼ ▼ ▼ ▼
|
|
33
|
+
┌─────────────────────────────────────────────────────┐
|
|
34
|
+
│ SYNTHESIZER (orchestrator) │
|
|
35
|
+
│ • Reads all agent outputs │
|
|
36
|
+
│ • Creates project-profile.json │
|
|
37
|
+
│ • Generates analysis-report.md │
|
|
38
|
+
└─────────────────────────────────────────────────────┘
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Execution Phases
|
|
42
|
+
|
|
43
|
+
### Phase 0: Initialize
|
|
44
|
+
- Parse `$ARGUMENTS` for target path, flags, and parameters
|
|
45
|
+
- If no path provided, default to the current working directory
|
|
46
|
+
- Verify the target directory exists (fail fast if it does not)
|
|
47
|
+
- Determine analysis depth from `--depth` flag (default: `standard`)
|
|
48
|
+
- Determine focus area from `--focus` flag (default: `all`)
|
|
49
|
+
- Determine output directory from `--output` flag (default: `.dev-analysis`)
|
|
50
|
+
- Create the output directory if it does not exist
|
|
51
|
+
- Write parsed config to `{output}/config.json`
|
|
52
|
+
|
|
53
|
+
### Phase 1: Parallel Analysis (Subagents)
|
|
54
|
+
Dispatch subagents based on the `--depth` setting. All eligible agents run **in parallel** to maximize throughput.
|
|
55
|
+
|
|
56
|
+
**Depth: quick** (fastest — 2 agents)
|
|
57
|
+
```
|
|
58
|
+
Task(subagent_type: "general-purpose", prompt: structure-scanner-agent.md)
|
|
59
|
+
Task(subagent_type: "general-purpose", prompt: tech-profiler-agent.md)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Depth: standard** (default — 4 agents)
|
|
63
|
+
```
|
|
64
|
+
Task(subagent_type: "general-purpose", prompt: structure-scanner-agent.md)
|
|
65
|
+
Task(subagent_type: "general-purpose", prompt: pattern-detector-agent.md)
|
|
66
|
+
Task(subagent_type: "general-purpose", prompt: dependency-mapper-agent.md)
|
|
67
|
+
Task(subagent_type: "general-purpose", prompt: tech-profiler-agent.md)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Depth: deep** (comprehensive — 4 agents with expanded scope)
|
|
71
|
+
All 4 agents run with expanded analysis. Instruct each agent to:
|
|
72
|
+
- Increase sample sizes (e.g., pattern detector samples 20-25 files instead of 10-15)
|
|
73
|
+
- Include secondary analysis (e.g., dependency mapper also maps internal import graphs)
|
|
74
|
+
- Report on edge cases and anomalies
|
|
75
|
+
|
|
76
|
+
**Focus filtering**: When `--focus` is not `all`, still run all depth-eligible agents but instruct the orchestrator synthesis (Phase 2) to emphasize the requested focus area in the final report.
|
|
77
|
+
|
|
78
|
+
Each subagent writes its output to the `{output}/` directory:
|
|
79
|
+
|
|
80
|
+
| Agent | Output File |
|
|
81
|
+
|-------|------------|
|
|
82
|
+
| Structure Scanner | `{output}/structure.md` |
|
|
83
|
+
| Pattern Detector | `{output}/conventions.md` |
|
|
84
|
+
| Dependency Mapper | `{output}/dependencies.md` |
|
|
85
|
+
| Tech Profiler | `{output}/project-profile.json` |
|
|
86
|
+
|
|
87
|
+
### Phase 2: Synthesize
|
|
88
|
+
The orchestrator reads all agent output files and creates:
|
|
89
|
+
|
|
90
|
+
1. **`{output}/project-profile.json`** — Unified structured profile (merge tech profiler output with summaries from other agents):
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"project_name": "detected or directory name",
|
|
94
|
+
"analyzed_at": "ISO timestamp",
|
|
95
|
+
"depth": "quick|standard|deep",
|
|
96
|
+
"tech_stack": {
|
|
97
|
+
"languages": [],
|
|
98
|
+
"frameworks": [],
|
|
99
|
+
"runtime": "",
|
|
100
|
+
"package_manager": ""
|
|
101
|
+
},
|
|
102
|
+
"build": {
|
|
103
|
+
"bundler": "",
|
|
104
|
+
"test_framework": "",
|
|
105
|
+
"linting": [],
|
|
106
|
+
"ci_cd": ""
|
|
107
|
+
},
|
|
108
|
+
"structure": {
|
|
109
|
+
"organization_pattern": "",
|
|
110
|
+
"total_files": 0,
|
|
111
|
+
"files_by_language": {},
|
|
112
|
+
"entry_points": [],
|
|
113
|
+
"test_directories": [],
|
|
114
|
+
"config_files": []
|
|
115
|
+
},
|
|
116
|
+
"conventions": {
|
|
117
|
+
"file_naming": "",
|
|
118
|
+
"function_naming": "",
|
|
119
|
+
"import_style": "",
|
|
120
|
+
"error_handling": "",
|
|
121
|
+
"architecture_pattern": ""
|
|
122
|
+
},
|
|
123
|
+
"dependencies": {
|
|
124
|
+
"total": 0,
|
|
125
|
+
"by_category": {},
|
|
126
|
+
"risks": []
|
|
127
|
+
},
|
|
128
|
+
"risks": [],
|
|
129
|
+
"recommendations": []
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
2. **`{output}/analysis-report.md`** — Human-readable report summarizing all findings with sections for structure, patterns, dependencies, tech stack, risks, and recommendations.
|
|
134
|
+
|
|
135
|
+
### Phase 3: Report
|
|
136
|
+
Present a summary to the user with key findings:
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
→ Codebase Analysis Complete: {project_name}
|
|
140
|
+
Depth: {depth} | Files: {total_files} | Languages: {languages}
|
|
141
|
+
|
|
142
|
+
Tech Stack: {runtime} + {framework} | {package_manager}
|
|
143
|
+
Build: {bundler} | Tests: {test_framework} | Lint: {linters}
|
|
144
|
+
Architecture: {architecture_pattern} | Organization: {org_pattern}
|
|
145
|
+
|
|
146
|
+
Risks Found: {risk_count}
|
|
147
|
+
{risk_1}
|
|
148
|
+
{risk_2}
|
|
149
|
+
...
|
|
150
|
+
|
|
151
|
+
Output: {output}/
|
|
152
|
+
├── analysis-report.md (human-readable report)
|
|
153
|
+
├── project-profile.json (structured profile)
|
|
154
|
+
├── structure.md (directory analysis)
|
|
155
|
+
├── conventions.md (patterns & conventions)
|
|
156
|
+
└── dependencies.md (dependency analysis)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Parameters
|
|
160
|
+
|
|
161
|
+
| Parameter | Description | Default |
|
|
162
|
+
|-----------|-------------|---------|
|
|
163
|
+
| `path` | Target directory to analyze | Current working directory |
|
|
164
|
+
| `--depth` | Analysis depth: `quick`, `standard`, `deep` | `standard` |
|
|
165
|
+
| `--output` | Output directory for analysis results | `.dev-analysis` |
|
|
166
|
+
| `--focus` | Focus area: `patterns`, `dependencies`, `risks`, `all` | `all` |
|
|
167
|
+
|
|
168
|
+
## Subagent Prompt Templates
|
|
169
|
+
|
|
170
|
+
Each subagent has a detailed prompt template in the `agents/` directory. Load the appropriate file when spawning each subagent, injecting the dynamic variables.
|
|
171
|
+
|
|
172
|
+
| Agent | Prompt File | Key Variables |
|
|
173
|
+
|-------|-------------|---------------|
|
|
174
|
+
| Structure Scanner | [agents/structure-scanner-agent.md](agents/structure-scanner-agent.md) | target_path, depth, output_dir |
|
|
175
|
+
| Pattern Detector | [agents/pattern-detector-agent.md](agents/pattern-detector-agent.md) | target_path, depth, output_dir |
|
|
176
|
+
| Dependency Mapper | [agents/dependency-mapper-agent.md](agents/dependency-mapper-agent.md) | target_path, depth, output_dir |
|
|
177
|
+
| Tech Profiler | [agents/tech-profiler-agent.md](agents/tech-profiler-agent.md) | target_path, depth, output_dir |
|
|
178
|
+
|
|
179
|
+
## State Management (Scratchpad Pattern)
|
|
180
|
+
|
|
181
|
+
All intermediate work is written to the output directory:
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
{output}/
|
|
185
|
+
├── config.json # Parsed arguments and settings
|
|
186
|
+
├── structure.md # Structure scanner output
|
|
187
|
+
├── conventions.md # Pattern detector output
|
|
188
|
+
├── dependencies.md # Dependency mapper output
|
|
189
|
+
├── project-profile.json # Tech profiler output → merged unified profile
|
|
190
|
+
└── analysis-report.md # Final human-readable report
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
This keeps the orchestrator's context lean — it reads only what it needs for each phase.
|
|
194
|
+
|
|
195
|
+
## Error Handling
|
|
196
|
+
|
|
197
|
+
- If a subagent fails, log the error and continue with remaining agents
|
|
198
|
+
- Structure scanner failure → report what other agents found, note incomplete structure data
|
|
199
|
+
- Pattern detector failure → report "conventions not analyzed" in profile
|
|
200
|
+
- Dependency mapper failure → report "dependencies not analyzed" in profile
|
|
201
|
+
- Tech profiler failure → attempt basic detection from file extensions and config files
|
|
202
|
+
- Always produce a `project-profile.json` and `analysis-report.md`, even if partial
|
|
203
|
+
- Never block the entire pipeline on a single agent failure
|
|
204
|
+
|
|
205
|
+
## Context Management
|
|
206
|
+
|
|
207
|
+
### Context Regurgitation
|
|
208
|
+
Before dispatching each subagent, include in its prompt:
|
|
209
|
+
- The target path and depth setting
|
|
210
|
+
- The output directory where it should write results
|
|
211
|
+
- Any relevant config from Phase 0 parsing
|
|
212
|
+
|
|
213
|
+
### File Buffering
|
|
214
|
+
All subagent outputs go to `{output}/` files — never pass raw subagent output directly into the next prompt. Read only the specific file sections needed for synthesis. This keeps the orchestrator's active context lean.
|
|
215
|
+
|
|
216
|
+
## Integration with Other Skills
|
|
217
|
+
|
|
218
|
+
This skill produces output that other MyAIDev skills can consume:
|
|
219
|
+
|
|
220
|
+
- **myaidev-architect**: Reads `project-profile.json` to understand existing stack before designing new architecture
|
|
221
|
+
- **myaidev-coder**: Reads `conventions.md` to match existing code patterns
|
|
222
|
+
- **myaidev-debug**: Reads `dependencies.md` and `structure.md` for faster bug investigation
|
|
223
|
+
- **myaidev-reviewer**: Uses `conventions.md` as a baseline for code review standards
|
|
224
|
+
|
|
225
|
+
## Example Usage
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
# Analyze current project with default settings
|
|
229
|
+
/myaidev-method:myaidev-analyze .
|
|
230
|
+
|
|
231
|
+
# Quick scan of a specific directory
|
|
232
|
+
/myaidev-method:myaidev-analyze ./backend --depth=quick
|
|
233
|
+
|
|
234
|
+
# Deep analysis focused on risks
|
|
235
|
+
/myaidev-method:myaidev-analyze /path/to/project --depth=deep --focus=risks
|
|
236
|
+
|
|
237
|
+
# Custom output directory
|
|
238
|
+
/myaidev-method:myaidev-analyze . --output=./docs/analysis
|
|
239
|
+
|
|
240
|
+
# Analyze before starting work on an unfamiliar codebase
|
|
241
|
+
/myaidev-method:myaidev-analyze /path/to/inherited-project --depth=deep
|
|
242
|
+
```
|
|
@@ -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
|
+
```
|