# Test First

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

- **Type:** Skill
- **Install:** `agentstack add skill-claude-world-director-mode-lite-test-first`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [claude-world](https://agentstack.voostack.com/s/claude-world)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [claude-world](https://github.com/claude-world)
- **Source:** https://github.com/claude-world/director-mode-lite/tree/main/skills/test-first
- **Website:** https://claude-world.com

## Install

```sh
agentstack add skill-claude-world-director-mode-lite-test-first
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# 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: '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.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [claude-world](https://github.com/claude-world)
- **Source:** [claude-world/director-mode-lite](https://github.com/claude-world/director-mode-lite)
- **License:** MIT
- **Homepage:** https://claude-world.com

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-claude-world-director-mode-lite-test-first
- Seller: https://agentstack.voostack.com/s/claude-world
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
