test-driven-development

Enforce a RED-GREEN-REFACTOR loop with pytest for Python projects.

Updated May 4, 2026
One-click install
npx skills add https://github.com/JamesFincher/gengar --skill test-driven-development-jamesfincher
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/JamesFincher/gengar/tree/main/skills/software-development/test-driven-development
Command: npx skills add https://github.com/JamesFincher/gengar --skill test-driven-development-jamesfincher

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the problem of shipping unverified code by enforcing test-first development so behavior is specified, validated, and protected against regressions.

Core Features & Use Cases

  • Test-first discipline (RED-GREEN-REFACTOR): Write a minimal failing test, verify it fails, implement the smallest change to pass, then refactor safely.
  • Verification as a requirement: Mandates re-running the specific test to confirm the failure and the pass, followed by the full suite to catch regressions.
  • Common anti-pattern detection: Helps you avoid testing mocks instead of real behavior, relying on happy-path only, and writing brittle tests that break on refactors.
  • When to apply TDD: New features, bug fixes, refactors, and behavior changes—while prompting exceptions only for user-approved cases like throwaway prototypes.
  • Delegate and systematic debugging integration: Guides subagent task instructions and converts found bugs into failing tests that prove the fix.

Quick Start

Ask the assistant to help you write the first failing pytest for the behavior you want, then guide you through the exact next steps to make it fail for the right reason and pass with the minimal code change.

Frequently Asked Questions about test-driven-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I start test-driven development in Python using pytest?

Start test-driven development by writing a minimal failing pytest that specifies desired behavior, verify it fails for the expected reason, implement the smallest code change to pass, then refactor safely.

What is the RED-GREEN-REFACTOR loop in TDD?

The RED-GREEN-REFACTOR loop is a test-driven development cycle where you write a failing test, implement minimal code to pass it, and refactor without changing behavior to prevent regressions.

How does TDD integrate with systematic debugging workflows?

TDD integrates with systematic debugging by converting found bugs into failing tests that prove the fix, ensuring behavior is specified and validated before shipping code.

Can I use test-driven development for refactoring existing Python code?

Yes, test-driven development applies to refactoring existing Python code by mandating re-running the full test suite to catch regressions and ensure behavior remains unchanged.

When should I not use test-driven development?

Test-driven development should be skipped for user-approved exceptions like throwaway prototypes, as it forbids production code without a failing test to specify behavior.

How do I avoid common anti-patterns when writing pytest tests?

Avoid common pytest anti-patterns by testing real behavior instead of mocks, avoiding happy-path only tests, and preventing brittle tests that break during refactoring.