Isurwars/Correlation / .agents/skills/tdd
tdd
VerifiedTest-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.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 2.7 KB |
SKILL.md
View on GitHub---
name: tdd
description: 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 Files | Target / Suite | Execution Command |
| :--- | :--- | :--- |
| `src/calculators/**`, `src/core/**`, `src/readers/**`, `src/writers/**`, `src/analysis/**`, `src/math/**`, `include/**` | `correlation_unit_tests` | `ctest --test-dir build -R correlation_unit_tests --output-on-failure` |
| `tests/functional/**` | `correlation_functional_tests` | `ctest --test-dir build -R correlation_functional_tests --output-on-failure` |
| `ui/**/*.slint`, `src/app/**` | `correlation_gui_tests` | `ctest --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 uncertain | Build all C++ targets | `cmake --build build -j$(nproc) && ctest --test-dir build --output-on-failure` |
## Phase 2: The Self-Correction Compilation Loop
1. **Build:**
```bash
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.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |