This document outlines the structured development workflow that ensures quality, consistency, and efficiency when using Claude for software development projects.
Our workflow is built on three fundamental principles:
- Context-Before-Code: Always understand the full context before implementing
- Test-First Development: Tests illuminate the path; they don't define the destination
- Persona-Driven Development: Distinct roles with enforced transitions ensure quality at every stage
Purpose: Planning, context gathering, and task management
Responsibilities:
- Gather context through systematic searches
- Create detailed task specifications
- Define acceptance criteria
- Maintain project documentation
- Ensure architectural alignment
Key Actions:
- Search for existing specs/implementations
- Document findings explicitly
- Create interface contracts for integrations
- Hand off to QA with complete requirements
Purpose: Test design and validation
Responsibilities:
- Design comprehensive test suites BEFORE implementation
- Independently verify all specifications
- Validate completed implementations
- Ensure code quality standards
Key Actions:
- Write tests that fail first (no implementation yet)
- Create validation tests for data structures
- Verify interfaces and contracts
- Run quality checks (mypy, black, ruff)
Purpose: Implementation based on tests and specifications
Responsibilities:
- Implement features to satisfy test requirements
- Follow established patterns and conventions
- Write clean, maintainable code
- Use defensive programming patterns
Key Actions:
- Review test suite before coding
- Implement using Red → Green cycle
- Avoid deep attribute access
- Document technical decisions
Purpose: Root cause analysis and debugging
Responsibilities:
- Systematic investigation of issues
- Evidence-based debugging
- Detailed documentation of findings
- Propose targeted fixes
Key Actions:
- Create minimal reproducible test cases
- Analyze logs and execution traces
- Document root causes with evidence
- Test hypotheses systematically
The workflow enforces specific transitions between personas:
PM → QA → DEV → QA → PM (Standard flow)
ANY → TROUBLESHOOT (When issues arise)
TROUBLESHOOT → DEV (For fixes)
TROUBLESHOOT → PM (For architectural changes)
Forbidden Transitions:
- DEV → PM (must go through QA)
- PM → DEV (must go through QA)
- Starting implementation without tests
- Committing without QA validation
# Search for existing specifications
grep -r "<feature_name>" *.md **/*.md
# Check for spec files
ls -la *SPEC* *spec* *DESIGN* *design*
# Search in code for existing implementations
grep -r "<feature_name>" --include="*.py"
- Write validation tests for data structures FIRST
- Create unit tests for component behavior
- Add integration tests for system interactions
- Include edge case and error tests
- Verify all tests FAIL before implementation
- Review test suite thoroughly
- Implement to satisfy test requirements
- Use defensive access patterns
- Run tests iteratively (Red → Green)
- Ensure all tests pass
- Run comprehensive test suite
- Check implementation quality
- Run code quality tools
- Look for gaps tests might have missed
- Approve or request fixes
Always verify understanding before implementing:
- Found spec? Document where and what it defines
- No spec? Explicitly state "No existing spec found"
- Ambiguous? STOP and ask for clarification
# AVOID: Deep attribute access
drive = agent.mindstone.profile.drive # Fragile!
# PREFER: Defensive access with fallbacks
def get_agent_drive(self, agent: Any) -> str:
if hasattr(agent, 'drive'):
return agent.drive
# Try common paths with fallbacks
for path in ['mindstone.profile.drive', 'profile.drive']:
try:
obj = agent
for attr in path.split('.'):
obj = getattr(obj, attr)
return obj
except AttributeError:
continue
return 'NEUTRAL' # Safe default
For component integrations, document:
- EXPECTS: What inputs the component needs
- PROVIDES: What outputs it produces
- GOTCHAS: Common integration failures
- Validation Tests: Data integrity and schema validation
- Unit Tests: Component behavior in isolation
- Integration Contract Tests: Interface verification
- Integration Tests: Component interactions
- Edge Case Tests: Boundary conditions
- Error Tests: Failure scenarios
Clear handoffs between personas:
PM → QA: "Here's the task with acceptance criteria..."
QA → DEV: "Test suite complete with X tests..."
DEV → QA: "Implementation complete, all tests passing..."
QA → PM: "Validation complete, quality checks passed..."
- Prevents Bugs: Catch issues before they're coded
- Ensures Quality: Multiple validation checkpoints
- Maintains Consistency: Enforced patterns and standards
- Enables Refactoring: Comprehensive test coverage
- Documents Behavior: Tests as living documentation
- Reduces Rework: Build the right thing first time
Always declare your current persona before any action:
## [PERSONA: PM] - [Task ID] - [Action]
## [PERSONA: QA] - [Task ID] - Test Design
## [PERSONA: DEV] - [Task ID] - Implementation
## [PERSONA: TROUBLESHOOT] - [Issue] - Root Cause Analysis
This structured approach ensures:
- Quality: Through test-first development
- Efficiency: Through clear role separation
- Consistency: Through enforced workflows
- Reliability: Through systematic validation
By following these practices, development becomes predictable, maintainable, and less error-prone. The key is discipline in following the workflow—no shortcuts, no skipping steps.