devflow-tdd-enforcerlisted
Install: claude install-skill aiskillstore/marketplace
# DevFlow TDD Enforcer
## Purpose
Enforce Test-First Development (TDD) order by preventing users from marking implementation tasks complete before their corresponding test tasks.
**Trigger**: PreToolUse hook when editing `devflow/requirements/**/TASKS.md`
## Enforcement Rule
**Source**: Extracted from planner agent's TDD mandate + Constitution Article VI
### ❌ BLOCKED Pattern (Violation)
```markdown
- [x] **T010** [US1] Implement user registration endpoint
- [ ] **T011** [US1] Test user registration with valid data
```
**Problem**: Implementation marked done BEFORE test
**Regex Pattern**: `\[x\].*Implementation.*\n.*\[ \].*Test`
### ✅ CORRECT Pattern (TDD Sequence)
```markdown
- [ ] **T010** [US1] Test user registration with valid data (write FAILING test)
- [ ] **T011** [US1] Implement user registration endpoint (make test PASS)
```
**Or after completion**:
```markdown
- [x] **T010** [US1] Test user registration with valid data
- [x] **T011** [US1] Implement user registration endpoint
```
## Blocking Message
When violation detected, PreToolUse hook returns **exit code 2** (blocks file save):
```
⚠️ BLOCKED - TDD Violation Detected
📋 REQUIRED ACTION:
1. Re-order TASKS.md to follow TDD sequence
2. Mark test tasks [x] BEFORE implementation tasks
3. Review Constitution Article VI - Test-First Development
Reason: CC-DevFlow enforces TDD (Tests First → Implementation)
Source: planner agent mandate + Constitution Article VI
File: {file_path}
Current Issue:
Line {N}