Test first
Drive one feature through a strict TDD Red-Green-Refactor cycle with checklists for each phase. Use when implementing new functionality test-first, or when the user runs /test-first.From its SKILL.md
npx -y skills add claude-world/director-mode-lite --skill test-firstAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
SKILL.md
1.8 KB, 398 tokens by cl100k_base, as published. Nobody here has run it
Test-Driven Development
Implement TDD for: $ARGUMENTS
Quick Steps
- Write a failing test
- Run test, confirm failure
- Write minimal code to pass
- Refactor while keeping tests green
- Repeat
Red Phase - Write Failing Test
Test Design Principles
- Test one specific behavior
- Test name describes expected result
- Test should fail (feature doesn't exist yet)
Must Test
- Normal case
- Edge cases
- Error cases
- Invalid input
Example
// auth/login.test.ts
it('should return JWT token for valid credentials', async () => {
const res = await request(app)
.post('/auth/login')
.send({ email: '[email protected]', password: 'password123' })
expect(res.status).toBe(200)
expect(res.body.token).toBeDefined()
})
Green Phase - Minimal Implementation
Implementation Principles
- Write ONLY enough code to pass the test
- Don't optimize yet
- Don't worry about elegance
- Just make it work
Refactor Phase - Clean Up
Refactoring Checklist
- Is there code duplication?
- Are variable names clear?
- Are functions too long?
- Is the logic too complex?
Refactoring Rules
- Keep tests passing
- Change one thing at a time
- Run tests frequently
Test Quality Checklist
- Unit tests cover core logic
- Integration tests cover interactions
- Test names clearly describe intent
- Tests are independent and repeatable
- Tests run fast (unit tests < 100ms)
- Edge cases are covered
Follow TDD strictly. No shortcuts.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.
Gives 4 of the 12 instructions most tdd skills give in 398 tokens
Counted across 594 of the 695 authors here whose files we hold, read 2026-09-06
- Write minimal code to pass the testhere, and in 356 of 594, across 332 files
- Write a failing test before writing production codehere, and in 240 of 594, across 221 files
- Refactor code only after tests passin 184 of 594, across 169 files
- Refactor code while keeping tests greenhere, and in 140 of 594, across 133 files
- Verify the test fails for the expected reasonin 133 of 594, across 121 files
- Run tests after each refactor stepin 108 of 594, across 102 files
- Use real code instead of mocks whenever possiblein 97 of 594, across 85 files
- Reproduce bugs with a failing test before fixingin 90 of 594, across 81 files
- Write tests before implementing codein 88 of 594, across 70 files
- Verify the test passes after writing codein 71 of 594, across 61 files
- Write one test for one behaviorhere, and in 71 of 594, across 63 files
- Run the full test suitein 63 of 594, across 56 files
Said here and by no other author read
- Cover normal edge and error cases
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.