testing-tdd

Enforces the Test-Driven Development red-green-refactor cycle for all new code.

Updated Jan 9, 2025
One-click install
npx skills add https://github.com/baotoq/go-shortener --skill testing-tdd
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-tdd
Source: https://github.com/baotoq/go-shortener/tree/main/.agents/skills/testing-tdd
Command: npx skills add https://github.com/baotoq/go-shortener --skill testing-tdd

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enforces a Test-Driven Development (TDD) workflow, ensuring that all new code is written only after a failing test has been created, leading to more robust and reliable software.

Core Features & Use Cases

  • Enforces TDD: Mandates writing tests before implementation code for new features, bug fixes, and refactoring.
  • Red-Green-Refactor Cycle: Guides users through the TDD cycle of writing a failing test (Red), writing minimal code to pass (Green), and then cleaning up (Refactor).
  • Use Case: When developing a new API endpoint, you would first write a test that defines the expected request and response. Only after this test fails would you write the minimal code to make it pass, ensuring the endpoint behaves as intended from the start.

Quick Start

Use the testing-tdd skill to write a failing test for a new function before implementing it.

Frequently Asked Questions about testing-tdd

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

FAQPage Schema
How do I start writing tests before implementation code using TDD?

To start TDD, write a failing test that defines the expected behavior of your new function or API endpoint before writing any production code. This enforces a strict red-green-refactor cycle, ensuring testability and correctness from the start.

What is the red-green-refactor cycle in software development?

The red-green-refactor cycle is a TDD methodology where you write a failing test (Red), implement minimal code to pass the test (Green), and then clean up the code (Refactor). This workflow ensures robust and reliable software development.

When should I use test-driven development for new features and bug fixes?

You should use test-driven development for all new features, bug fixes, and refactoring tasks. It mandates writing tests before implementation to define expected request and response behaviors, ensuring the endpoint or function behaves as intended.

What are common TDD anti-patterns and rationalizations to avoid?

Common TDD anti-patterns include skipping the failing test phase or writing excessive code before testing. This skill provides detailed instructions on rationalizations to avoid, ensuring you maintain a strict red-green-refactor cycle for high code quality.

Can I use TDD for refactoring existing code safely?

Yes, you can use TDD for refactoring existing code safely by writing tests that define current behavior before making changes. This ensures testability and correctness while cleaning up the code during the refactor phase of the cycle.