tdd

Implement a Test-Driven Development workflow with red-green-refactor cycles.

Updated Mar 22, 2026
One-click install
npx skills add https://github.com/shllg/night-orch --skill tdd-shllg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/shllg/night-orch/tree/main/.agents/skills/tdd
Command: npx skills add https://github.com/shllg/night-orch --skill tdd-shllg

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill unit provides a structured approach to Test-Driven Development (TDD), helping developers implement features or fix bugs while maintaining a robust test suite.

Core Features & Use Cases

  • Test-Driven Philosophy: Emphasizes testing public interfaces and observable behavior, promoting maintainable and refactor-friendly code.
  • Red-Green-Refactor Loop: Guides the user through writing failing tests, implementing minimal code to pass them, and refactoring the codebase.
  • Deep Modules: Encourages small, focused interfaces with deep implementation, improving testability and modularity.
  • Interface Design: Offers guidelines for designing interfaces that are easy to test and maintain.
  • Mocking Best Practices: Provides guidance on when and how to use mocking effectively.
  • Refactoring Candidates: Suggests common refactoring opportunities after each TDD cycle.

Quick Start

Use the tdd skill to initiate a TDD cycle for a new feature in your project.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I implement test-first development to improve software design?

Test-first development is implemented using a structured Red-Green-Refactor loop: write a failing test for public interfaces, implement minimal code to pass it, then refactor the codebase for maintainability and modularity.

What is the best way to structure tests for observable behavior?

Structure tests for observable behavior by targeting public interfaces and designing small, focused modules. This encourages deep modules with hidden implementation details, improving overall testability and refactor-friendly code.

How do I use mocking effectively during a TDD cycle?

Use mocking effectively during a TDD cycle by applying best practices that isolate external dependencies. Mocking should focus on verifying interactions with public interfaces while maintaining observable behavior without coupling tests to internal code.

When should I refactor code in test-driven development?

Refactor code immediately after the test passes in the Red-Green-Refactor loop. The TDD workflow suggests evaluating common refactoring candidates after each cycle to ensure the codebase maintains high software design quality and modularity.

Does test-driven development work for fixing bugs and adding new features?

Yes, test-driven development works for both fixing bugs and implementing new features. It provides a structured workflow that maintains a robust test suite, ensuring code quality and maintainability across all development scenarios.

Why does test-first development emphasize deep modules?

Test-first development emphasizes deep modules because they provide small, focused interfaces with deep implementation. This separation improves testability, ensures observable behavior is clearly defined, and makes the software design more maintainable.