Loading...
Loading...
Apply SPARC methodology (Specification, Pseudocode, Architecture, Refinement, Completion) for systematic development. Use for feature development, TDD workflows, and structured problem-solving.
npx skill4agent add vamseeachanta/workspace-hub sparc-workflowSystematic software development through Specification, Pseudocode, Architecture, Refinement (TDD), and Completion phases.
# Run full SPARC development cycle
# Run TDD-focused workflow
# List available SPARC modes.agent-os/┌─────────────────────────────────────────────────────────────────┐
│ S → P → A → R → C │
│ │
│ Specification → Pseudocode → Architecture → Refinement → Done │
└─────────────────────────────────────────────────────────────────┘| Phase | Focus | Output |
|---|---|---|
| Specification | What to build | Requirements document |
| Pseudocode | How it works | Algorithm design |
| Architecture | How it fits | System design |
| Refinement | Make it work | Tested implementation |
| Completion | Make it right | Production-ready code |
# Feature Specification
## Overview
[One paragraph describing the feature]
## Requirements
### Functional Requirements
1. FR-1: [Requirement]
2. FR-2: [Requirement]
3. FR-3: [Requirement]
### Non-Functional Requirements
1. NFR-1: Performance - [Requirement]
2. NFR-2: Security - [Requirement]
3. NFR-3: Usability - [Requirement]
## Scope
### In Scope
- [Item 1]
- [Item 2]
### Out of Scope
- [Item 1]
- [Item 2]
## Acceptance Criteria
- [ ] AC-1: [Testable criterion]
- [ ] AC-2: [Testable criterion]
- [ ] AC-3: [Testable criterion]
## Constraints
- [Technical constraint]
- [Business constraint]
## Assumptions
- [Assumption 1]
- [Assumption 2]FUNCTION process_data(input_data):
// Validate input
IF input_data is empty:
RAISE ValidationError("Input cannot be empty")
// Initialize result
result = EMPTY_LIST
// Process each item
FOR EACH item IN input_data:
// Check conditions
IF item.meets_criteria():
processed_item = transform(item)
APPEND processed_item TO result
RETURN result
FUNCTION transform(item):
// Apply transformation logic
new_value = item.value * MULTIPLIER
RETURN Item(new_value, item.metadata)# Pseudocode Design
## Main Algorithm
\`\`\`
FUNCTION main_feature(params):
[Algorithm steps]
\`\`\`
## Helper Functions
\`\`\`
FUNCTION helper_one(input):
[Steps]
FUNCTION helper_two(input):
[Steps]
\`\`\`
## Error Handling
\`\`\`
TRY:
[Main logic]
CATCH ValidationError:
[Handle validation]
CATCH ProcessingError:
[Handle processing]
FINALLY:
[Cleanup]
\`\`\`
## Edge Cases
| Case | Input | Expected Output |
|------|-------|-----------------|
| Empty | [] | [] |
| Single | [1] | [processed_1] |
| Maximum | [1..10000] | [processed_all] |
## Complexity Analysis
- Time: O(n)
- Space: O(n)## Component Design
### New Components
- ComponentA: [Purpose]
- ComponentB: [Purpose]
### Modified Components
- ExistingComponent: [Changes needed]
## Interface Design
\`\`\`python
class IProcessor(Protocol):
def process(self, data: InputData) -> OutputData:
"""Process input and return output."""
...
def validate(self, data: InputData) -> bool:
"""Validate input data."""
...
\`\`\`
## Data Flow
\`\`\`
Input → Validator → Processor → Transformer → Output
↓ ↓
Logger Cache
\`\`\`
## Dependencies
### Internal
- module_a (version ≥ 1.2.0)
- module_b
### External
- library_x (version 2.0.0)
## File Structure
\`\`\`
src/
└── feature_name/
├── __init__.py
├── processor.py # Main processing logic
├── validator.py # Input validation
├── transformer.py # Data transformation
└── models.py # Data models
\`\`\`┌──────────────┐
│ 1. RED │ Write failing test
└──────┬───────┘
│
▼
┌──────────────┐
│ 2. GREEN │ Write minimal code to pass
└──────┬───────┘
│
▼
┌──────────────┐
│ 3. REFACTOR │ Improve code quality
└──────┬───────┘
│
└──────────► Repeatdef test_process_valid_input():
"""Test processing with valid input."""
processor = Processor()
result = processor.process([1, 2, 3])
assert result == [2, 4, 6]pytest tests/test_processor.py -v
# Expected: FAILEDclass Processor:
def process(self, data):
return [x * 2 for x in data]pytest tests/test_processor.py -v
# Expected: PASSEDclass Processor:
def __init__(self, multiplier: int = 2):
self.multiplier = multiplier
def process(self, data: List[int]) -> List[int]:
return [x * self.multiplier for x in data]# Unit Tests
class TestProcessor:
def test_process_valid_input(self):
"""Test with valid input."""
...
def test_process_empty_input(self):
"""Test with empty input."""
...
def test_process_invalid_input(self):
"""Test with invalid input raises error."""
...
# Integration Tests
class TestProcessorIntegration:
def test_end_to_end_workflow(self):
"""Test complete workflow."""
...
# Performance Tests
class TestProcessorPerformance:
def test_large_dataset_performance(self):
"""Test performance with large dataset."""
...## Code Quality
- [ ] All tests passing
- [ ] Test coverage ≥ 80%
- [ ] No linting errors
- [ ] Type hints complete
- [ ] Docstrings complete
## Documentation
- [ ] README updated
- [ ] API documentation
- [ ] Usage examples
- [ ] Changelog entry
## Security
- [ ] Input validation
- [ ] Error messages safe
- [ ] No hardcoded secrets
- [ ] Dependencies audited
## Performance
- [ ] Benchmarks run
- [ ] Memory usage checked
- [ ] No N+1 queries
- [ ] Caching implemented (if needed)
## Deployment
- [ ] Configuration documented
- [ ] Migration scripts (if needed)
- [ ] Rollback plan
- [ ] Monitoring in placeundefined| Mode | Focus |
|---|---|
| Full development cycle |
| API development |
| UI development |
| Testing focus |
| Code improvement |
undefined.agent-os/
├── specs/
│ └── feature-name/
│ ├── spec.md # Specification
│ ├── tasks.md # Task breakdown
│ └── sub-specs/
│ ├── pseudocode.md # Pseudocode
│ ├── architecture.md # Architecture
│ ├── tests.md # Test spec
│ └── api-spec.md # API spec (if applicable)
└── product/
└── decisions.md # Decision log# Use the create-spec workflow
# Reference: @~/.agent-os/instructions/create-spec.md# Use the execute-tasks workflow
# Reference: @~/.agent-os/instructions/execute-tasks.md// Start SPARC mode
mode: "dev",
task_description: "Implement user authentication"
})
// Orchestrate tasks
task: "Complete SPARC refinement phase",
strategy: "sequential",
priority: "high"
})