tdd-workflow

Guides users through the Test-Driven Development process with Red-Green-Refactor cycles.

1|Updated Jun 10, 2016
One-click install
npx skills add https://github.com/yykamei/dotfiles --skill tdd-workflow-yykamei
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd-workflow
Source: https://github.com/yykamei/dotfiles/tree/main/.config/opencode/skills/tdd-workflow
Command: npx skills add https://github.com/yykamei/dotfiles --skill tdd-workflow-yykamei

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a structured approach to software development by ensuring that code is written to fulfill specific, pre-defined tests, leading to more robust and reliable software.

Core Features & Use Cases

  • Test-Driven Development (TDD) Cycle: Guides users through the Red-Green-Refactor process.
  • Mocks and Stubs Guidance: Advises on when and how to use test doubles.
  • Best Practices: Enforces principles like single assertions per test, descriptive names, and Arrange-Act-Assert structure.
  • Use Case: A developer needs to implement a new user authentication feature. They will first write a test for the login success scenario, then write the minimal code to pass that test, and finally refactor the code while ensuring the test remains green.

Quick Start

Follow the TDD cycle to implement a new feature, starting with writing a failing test.

Frequently Asked Questions about tdd-workflow

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

FAQPage Schema
What is the Test-Driven Development cycle and how does it improve code quality?

Test-Driven Development improves maintainability by ensuring functionality is verified from the outset. You write tests before implementation, which guarantees your code is testable and fulfills specific, pre-defined requirements.

How do I start writing tests before code for a new software feature?

To start writing tests before code, begin the TDD cycle by writing a failing test for your new feature. Then write the minimal implementation code to pass that test, and finally refactor the code while keeping the test green.

When should I use mocks and stubs in unit testing?

You should use mocks and stubs in unit testing when you need to isolate the code being tested from its external dependencies. Proper use of test doubles ensures your tests remain focused on specific functionality rather than integrated systems.

What are the best practices for structuring unit tests?

Best practices for structuring unit tests include using a single assertion per test, writing descriptive test names, and following the Arrange-Act-Assert structure. These practices ensure tests are maintainable and clearly communicate their purpose.

Does Test-Driven Development work for refactoring existing code?

Yes, Test-Driven Development works for refactoring existing code by ensuring tests remain green during the process. The methodology guarantees that functionality stays verified and testable while you improve the internal structure of the code.