Skip to content
Back to skills

Tdd Workflow

ASecurity

Test-driven development enforcement with RED-GREEN-IMPROVE cycle

  • 22 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 22, 2026
toolsgobashrefactoring

Security analysis

A100/100

Scanned November 22, 2026

npx -y skills add mshadmanrahman/pm-pilot --skill tdd-workflow --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Tdd Workflow?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Tdd Workflow
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mshadmanrahman-tdd-workflow/badge)](https://www.skillsdirectory.com/skills/mshadmanrahman-tdd-workflow)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: tdd-workflow
description: Test-driven development enforcement with RED-GREEN-IMPROVE cycle
origin: pm-pilot
version: 1.0.0
triggers:
  - writing new features
  - fixing bugs
  - refactoring code
  - tdd
---

# TDD Workflow

Detailed test-driven development procedure with framework-specific commands.

**Relationship to tdd-guide agent**: The `/tdd` command dispatches the `tdd-guide` agent, which enforces the loop. This skill provides the detailed procedure and framework-specific commands that the agent references.

## When to Use

- Referenced by tdd-guide agent during enforcement
- Directly when user needs framework-specific test commands
- Any new feature, bug fix, or refactoring that needs test coverage

## Procedure

### Phase 1: RED (Write Failing Test)

1. Identify the behavior to implement
2. Write the test that describes expected behavior
3. Run the test: it MUST fail
4. If it passes, the test is wrong or the feature already exists

```bash
# Framework detection
jest --testPathPattern={test_file} 2>/dev/null || \
pytest {test_file} 2>/dev/null || \
go test -run {test_name} ./... 2>/dev/null || \
mvn test -Dtest={test_class} 2>/dev/null
```

### Phase 2: GREEN (Minimal Implementation)

1. Write the minimum code to make the test pass
2. No extra features, no premature optimization
3. Run the test: it MUST pass
4. If it fails, fix the implementation (not the test)

### Phase 3: IMPROVE (Refactor)

1. Clean up implementation while keeping tests green
2. Extract functions, rename variables, remove duplication
3. Run full test suite after each change
4. Verify no regressions

### Phase 4: COVERAGE

1. Check coverage meets 80% minimum:
   ```bash
   jest --coverage 2>/dev/null || \
   pytest --cov={module} 2>/dev/null || \
   go test -coverprofile=cover.out ./... 2>/dev/null
   ```
2. If below 80%, identify uncovered paths and add tests
3. Focus on branch coverage, not just line coverage

## Output Format

```
TDD Cycle: {feature name}
RED:   Test written - {test file}:{test name} - FAILS as expected
GREEN: Implementation - {impl file} - Test PASSES
IMPROVE: Refactored {what changed}
Coverage: {percent}% ({above/below} 80% target)
```

## Rules

- NEVER write implementation before a failing test
- NEVER modify tests to make them pass (fix the implementation)
- Each cycle should be small: one behavior per cycle
- Run the full suite after GREEN phase to catch regressions
- If coverage is below 80%, do not mark task as complete
- Log test failures clearly with file, line, and error message

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in tools →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.