Test first

From claude-world/director-mode-lite · View interactive version

Test first is an AI agent skill from the GitHub repository claude-world/director-mode-lite. 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.

How to use this skill

Skill file

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

Must Test

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


Refactor Phase - Clean Up

Refactoring Checklist

Refactoring Rules


Test Quality Checklist


Follow TDD strictly. No shortcuts.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.