Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions dot_claude/rules/development-principles.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ alwaysApply: true

## Test-Driven Development

- Write tests first, then implementation
- Red → Green → Refactor cycle
- See `tdd.md` for detailed TDD rules

## Simplicity

Expand Down
34 changes: 34 additions & 0 deletions dot_claude/rules/tdd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
alwaysApply: true
---

# Test-Driven Development

## Red-Green-Refactor Cycle

1. **Red**: Write a failing test that describes the desired behavior
2. Confirm the test fails for the expected reason
3. **Green**: Write the minimal implementation to make the test pass
4. Confirm all tests pass
5. **Refactor**: Improve code quality while keeping tests green

## Rules

- Never write production code without a corresponding failing test
- One test = one behavior. Keep incremental steps small
- Run tests after each step; show Red before Green
- Do not skip the Red step — a test that has never failed proves nothing

## When Uncertain

- Ask the user about test location, framework, or naming conventions rather than guessing
- If multiple test patterns exist in the project, ask which to follow

## Exceptions

TDD does not apply to contexts without test frameworks:

- Dotfiles configuration and templates
- CI/CD pipeline definitions
- Shell scripts without a test harness
- Declarative config files (JSON, YAML, TOML)
Loading