Guides the Red-Green-Refactor testing cycle to ensure high-quality, fully covered Python code.

Install

mkdir -p .claude/skills/tdd-dirkste && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/15938" && unzip -o skill.zip -d .claude/skills/tdd-dirkste && rm skill.zip

Installs to .claude/skills/tdd-dirkste

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

tdd — an agent skill by dirkste.
32 chars · catalog descriptionno explicit “when” trigger
Intermediate

Key capabilities

  • Analyze user requests to write failing tests
  • Implement minimal code to make tests pass
  • Optimize code for readability and PEP 8 compliance
  • Ensure 100% code coverage with `pytest --cov`
  • Follow naming conventions for tests
  • Include docstrings for new functions

How it works

The skill automates the Red-Green-Refactor cycle by first writing a failing test, then implementing minimal code to pass the test, and finally refactoring while maintaining test success and 100% coverage.

Inputs & outputs

You give it
user request for a new feature or bug fix
You get back
failing tests, minimal passing code, refactored code, and 100% test coverage

When to use tdd

  • Implementing new features via TDD
  • Ensuring test coverage
  • Refactoring code safely

About this skill

Python TDD Practitioner

Description: Automates the Red-Green-Refactor cycle with strict coverage enforcement.

Metadata

  • ID: python-tdd
  • Version: 1.0.0
  • Context: Python, pytest, pytest-cov

Instructions

  1. Red Phase:
    • Analyze the user's request.
    • Write a failing test in the ests/ directory.
    • Run pytest to confirm failure (exit code != 0).
  2. Green Phase:
    • Implement the minimal code in the source file.
    • Run pytest to confirm success (exit code 0).
  3. Refactor Phase:
    • Optimize for readability and PEP 8.
    • Ensure tests stay green.

Definition of Done (DoD)

  • All tests pass.
  • Code Coverage is 100% (use pytest --cov).
  • Naming follows est_should_[action]when[condition].
  • Docstrings included for new functions.

When not to use it

  • When not using Python for development
  • When not adhering to the Test-Driven Development (TDD) cycle
  • When not using `pytest` or `pytest-cov`

Prerequisites

Pythonpytestpytest-cov

Limitations

  • Specific to Python projects
  • Requires `pytest` and `pytest-cov` for execution and coverage checks
  • Enforces strict naming conventions for tests

How it compares

This workflow strictly enforces the TDD cycle with coverage requirements, providing a disciplined and automated approach to development that ensures code quality and testability from the outset, unlike traditional development.

Compared to similar skills

tdd side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
tdd (this skill)05moNo flagsIntermediate
migrate15moReviewIntermediate
agent-implementer-sparc-coder16moReviewIntermediate
tdd-migrate17moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry