SPARC Methodology
Purpose
SPARC is a 5-phase structured development workflow that front-loads planning to prevent architectural drift and wasted implementation effort. It is the preferred approach for any task that touches 3+ files, introduces new abstractions, or has unclear acceptance criteria.
When to Trigger
- New feature implementation
- Complex multi-module refactoring
- API changes with tests
- Architectural changes (ADR required first)
- System redesign or integration work
- Unclear or ambiguous requirements
When to Skip
- Single-file edits or simple 1-2 line bug fixes
- Documentation updates
- Configuration changes
- Well-defined, small, contained tasks
The 5 Phases
Phase 1 — Specification
Define what must be built. No code yet.
- State the goal in one sentence.
- List acceptance criteria (testable, binary pass/fail).
- Identify constraints (performance, security, backwards-compat).
- Name the stakeholders and impacted components.
- Open a GitHub Issue (per
feedback_github_issues_before_dev).
Output: docs/specs/<feature>.md or inline in the Issue body.
Phase 2 — Pseudocode
Define how it works at a logical level. Still no production code.
- Write algorithm steps in plain language or pseudocode.
- Identify data structures, inputs, outputs.
- Flag uncertainty explicitly:
# QUESTION: is X assumption valid? - Validate against the Specification — every acceptance criterion must be addressed.
Output: Pseudocode block in the Issue or a scratch file under docs/specs/.
Phase 3 — Architecture
Design the system structure before touching existing code.
- Invoke the
architectskill (software/architecture/architect). - Map new components onto the Hexagonal Architecture (ports & adapters).
- Write or update the ADR if a new architectural decision is being made.
- Define interfaces and boundaries — no implementation details yet.
- Get peer review (use
code-revieweron the design doc).
Output: ADR in docs/adr/, updated architecture diagrams if needed.
Phase 4 — Refinement
Iterate on the design before committing to full implementation.
- Review the Architecture output with the
security-expertif security-sensitive. - Run the
refactor-complexityskill mentally on the proposed design. - Incorporate feedback — update the ADR if the decision changes.
- Resolve all
# QUESTION:flags from Pseudocode. - Confirm: does the architecture still satisfy all Specification criteria?
Output: Final, reviewed design. ADR status updated to Accepted.
Phase 5 — Completion
Implement, test, and close.
- Write implementation following the agreed architecture.
- Write tests first if using TDD (use
bdd-writerorcharacterization-tester). - Run the
code-reviewerskill on the final diff. - Ensure 100% test coverage for new starters (project quality gate).
- Invoke
learning-protocolto persist any non-obvious patterns discovered. - Close the GitHub Issue and link the PR.
Output: Merged PR with green CI.
Integration with Cornerstone Workflow
User Request
│
├── [simple?] → Skip SPARC → Implement directly
│
└── [complex?] → SPARC
│
├─ S: Specification → GitHub Issue
├─ P: Pseudocode → docs/specs/
├─ A: Architecture → ADR + architect skill
├─ R: Refinement → security-expert + code-reviewer
└─ C: Completion → Implementation + Tests + learning-protocol
Best Practices
- Never skip Specification — vague requirements cause wasted implementation.
- Never start Architecture before Pseudocode — missing the algorithm wastes design effort.
- ADR-first is non-negotiable for Phase 3 (Cornerstone universal rule).
- Use memory-first at the start of each phase:
retrieve_memoryfor prior patterns. - Store successful SPARC patterns:
store_memory(namespace="sparc-patterns").