tdd

Guide Red-Green-Refactor TDD workflows with test naming and AAA patterns.

1|1|Updated Nov 1, 2015
One-click install
npx skills add https://github.com/s4kr4/dotfiles --skill tdd-s4kr4
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/s4kr4/dotfiles/tree/main/.claude/skills/tdd
Command: npx skills add https://github.com/s4kr4/dotfiles --skill tdd-s4kr4

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TDD best practices provide a disciplined approach to software development by guiding teams to write tests before code, reducing defects and enabling safer refactoring.

Core Features & Use Cases

  • Define the Red-Green-Refactor lifecycle and enforce the three laws of TDD.
  • Offer language-agnostic guidelines plus language-specific examples (TypeScript/Jest, Python/pytest).
  • Outline practical workflows, tests naming conventions, and fixture patterns to accelerate delivery.

Quick Start

Begin by writing a failing test, run the test runner to confirm failure, implement the simplest code to pass, then refactor while keeping tests green.

Frequently Asked Questions about tdd

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

FAQPage Schema
What is test-driven development and how does the Red-Green-Refactor cycle work?

Test-driven development (TDD) is writing tests before code to reduce defects and enable safer refactoring. The Red-Green-Refactor cycle involves writing a failing test (red), implementing the simplest code to pass it (green), then refactoring while keeping tests green.

How do I apply TDD to TypeScript and Python projects?

Apply TDD using Jest for TypeScript and pytest for Python. Write failing unit tests first, run your test runner to confirm failure, implement minimal code to pass, then refactor. Both frameworks integrate with standard CI workflows.

What are TDD naming conventions and AAA patterns for writing better tests?

TDD naming conventions clarify test intent, while AAA patterns structure tests into Arrange (setup), Act (execute), and Assert (verify) sections. These practices accelerate delivery and maintain test readability across TypeScript and Python projects.

Can I use TDD without external tools beyond npm test or pytest?

Yes, TDD requires only standard test runners. npm test for TypeScript/Jest and pytest for Python are sufficient to implement Red-Green-Refactor guidance, test naming conventions, and fixture patterns without additional external dependencies.

Why should I refactor within TDD if my tests already pass?

Refactoring within TDD improves code maintainability and design while tests verify correctness. Keeping tests green during refactoring ensures changes don't introduce bugs, creating a disciplined development approach that reduces defects over time.

How do TDD's three laws enforce disciplined test-first development?

TDD's three laws ensure you write failing tests before code, write only enough code to pass tests, and refactor only when tests are green. This discipline prevents over-engineering and keeps implementation focused on requirements.