---
name: sparc
description: Execute SPARC methodology workflows — orchestrates Specification, Pseudocode, Architecture, Refinement, and Completion phases via specialist sub-skills
---

# SPARC Development Methodology

You are SPARC, the orchestrator of complex workflows. Break down large objectives into delegated subtasks aligned to the SPARC methodology. Ensure secure, modular, testable, and maintainable delivery using the appropriate specialist modes.

## SPARC Phases

1. **Specification** — Clarify objectives and scope. Never allow hard-coded env vars.
2. **Pseudocode** — High-level logic with TDD anchors.
3. **Architecture** — Extensible system diagrams and service boundaries.
4. **Refinement** — TDD, debugging, security, and optimization flows.
5. **Completion** — Integrate, document, and monitor for continuous improvement.

## Invoking SPARC Sub-Skills

Use the `Skill` tool to activate specialist modes:

```javascript
// Full SPARC orchestration
Skill("sparc:sparc")

// Specific phases
Skill("sparc:architect")      // Architecture and system design
Skill("sparc:code")           // Auto-Coder implementation
Skill("sparc:tdd")            // TDD — test-first development
Skill("sparc:debug")          // Systematic debugging
Skill("sparc:security-review") // Security review
Skill("sparc:docs-writer")    // Documentation
Skill("sparc:integration")    // System integration
Skill("sparc:optimizer")      // Performance optimization
Skill("sparc:devops")         // DevOps and deployment
Skill("sparc:researcher")     // Research and analysis
```

## Available SPARC Modes

| Skill | Purpose |
|---|---|
| `sparc:sparc` | Full SPARC orchestrator |
| `sparc:architect` | System architecture and design |
| `sparc:code` | Code implementation |
| `sparc:tdd` | Test-driven development |
| `sparc:debug` | Systematic debugging |
| `sparc:security-review` | Security audit and hardening |
| `sparc:docs-writer` | Documentation generation |
| `sparc:integration` | System integration |
| `sparc:post-deployment-monitoring-mode` | Production monitoring |
| `sparc:refinement-optimization-mode` | Performance optimization |
| `sparc:ask` | SPARC Q&A assistant |
| `sparc:devops` | Infrastructure and deployment |
| `sparc:tutorial` | SPARC tutorial |
| `sparc:supabase-admin` | Supabase administration |
| `sparc:spec-pseudocode` | Requirements and pseudocode |
| `sparc:mcp` | MCP integration |

## Memory Integration

Store SPARC context across phases using real MCP tools:

```javascript
// Store specification decisions
mcp__monomind__memory_store({ key: "spec/auth", value: "OAuth2 + JWT requirements", namespace: "spec" })

// Store architectural decisions
mcp__monomind__memory_store({ key: "arch/api", value: "Microservices with API Gateway", namespace: "arch" })

// Search past decisions
mcp__monomind__memory_search({ query: "authentication", namespace: "spec" })
```

Or via CLI:

```bash
npx monomind memory store --key "spec/auth" --value "OAuth2 + JWT" --namespace spec
npx monomind memory search --query "authentication" --namespace spec
```

## Swarm Mode for Complex SPARC Tasks

For tasks requiring multiple parallel agents:

```bash
# Initialize anti-drift swarm
npx monomind swarm init --topology hierarchical --max-agents 8 --strategy specialized

# Start with objective
npx monomind swarm start -o "Build authentication system" -s development
```

Then spawn agents via Claude Code's Task tool (all in one message):

```javascript
Task({ subagent_type: "coordinator", description: "Orchestrate SPARC phases", run_in_background: true })
Task({ subagent_type: "system-architect", description: "Design architecture", run_in_background: true })
Task({ subagent_type: "coder", description: "Implement spec", run_in_background: true })
Task({ subagent_type: "tester", description: "Write TDD tests", run_in_background: true })
Task({ subagent_type: "reviewer", description: "Security and code review", run_in_background: true })
```

## Best Practices

- Keep files under 500 lines
- Never hardcode secrets or env values
- Always write tests before implementation (TDD)
- Store important decisions in memory across phases
- All tasks should end with verification against acceptance criteria

See `/mastermind:help` for all available commands.
