mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-03 15:43:31 +08:00
Revert "feat(ecc): prune plugin 43→12 items, promote 7 rules to .claude/rules/ (#245)"
This reverts commit 1bd68ff534.
This commit is contained in:
66
.opencode/commands/tdd.md
Normal file
66
.opencode/commands/tdd.md
Normal file
@@ -0,0 +1,66 @@
|
||||
---
|
||||
description: Enforce TDD workflow with 80%+ coverage
|
||||
agent: tdd-guide
|
||||
subtask: true
|
||||
---
|
||||
|
||||
# TDD Command
|
||||
|
||||
Implement the following using strict test-driven development: $ARGUMENTS
|
||||
|
||||
## TDD Cycle (MANDATORY)
|
||||
|
||||
```
|
||||
RED → GREEN → REFACTOR → REPEAT
|
||||
```
|
||||
|
||||
1. **RED**: Write a failing test FIRST
|
||||
2. **GREEN**: Write minimal code to pass the test
|
||||
3. **REFACTOR**: Improve code while keeping tests green
|
||||
4. **REPEAT**: Continue until feature complete
|
||||
|
||||
## Your Task
|
||||
|
||||
### Step 1: Define Interfaces (SCAFFOLD)
|
||||
- Define TypeScript interfaces for inputs/outputs
|
||||
- Create function signature with `throw new Error('Not implemented')`
|
||||
|
||||
### Step 2: Write Failing Tests (RED)
|
||||
- Write tests that exercise the interface
|
||||
- Include happy path, edge cases, and error conditions
|
||||
- Run tests - verify they FAIL
|
||||
|
||||
### Step 3: Implement Minimal Code (GREEN)
|
||||
- Write just enough code to make tests pass
|
||||
- No premature optimization
|
||||
- Run tests - verify they PASS
|
||||
|
||||
### Step 4: Refactor (IMPROVE)
|
||||
- Extract constants, improve naming
|
||||
- Remove duplication
|
||||
- Run tests - verify they still PASS
|
||||
|
||||
### Step 5: Check Coverage
|
||||
- Target: 80% minimum
|
||||
- 100% for critical business logic
|
||||
- Add more tests if needed
|
||||
|
||||
## Coverage Requirements
|
||||
|
||||
| Code Type | Minimum |
|
||||
|-----------|---------|
|
||||
| Standard code | 80% |
|
||||
| Financial calculations | 100% |
|
||||
| Authentication logic | 100% |
|
||||
| Security-critical code | 100% |
|
||||
|
||||
## Test Types to Include
|
||||
|
||||
- **Unit Tests**: Individual functions
|
||||
- **Edge Cases**: Empty, null, max values, boundaries
|
||||
- **Error Conditions**: Invalid inputs, network failures
|
||||
- **Integration Tests**: API endpoints, database operations
|
||||
|
||||
---
|
||||
|
||||
**MANDATORY**: Tests must be written BEFORE implementation. Never skip the RED phase.
|
||||
Reference in New Issue
Block a user