Agent skill
forge-tdd
Enforces test-driven development workflow for Claude Code. Implements Red-Green-Refactor cycle with configurable gates. Use when writing code, implementing features, or fixing bugs.
Install this agent skill to your Project
npx add-skill https://github.com/martimramos/claude-forge/tree/main/skills/tdd
SKILL.md
Test-Driven Development Workflow
The Cycle
┌─────────────────────────────────────────────────┐
│ RED → GREEN → REFACTOR → DOCUMENT → COMMIT │
└─────────────────────────────────────────────────┘
Phase 1: RED (Write Failing Test)
- Understand the requirement
- Write a test that describes expected behavior
- Run the test - it MUST fail
- If test passes, the test is wrong or feature exists
Phase 2: GREEN (Minimal Implementation)
- Write the minimum code to pass the test
- Run the test - it MUST pass
- Do not optimize, do not refactor yet
Phase 3: REFACTOR (Improve)
- Clean up the implementation
- Run tests after each change
- Tests must stay green throughout
Phase 4: DOCUMENT (If Tests Pass)
- Update docstrings/comments
- Update README if public API changed
- Only document after tests pass
Phase 5: COMMIT
- Stage changes
- Write descriptive commit message
- Tests must pass before commit
Gate Enforcement
Mode: {{TDD_GATE}}
Soft Gate (default)
- Warn if tests fail
- Allow proceeding with user acknowledgment
- Log warning in output
Hard Gate
- Block all progress until tests pass
- No exceptions
- Must fix tests before any other action
Validation
Run before committing:
~/.claude/skills/tdd/scripts/check-tests.sh
Check current gate status:
~/.claude/skills/tdd/scripts/gate-status.sh
Checklist
Copy and track progress:
TDD Progress:
- [ ] Requirement understood
- [ ] Failing test written
- [ ] Test fails for right reason
- [ ] Minimal implementation done
- [ ] Test passes
- [ ] Code refactored
- [ ] All tests still pass
- [ ] Documentation updated
- [ ] Ready to commit
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
forge-lang-c
C development standards including make, gcc/clang, valgrind, and cppcheck. Use when working with C files, Makefiles, or CMakeLists.txt.
forge-lang-terragrunt
Terragrunt wrapper for Terraform with DRY configurations. Enforces plan-before-apply workflow. Use when working with terragrunt.hcl files.
forge-lang-cpp
C++ development standards including make/cmake, g++/clang++, and static analysis. Use when working with C++ files (.cpp, .hpp, .cc, .hh).
forge-lang-rust
Rust development standards including cargo test, clippy, and rustfmt. Use when working with Rust files, Cargo.toml, or Rust tests.
forge-lang-ansible
Ansible automation safety practices. Enforces check-mode-first workflow. Use when working with playbooks, roles, or inventory files.
forge-lang-typescript
TypeScript development standards including type checking, jest/vitest, eslint, and prettier. Use when working with TypeScript files, tsconfig.json, or .ts/.tsx files.
Didn't find tool you were looking for?