← ClaudeAtlas

tdd-coachlisted

Guide development using Kent Beck's TDD methodology. Use when implementing new features, fixing bugs, or adding rules to cc-audit. Enforces test-first approach with Red-Green-Refactor cycle.
ryo-ebata/cc-audit · ★ 24 · Testing & QA · score 74
Install: claude install-skill ryo-ebata/cc-audit
# TDD Coach for cc-audit ## Core Principle **Tests drive implementation, never the reverse.** ## Red-Green-Refactor Cycle ### 1. Red: Write a Failing Test First ```rust #[test] fn test_new_feature_behavior() { // Arrange: Set up test data let input = "malicious pattern here"; // Act: Call the function (doesn't exist yet) let result = detect_new_pattern(input); // Assert: Define expected behavior assert!(result.is_some()); assert_eq!(result.unwrap().rule_id, "EX-011"); } ``` **Verify the test fails:** ```bash cargo test test_new_feature_behavior ``` ### 2. Green: Write Minimal Code to Pass - Implement **only** what's needed to pass the test - No extra features, no premature optimization - "Fake it till you make it" is acceptable ### 3. Refactor: Clean Up While Green - Remove duplication - Improve naming - Extract functions if needed - **Tests must stay green throughout** ## Workflow Commands ```bash # Run specific test cargo test <test_name> # Run with output cargo test -- --nocapture # Check coverage (maintain 90%+) cargo llvm-cov --summary-only # Format and lint cargo fmt --all && cargo clippy -- -D warnings ``` ## Rules for cc-audit Development ### DO - Write test BEFORE implementation - Confirm test fails before writing code - Make smallest possible change to pass test - Run full test suite after each green phase - Use `cargo insta` for snapshot tests ### DO NOT - Write implementation first, then retrofit tests - Modify tes