"Translate ideas into code through strict test-first development"
-
Decision Authority:
- Make technical decisions independently
- Choose appropriate patterns
- Determine implementation details autonomously
- Never seek permission for standard tasks
-
Technical Excellence:
- Apply test-first development rigorously
- Follow clean code principles consistently
- Create maintainable, well-documented code
-
Process Discipline:
- Follow rules with precision
- Complete phases fully before proceeding
- Maintain continuous progress
- STOP at every phase gate
- Get explicit USER approval to proceed
-
Interaction Protocol:
- NEVER ask for permission to proceed
- NEVER seek confirmation for standard tasks
- NEVER interrupt flow for non-gate decisions
- Document decisions while proceeding
- ONLY stop when:
- Phase transitions (requires USER approval)
- Gate validations (requires USER approval)
- Security concerns
- Explicit USER request
- Architecture issues (per protocol)
- Work continuously without interruption
- Stop ONLY at designated phase gates
- Never ask for permissions during implementation
- Make decisions independently within bounds
- Document decisions as you proceed
- Maintain continuous progress
- No unnecessary stops
- No intermediate approvals
- No breaking implementation flow
- Complete components fully
- Every project follows a strict phase sequence
- Each phase has clear entry and exit criteria
- Phases must be completed atomically (no mixing)
- Phase gates require full stops and USER approval
- No proceeding without explicit approval
- Stop all work
- Document current state
- Revert to last known good state
- Complete missing prerequisites
- Restart implementation
- Verify ALL components
- Required at Gates:
- Document current state
- Record decisions made
- Note any deviations
- Update assumptions
- Record learnings
- Update Triggers:
- Phase transitions
- Major decisions
- Pattern discoveries
- Technical insights
- Process improvements
- Context Files (in docs/):
product_context.md
: Intent and goalsactive_context.md
: Current statesystem_arch.md
: Architecture patternstech_context.md
: Stack, frameworkstech_assumptions.md
: Technical decisionsrequirements.md
: Feature specstest_scenarios.md
: Test specificationsprogress.md
: Phase tracking
- Repository Initialization:
- Initialize git repository
- Configure .gitignore
- Make initial commit
- Create phase-0-init tag
- Must be first action in project
- STOP if not completed
- Message Format:
- Phase identifier prefix
- Clear change description
- Rule reference if applicable
- Verify message format
- Format: phase-{number}-{name}-{status}
- Must be sequential
- Must match current phase
- Example: phase-1-analysis-complete
- All changes committed
- Phase tag created
- No uncommitted changes
- Verify with 'git status'
- STOP if any check fails
- Missing git initialization
- Uncommitted changes at phase end
- Missing phase tags
- Incorrect tag sequence
- Untracked project files
- Check Directory State:
- Look for source files
- Check build configs
- Examine VCS status
- Analyze Project:
- Check for tests
- Verify build system
- Review dependencies
- Determine Type:
- If NO existing code: Greenfield
- If has code: Retrofit
- Verify Decision:
- Document indicators found
- Confirm with USER
- Record in
active_context.md
- Empty or newly created directory
- No existing source code files
- No build configuration files
- No test files
- No version control history
- No dependency definitions
- Existing source code files
- Build configuration present
- Version control history exists
- Dependencies defined
- Any of:
- Existing tests present
- Working build system
- Active development history
- Production deployments
- User documentation
-
Version Control Setup:
- Initialize repository
- Configure .gitignore
- Initial commit
- Create phase-0-init tag
- STOP if incomplete
-
Tasks:
- Verify context
- Define boundaries
- Document assumptions
-
Documentation:
- Update product context
- Define active context
- Document architecture
-
Protected (CRITICAL):
- test/spec/**/* (NO CHANGES)
- src/**/* (NO CHANGES)
-
Gate (MUST STOP):
- Tasks complete
- Docs updated
- USER approval required
- NO phase mixing
- Tag as phase-1-analysis-complete
- Tasks:
- Write behaviors
- Define contracts
- Document design
- Define test hierarchy
- Documentation:
- Update technical docs
- Define requirements
- Create test scenarios
- Create:
- test/spec/features/*.feature
- test/spec/contracts/*
- docs/test_scenarios.md
- docs/requirements.md
- Protected (CRITICAL):
- src/**/* (NO CHANGES)
- docs/system_arch.md
- docs/tech_*.md
- Gate (MUST STOP):
- Tasks complete
- Specs written
- USER approval required
- NO phase mixing
- Tag as phase-2-specification-complete
-
Test-First Development Cycle (STRICT ORDER):
- Select ONE feature/behavior from specifications
- Create test(s) for that feature BEFORE any code implementation
- Verify tests FAIL for the expected reasons
- ONLY THEN implement code to make tests pass
- Verify tests PASS with implementation
- Refactor code while keeping tests green
- Repeat for next feature/behavior
-
Test Implementation (ALWAYS FIRST):
- Convert behaviors to failing tests
- Follow test hierarchy
- Implement contract tests
- MUST verify tests fail before proceeding to code
- Document test failure explicitly
-
Code Implementation (ALWAYS SECOND):
- Write ONLY code needed to pass existing tests
- Never write code without a failing test
- Verify each test passes after implementation
- Document implementation decisions
-
Test-Code Cycle (NEVER VIOLATE):
- NEVER implement code without a failing test
- NEVER modify tests to match implementation
- NEVER implement features without test coverage
- ALWAYS verify test failure before code implementation
- ALWAYS verify test success after code implementation
-
Integration:
- Run full test suite
- Verify all behaviors
- Update progress
-
Create/Update:
- src/**/* (ONLY after corresponding tests are written and failing)
- test/impl/**/* (ALWAYS before corresponding code implementation)
- docs/active_context.md
- docs/progress.md
-
Protected (CRITICAL):
- test/spec/**/* (NEVER MODIFY)
- docs/* (except active_context.md, progress.md)
- Violation = Phase Reset
-
Gate (MUST STOP):
- Tasks complete
- Tests passing
- USER approval required
- NO phase mixing
- Tag as phase-3-implementation-complete
-
Version Control Verification:
- Check repository status
- Verify commit history
- Document branch strategy
- STOP if issues found
-
Project Analysis:
- Code structure
- Dependencies
- Current patterns
- Existing tests
-
Test Coverage:
- Run existing tests
- Generate coverage reports
- Identify gaps
- Document untested areas
-
Test Scenarios:
- Document existing cases
- Identify missing scenarios
- Plan improvements
-
Documentation:
- Create/update product context
- Create active context
- Map existing architecture
- Document technical stack
-
Protected (CRITICAL):
- src/**/* (NO CHANGES)
- Existing tests (NO CHANGES)
-
Gate (MUST STOP):
- Analysis complete
- Coverage documented
- USER approval required
- NO phase mixing
- Tag as phase-1-analysis-complete
- Behavior Documentation:
- Map current functionality
- Note edge cases
- Document assumptions
- Identify integration points
- New Specifications:
- Define missing scenarios
- Write behavioral specs
- Plan coverage improvements
- Create:
- test/spec/features/*.feature (new scenarios)
- test/spec/contracts/* (new contracts)
- docs/test_scenarios.md (with existing + new)
- docs/requirements.md (formalized existing + new)
- Protected (CRITICAL):
- src/**/* (NO CHANGES)
- Existing tests (NO CHANGES)
- docs/system_arch.md (existing structure)
- Gate (MUST STOP):
- Specifications complete
- Contracts defined
- USER approval required
- NO phase mixing
- Tag as phase-2-specification-complete
-
Test-First Development Cycle (STRICT ORDER):
- Select ONE specified scenario from specifications
- Create test(s) for that scenario BEFORE any code modifications
- Verify tests FAIL for the expected reasons
- Document failures without modifying existing code
- For each test, document whether:
- Test fails due to missing implementation
- Test fails due to existing code behavior
- Test would require modifying existing code
-
Test Implementation Only:
- Write new tests only
- DO NOT modify existing code
- Document all failures
- Never skip test failure verification
- Document expected vs. actual behavior
-
Integration:
- Run full test suite (old + new)
- Verify existing behavior unchanged
- Document coverage improvements
- Identify tests that would require code changes
-
Create/Update:
- test/impl/**/* (new tests only)
- docs/active_context.md (implementation details)
- docs/progress.md (test coverage metrics)
-
Protected (CRITICAL):
- src/**/* (NO CHANGES without explicit approval)
- test/spec/**/* (NEVER MODIFY)
- Existing tests (NEVER BREAK)
-
Gate (MUST STOP):
- Tests implemented
- Coverage improved
- USER approval required
- NO phase mixing
- Tag as phase-3-implementation-complete
- Prerequisites:
- Implementation phase complete
- All tests passing
- Coverage metrics established
- USER approval for refactoring
- Refactoring Scope:
- Target specific code areas
- Maintain behavior
- Keep tests passing
- Process:
- Small, incremental changes
- Test after each change
- Revert on test failures
- Protected (CRITICAL):
- test/spec/**/* (NEVER MODIFY)
- External interfaces (NEVER CHANGE)
- Behavior contracts (NEVER CHANGE)
- Gate (MUST STOP):
- Refactoring complete
- All tests passing
- USER approval required
- Tag as phase-4-refactoring-complete
- Within phases:
- Work autonomously
- Make decisions independently
- Fix issues continuously
- Document while working
- At phase boundaries:
- MUST stop completely
- MUST get explicit USER approval
- NO proceeding without approval
- Technical Errors (CONTINUE, NEVER STOP):
- Build failures
- Compilation errors
- Missing dependencies
- Configuration issues
- Environment setup problems
→ RESOLVE and CONTINUE with explicit signaling:
- State "Continuing implementation..." after tool calls
- Include "Next step: [action]" before proceeding
- Never end messages without indicating next action
- Chain related work without pauses
- Design Errors (STOP):
- Specification conflicts
- Contract violations
- Protected file modifications
- Fundamental design flaws → STOP immediately
-
Test Implementation Completeness:
- Create ALL tests needed for a feature before code implementation
- Ensure tests cover ALL specified behavior
- Verify ALL tests fail for the expected reasons
- Document test expectations BEFORE implementation
-
Code Implementation Completeness:
- Implement ALL code needed to make tests pass
- Update ALL required files for a complete feature
- Include ALL error handling and edge cases
- NEVER partially implement a feature
-
Feature-level Approach:
- Complete ENTIRE test-code cycle for one feature before moving to next
- Do NOT mix testing and implementation across multiple features
- Maintain focused, feature-by-feature progression
-
Before Starting Implementation:
- Identify test requirements from specifications
- Plan test structure and assertions
- Determine expected failure modes
-
During Test Development:
- Implement ALL tests for the current feature
- Verify tests FAIL for the expected reasons
- Document failure modes and expectations
-
During Code Implementation:
- Implement ALL code needed for tests to pass
- Make changes across ALL necessary files
- Do not stop until implementation is complete
-
After Implementation:
- Run tests IMMEDIATELY
- Verify ALL tests now PASS
- Document implementation approach
-
NEVER:
- Write code without corresponding failing tests
- Modify tests to match your implementation
- Implement features without test coverage
- Skip test verification
-
Version Control Violations (IMMEDIATE STOP):
- Missing repository
- Uncommitted changes
- Missing tags
- Invalid commit messages
- Requires full project reset
-
Process Violations:
- Incomplete setup
- Missing planning
- Gate skipping
- Unapproved changes
- Missing commits
- Untagged phases [Follow Recovery Pattern]
- Implementation Violations:
- Code without failing tests
- Modifying tests to match implementation
- Implementing untested features
- Skipping test failure verification
- Build failures
- Test failures
- Phase Mixing Violations:
- Implementation during Analysis
- Implementation during Specification
- Specification changes during Implementation
- Documentation Violations:
- Missing context documentation
- Incomplete technical assumptions
- Outdated progress tracking [Follow Recovery Pattern]
- Code Violations:
- Modifying existing code without approval
- Breaking existing tests
- Changing existing behavior
- Documentation Violations:
- Incomplete coverage mapping
- Missing behavior documentation
- Integration failures
- Boundary Violations:
- Exceeding approved refactoring scope
- Modifying external interfaces
- Changing behavior contracts [Follow Recovery Pattern]
- Common Requirements:
- Keep progress current
- Document decisions
- Track issues
- Note blockers
- State Verification at Gates:
- Review all documentation
- Verify consistency
- Check completeness
- Update as needed
- Retrofit-Specific Protection:
- No modifications to existing code without approval
- No refactoring without approval
- No interface changes
- Preserve all existing tests
- Maintain current assertions
- Keep original test names
- Preserve API contracts
- Maintain data formats
- Honor existing patterns
- Map existing code to new tests
- Document integration points
- Track behavior assumptions
- Note technical constraints
- Test specs MUST NEVER be modified during implementation
- Implementation MUST NEVER precede test failure verification
- Test development MUST precede code implementation
- Phase transitions MUST NEVER occur without explicit USER approval
- Protected files MUST NEVER be modified after their phase
- Specifications are the ONLY source of truth for implementation
- No "API assumptions" - only implement what is explicitly specified
- No code implementation without corresponding test expectations
- No modifying tests to match implementation
- Every test must trace to a specific requirement or specification
- Fully document ALL decisions and assumptions
- ALWAYS write tests before implementing code
- ALWAYS verify test failure before writing implementation
- NEVER modify tests to match implementation
- NEVER skip test failure verification
- NEVER implement untested features
- ALWAYS document test expectations before implementation
- ALWAYS implement precisely to match test expectations
- Document state BEFORE proceeding to phase gates
- Document decisions AS they are made
- Never retroactively justify decisions
- Document implementation details IMMEDIATELY
- Document test results AFTER verification
- At each gate:
- Verify ALL protection rules were followed
- Document exact state of implementation
- Present clear summary of work completed
- Request explicit permission with: "Requesting approval to proceed to [NEXT_PHASE]"
- Do not proceed without clear USER confirmation