TDD Refactor
Hierarchical TDD & Refactoring state machine with nested micro-cycles, regression detection, event bubbling, and live projections
Use the tdd-refactor skill to [describe your task].Install: npx skills add Reactive-Skills/skills --skill tdd-refactor
- States
- 11
- Hierarchical nodes
- Initial State
- INIT
- Bootstrap entrypoint
- Allowed Tools
- 4
- Whitelisted for safety
- Deliverables
- 2
- Automated projections
Statechart (optional)
Visual state machine topology parsed directly from the official STATECHART.md in Reactive-Skills/skills:
States & Deterministic Guards
Each state is an isolated operational slice. Transitions occur only when typed signals satisfy programmatic guard conditions.
- INITINITIAL
Bootloader: Verify reactive runtime environment
Outgoing Transitions
- RUNTIME_READYRED_SPEC
- SETUP_REQUIREDSETUP_RUNTIME
- SETUP_RUNTIMErun_command
Auto-configure harness MCP server
Outgoing Transitions
- SETUP_COMPLETERED_SPECguard:
payload.exit_code == 0 - SETUP_FAILEDERRORguard:
payload.exit_code != 0
- SETUP_COMPLETERED_SPECguard:
- RED_SPECview_filewrite_to_filereplace_file_contentrun_command
Author a strictly failing test specifying the new requirement
Outgoing Transitions
- TEST_RANGREEN_CODEguard:
event.payload.exit_code != 0
- TEST_RANGREEN_CODEguard:
- GREEN_CODEview_filewrite_to_filereplace_file_contentrun_command
Write minimal implementation code to turn the test suite green
Outgoing Transitions
- TEST_RANREFACTORguard:
event.payload.exit_code === 0
- TEST_RANREFACTORguard:
- REFACTOR
Composite state: Clean Code, Optimize Architecture, and Verify Invariants
Outgoing Transitions
- GLOBAL_ABORTRED_SPEC
- TEST_RANGREEN_CODEguard:
event.payload.exit_code != 0
- REFACTOR.CLEAN_CODEview_filewrite_to_filereplace_file_contentrun_command
Simplify naming, remove duplication, and extract deep helpers
Outgoing Transitions
- CLEANING_DONEREFACTOR.PERF_AUDIT
- REFACTOR.PERF_AUDITview_filewrite_to_filereplace_file_contentrun_command
Analyze complexity, eliminate unnecessary allocations and redundant I/O
Outgoing Transitions
- AUDIT_PASSEDAUDIT_VERIFY
- AUDIT_VERIFYrun_commandview_file
Run full verification suite, linter, and type checks
Outgoing Transitions
- ALL_CHECKS_PASSEDCOMPLETEDguard:
event.payload.exit_code === 0 - REGRESSION_DETECTEDGREEN_CODE
- ALL_CHECKS_PASSEDCOMPLETEDguard:
- COMPLETEDTERMINAL
TDD Refactor cycle finished successfully
- ERRORTERMINAL
Runtime setup failed
- BYPASS_DETECTEDTERMINAL
Terminal State: Bypass detected - Agent operated outside signal contract