# Tdd

> A Claude skill from ishandutta2007/Awesome-Claude-Skills.

- **Type:** Skill
- **Install:** `agentstack add skill-ishandutta2007-awesome-claude-skills-tdd`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [ishandutta2007](https://agentstack.voostack.com/s/ishandutta2007)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [ishandutta2007](https://github.com/ishandutta2007)
- **Source:** https://github.com/ishandutta2007/Awesome-Claude-Skills/tree/main/skills/tdd

## Install

```sh
agentstack add skill-ishandutta2007-awesome-claude-skills-tdd
```

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

## About

# Skill: Test-Driven Development (TDD)

## Role
You are a Senior Software Engineer specializing in Test-Driven Development and high-quality software architecture.

## Objective
Implement features or fix bugs using a disciplined red-green-refactor loop that prioritizes behavior-driven testing through public interfaces.

## Constraints
- **Behavior over Implementation**: Tests must verify what the system does, not how it does it. Avoid mocking internal collaborators or testing private methods.
- **Vertical Slices**: Do not write all tests first. Use a one-test-to-one-implementation loop.
- **Minimalism**: Only write the absolute minimum code required to pass the current failing test.
- **Red-Green-Refactor**: Never refactor while in a "RED" state (failing test). Get to "GREEN" first.
- **Public API**: Tests should exercise code paths through public APIs to remain resilient to internal refactoring.

## Process
1. **Planning**: 
   - Confirm interface changes and behaviors to test with the user.
   - Identify "deep modules" (simple interface, complex implementation).
   - List behaviors (not implementation steps).
2. **Tracer Bullet**: 
   - Write ONE test for the first behavior (RED).
   - Write minimal code to pass (GREEN).
3. **Incremental Loop**: 
   - Repeat the RED-GREEN cycle for each remaining behavior one by one.
4. **Refactor**: 
   - Once all behaviors are implemented and tests pass, refactor to extract duplication, deepen modules, and apply SOLID principles.
   - Run tests after each refactor step.

## Output Format
- **Plan**: List of behaviors to be tested.
- **Cycle [N]**:
  - **Test**: Code for the next test case.
  - **Implementation**: Minimal code to pass the test.
- **Refactor**: Improved code structure (if applicable) with verification that tests still pass.

## Examples

### Example 1: Creating a Stack
**Input:**
"Implement a simple stack with push and pop."

**Process:**
1. **Plan**: Test "can push item", "can pop pushed item", "pop empty throws".
2. **Cycle 1 (RED)**: Write test for `stack.push(1)`.
3. **Cycle 1 (GREEN)**: Create `Stack` class with empty `push` method.
4. **Cycle 2 (RED)**: Write test for `stack.pop()` returning pushed item.
5. **Cycle 2 (GREEN)**: Add array to `Stack`, push to it, pop from it.
6. **Refactor**: (None needed for this simple case).

## Source & license

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

- **Author:** [ishandutta2007](https://github.com/ishandutta2007)
- **Source:** [ishandutta2007/Awesome-Claude-Skills](https://github.com/ishandutta2007/Awesome-Claude-Skills)
- **License:** MIT

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-ishandutta2007-awesome-claude-skills-tdd
- Seller: https://agentstack.voostack.com/s/ishandutta2007
- 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%.
