Skip to content
Development
Skill

/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 plugin
director-mode-lite
8036 skills14 agents6 hooks

Claude Code

$ npx -y skills add claude-world/director-mode-lite --skill test-first --agent claude-code

SKILL.md

test-first.SKILL.md
name: test-first
description: 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.
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

// auth/login.test.ts
it('should return JWT token for valid credentials', async () => {
  const res = await request(app)
    .post('/auth/login')
    .send({ email: 'test@example.com', 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.

Read more
@claude-world
Ships withdirector-mode-lite

Use Claude Code like a Director, not a Programmer. MIT toolkit with Auto-Loop, guided setup, 27 commands, 14 agents, and 32 skills.

8036 skills14 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
80
Star history of claude-world/director-mode-lite on GitHub, a chart by star-history.com

Other skills on director-mode-lite.

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills2w309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react5d252k
@facebook@facebookInstall Skill

Questions about test-first.

Which coding agents can use test-first?
test-first installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.