Skip to content

Isurwars/Correlation / .agents/skills/tdd

Test-driven development (Red-Green-Refactor) and self-correcting build-test loop. Use when implementing new functionality, writing tests before code, or iterating on test failures.

Test-Driven Development (TDD) Loop

Automated build → diagnose → fix → retest loop for the Correlation C++ and Python suites using CMake, Google Test, and pytest.

Phase 1: Build Target & Test Selection

Select the appropriate build target or test suite based on the scope of changes:

Changed FilesTarget / SuiteExecution Command
src/calculators/**, src/core/**, src/readers/**, src/writers/**, src/analysis/**, src/math/**, include/**correlation_unit_testsctest --test-dir build -R correlation_unit_tests --output-on-failure
tests/functional/**correlation_functional_testsctest --test-dir build -R correlation_functional_tests --output-on-failure
ui/**/*.slint, src/app/**correlation_gui_testsctest --test-dir build -R correlation_gui_tests --output-on-failure
src/bindings/**, python/**Python Bindings Suite.venv/bin/pytest tests/test_*.py
Multiple scopes or uncertainBuild all C++ targetscmake --build build -j$(nproc) && ctest --test-dir build --output-on-failure

Phase 2: The Self-Correction Compilation Loop

  1. Build:

    cmake --build build --target <target> -j$(nproc)
    
  2. On Build Failure:

    • Parse first compiler error only (cascading errors are symptoms).
    • Use [File:Line] -> [Error Type] -> [Fix Action] diagnostic format.
    • For syntax/type errors: navigate to exact file/line and fix.
    • For linker errors: inspect CMakeLists.txt target linkage.
    • For Slint generation errors: check .slint syntax and property types.
  3. Loop Limit: Stop and alert the user after 3 consecutive failures on the same root cause.

Phase 3: Test Execution & Verification

Once the build compiles with 0 errors:

  1. Execute: Run the compiled test binary or test runner.
  2. On Test Failure:
    • Parse Google Test / pytest output for FAILED assertions.
    • Fix the source code, not the test (unless the test logic is fundamentally incorrect).
    • Re-run only the failing test suite, not the entire battery.
  3. Final Verification:
    • Re-run the full target test once all individual failures are resolved.
    • Confirm [ PASSED ] with zero failures before declaring completion.

Phase 4: Post-Verification Cleanup

  1. Run clang-format -i on all modified .cpp/.hpp files.
  2. Run graphify update . if source files were added, renamed, or modified.
  3. Present final success state with test count summary.
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 321kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 321kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 321kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 197kUpdated Claude CodeCodexVerifiedInstall