Back to skills
SkillHub ClubShip Full StackFull StackTesting

test-first

Test-Driven Development (TDD Red-Green-Refactor)

Packaged view

This page reorganizes the original catalog entry around fit, installability, and workflow context first. The original raw source lives below.

Stars
13
Hot score
85
Updated
March 20, 2026
Overall rating
C2.0
Composite score
2.0
Best-practice grade
B81.2

Install command

npx @skill-hub/cli install claude-world-director-mode-lite-test-first

Repository

claude-world/director-mode-lite

Skill path: skills/test-first

Test-Driven Development (TDD Red-Green-Refactor)

Open repository

Best for

Primary workflow: Ship Full Stack.

Technical facets: Full Stack, Testing.

Target audience: everyone.

License: Unknown.

Original source

Catalog source: SkillHub Club.

Repository owner: claude-world.

This is still a mirrored public skill entry. Review the repository before installing into production workflows.

What it helps with

  • Install test-first into Claude Code, Codex CLI, Gemini CLI, or OpenCode workflows
  • Review https://github.com/claude-world/director-mode-lite before adding test-first to shared team environments
  • Use test-first for development workflows

Works across

Claude CodeCodex CLIGemini CLIOpenCode

Favorites: 0.

Sub-skills: 0.

Aggregator: No.

Original source / Raw SKILL.md

---
name: test-first
description: Test-Driven Development (TDD Red-Green-Refactor)
user-invocable: true
---

# Test-Driven Development

Implement TDD for: $ARGUMENTS

## Quick Steps
1. Write a failing test
2. Run test, confirm failure
3. Write minimal code to pass
4. Refactor while keeping tests green
5. 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
```typescript
// 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.
test-first | SkillHub