tdd

Guide developers through the red-green-refactor cycle for building features and fixing bugs.

240|75|Updated Jul 13, 2023
One-click install
npx skills add https://github.com/udecode/plate-playground-template --skill tdd-udecode
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/udecode/plate-playground-template/tree/main/.codex/skills/tdd
Command: npx skills add https://github.com/udecode/plate-playground-template --skill tdd-udecode

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers build features and fix bugs using a structured Test-Driven Development (TDD) approach, ensuring code quality and maintainability through a red-green-refactor loop.

Core Features & Use Cases

  • Red-Green-Refactor Loop: Guides the development process through writing failing tests, implementing minimal code to pass, and then refactoring.
  • Integration-Style Tests: Emphasizes testing through public interfaces, making tests resilient to internal code changes.
  • Mocking Strategy: Provides clear guidelines on when and how to mock dependencies, focusing on system boundaries.
  • Type Testing: Integrates compile-time type assertions for enhanced safety and regression detection.
  • Use Case: When starting a new feature, use this Skill to define the expected behavior with tests first, then write the code to satisfy those tests, leading to more reliable and well-documented software.

Quick Start

Use the tdd skill to guide the development of a new user authentication module following the red-green-refactor cycle.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I implement the red-green-refactor cycle when building new features?▼

The red-green-refactor cycle starts by writing a failing test, implementing minimal code to pass it, and then refactoring. This structured test-driven development approach ensures code quality and maintainability.

What is the best way to write integration tests that survive internal code changes?▼

Integration-style tests survive internal changes by testing through public interfaces. This makes tests resilient to refactoring while verifying expected behavior without coupling to internal implementation details.

When should I mock dependencies during test-driven development?▼

Mock dependencies during test-driven development specifically at system boundaries. This strategy isolates external interactions, providing clear guidelines on when and how to mock without over-mocking internal code.

Can I use compile-time type testing for regression detection?▼

Compile-time type testing provides enhanced safety by integrating type assertions. It catches regressions early during the test-driven development process, ensuring interface design remains testable and robust.

Does test-driven development work for fixing bugs in existing software?▼

Test-driven development works for fixing bugs by first writing a failing test that reproduces the bug, implementing the fix to turn it green, and refactoring to ensure robust software behavior.