Skip to content
Testing & Qualityv2.0.8(schema v2.1.0)

TDD Refactor

Strict HSM

Hierarchical TDD & Refactoring state machine with nested micro-cycles, regression detection, event bubbling, and live projections

Registry Repository: Reactive-Skills/skillsView on GitHub
Ask your agent
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:

TDD Refactor (stateDiagram-v2)
Rendering statechart...

States & Deterministic Guards

Each state is an isolated operational slice. Transitions occur only when typed signals satisfy programmatic guard conditions.

  1. INITINITIAL

    Bootloader: Verify reactive runtime environment

    Outgoing Transitions

    • RUNTIME_READYRED_SPEC
    • SETUP_REQUIREDSETUP_RUNTIME
  2. SETUP_RUNTIME
    run_command

    Auto-configure harness MCP server

    Outgoing Transitions

    • SETUP_COMPLETERED_SPECguard: payload.exit_code == 0
    • SETUP_FAILEDERRORguard: payload.exit_code != 0
  3. RED_SPEC
    view_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
  4. GREEN_CODE
    view_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
  5. REFACTOR

    Composite state: Clean Code, Optimize Architecture, and Verify Invariants

    Outgoing Transitions

    • GLOBAL_ABORTRED_SPEC
    • TEST_RANGREEN_CODEguard: event.payload.exit_code != 0
  6. REFACTOR.CLEAN_CODE
    view_filewrite_to_filereplace_file_contentrun_command

    Simplify naming, remove duplication, and extract deep helpers

    Outgoing Transitions

    • CLEANING_DONEREFACTOR.PERF_AUDIT
  7. REFACTOR.PERF_AUDIT
    view_filewrite_to_filereplace_file_contentrun_command

    Analyze complexity, eliminate unnecessary allocations and redundant I/O

    Outgoing Transitions

    • AUDIT_PASSEDAUDIT_VERIFY
  8. AUDIT_VERIFY
    run_commandview_file

    Run full verification suite, linter, and type checks

    Outgoing Transitions

    • ALL_CHECKS_PASSEDCOMPLETEDguard: event.payload.exit_code === 0
    • REGRESSION_DETECTEDGREEN_CODE
  9. COMPLETEDTERMINAL

    TDD Refactor cycle finished successfully

  10. ERRORTERMINAL

    Runtime setup failed

  11. BYPASS_DETECTEDTERMINAL

    Terminal State: Bypass detected - Agent operated outside signal contract