tdd

Enforce the RED-GREEN-REFACTOR cycle for software development tasks.

Updated Dec 22, 2024
One-click install
npx skills add https://github.com/lvstb/nix-config --skill tdd-lvstb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/lvstb/nix-config/tree/main/home/opencode/skills/tdd
Command: npx skills add https://github.com/lvstb/nix-config --skill tdd-lvstb

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enforces a rigorous Test-Driven Development (TDD) process to ensure code quality, prevent regressions, and build robust software by catching bugs early.

Core Features & Use Cases

  • Enforces RED-GREEN-REFACTOR: Guides users through writing a failing test, minimal code to pass, and then refactoring.
  • Prevents Regressions: Ensures new code doesn't break existing functionality.
  • Improves Code Design: Encourages writing testable, modular code.
  • Use Case: When developing a new user authentication feature, use this Skill to write tests for login, logout, and password reset before writing any implementation code.

Quick Start

Use the tdd skill to implement the 'user login' feature by writing a failing test first.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I implement test-driven development to prevent code regressions?

Test-driven development prevents regressions by enforcing the RED-GREEN-REFACTOR cycle: writing a failing test first, writing minimal code to pass, and then refactoring. This ensures new code never breaks existing functionality.

What is the RED-GREEN-REFACTOR cycle in software development?

The RED-GREEN-REFACTOR cycle is a testing protocol where you write a failing test, implement minimal production code to make it pass, and then refactor the code. This methodology ensures robust software design and catches bugs early.

How to write tests before implementation code for new features?

To write tests before implementation, start by defining feature requirements as failing tests, then write the minimal code required to pass those tests, and finally refactor for code quality. This strict testing protocol applies to all new feature development.

Can I use test-driven development for bug fixes and refactoring tasks?

Yes, test-driven development is fully applicable to bug fixes and refactoring tasks. You write a failing test that reproduces the bug or verifies the refactored behavior before modifying any production code to ensure code quality.

Does test-driven development improve code design and modularity?

Test-driven development improves code design by enforcing strict testing protocols that require you to write testable, modular code. This commitment to writing failing tests first naturally encourages highly decoupled and robust software architectures.

When should I not use strict testing protocols for software development?

Strict testing protocols require a commitment to writing failing tests before any production code. You should anticipate this overhead for new features, bug fixes, and refactoring tasks where achieving immediate testable and modular code design is critical.