tdd-cycle

Guide Ruby on Rails developers through the Red-Green-Refactor TDD cycle.

Updated Feb 8, 2026
One-click install
npx skills add https://github.com/mlbright/notes --skill tdd-cycle-mlbright
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd-cycle
Source: https://github.com/mlbright/notes/tree/main/.github/skills/tdd-cycle
Command: npx skills add https://github.com/mlbright/notes --skill tdd-cycle-mlbright

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill guides developers through the Test-Driven Development (TDD) process, ensuring robust and well-tested code by emphasizing writing tests before implementation.

Core Features & Use Cases

  • Structured TDD Guidance: Provides a step-by-step checklist for the Red-Green-Refactor cycle.
  • Best Practices: Offers examples and anti-patterns for writing effective tests and refactoring code.
  • Use Case: When starting a new feature, use this Skill to ensure you follow TDD principles, writing a failing test first, then the minimal code to pass, and finally refactoring for clarity and efficiency.

Quick Start

Guide me through the TDD cycle for a new user model validation.

Frequently Asked Questions about tdd-cycle

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

FAQPage Schema
How do I do Test-Driven Development in Ruby on Rails?

Test-Driven Development in Ruby on Rails is guided through the Red-Green-Refactor cycle: analyze requirements, select a test type, write a failing spec, implement minimal code to pass, and then refactor for clarity.

What is the Red-Green-Refactor cycle for Rails testing?

The Red-Green-Refactor cycle is a TDD workflow where you first write a failing test, implement the minimal code required to make it pass, and then refactor the implementation to improve code quality without changing behavior.

How do I write TDD tests for Rails model validations and associations?

You can write TDD tests for Rails model validations and associations by following structured TDD patterns that guide you through selecting the correct model test type, writing the initial failing spec, and implementing the validation logic to verify it passes.

When should I use system tests versus request tests in Rails TDD?

You should select system tests for end-to-end browser interactions and request tests for HTTP endpoint responses during the requirement analysis phase of the TDD cycle to ensure you are testing the correct application layer.

What are common anti-patterns to avoid in Ruby on Rails TDD?

Common TDD anti-patterns to avoid include writing tests after implementation and skipping the verification of failing specs, which compromises the structured Red-Green-Refactor workflow and reduces test robustness.

Can I use this TDD workflow for Rails service objects?

Yes, the TDD workflow supports Rails service objects by providing specific patterns for writing failing specs, verifying the failures, implementing the minimal service code, and refactoring the logic to achieve passing tests.