One-click install
npx skills add https://github.com/Crumbgrabber/llm_system_template_agents_skills_patterns_tools_prompts --skill test-driven-development-crumbgrabber
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/Crumbgrabber/llm_system_template_agents_skills_patterns_tools_prompts/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/Crumbgrabber/llm_system_template_agents_skills_patterns_tools_prompts --skill test-driven-development-crumbgrabber

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enforces a rigorous development practice that prevents bugs by ensuring code is written only after its corresponding tests have been written and observed to fail, guaranteeing that tests actually verify behavior.

Core Features & Use Cases

  • Mandatory Test-First Approach: Enforces writing tests before any implementation code.
  • Red-Green-Refactor Cycle: Guides users through the disciplined process of writing a failing test, writing minimal code to pass, and then refactoring.
  • Use Case: When developing a new feature, use this Skill to guide you in writing a test that defines the expected behavior, then write the smallest amount of code necessary to make that test pass, ensuring the feature works as intended from the outset.

Quick Start

Follow the Red-Green-Refactor cycle to implement any new feature or bugfix.

Frequently Asked Questions about test-driven-development

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 prevent bugs?

The test-driven development (TDD) cycle is a practice where you write a failing test before any implementation code, guaranteeing the test verifies behavior. This Red-Green-Refactor process prevents bugs by ensuring code is written only to pass predefined tests.

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

To write tests first for a new feature, begin by creating a test that defines the expected behavior and observe it fail. Then, write the minimal amount of implementation code necessary to make that failing test pass, ensuring correct functionality from the outset.

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

Yes, you can use test-driven development for bug fixes and refactoring existing code. The methodology applies to all software development tasks by guiding you to write a failing test that reproduces the bug before writing the fix or updating the code.

What's the best way to ensure my tests actually verify code behavior?

The best way to ensure tests verify behavior is to write the test first and observe it fail. This rigorous development practice guarantees the test is actually checking the expected behavior, preventing regressions when you write the minimal code to pass it.

When should I not use a strict test-first approach in agile development?

A strict test-first approach might be less suitable for agile development tasks involving exploratory prototyping or undefined behavior, as the methodology requires writing a failing test that defines expected behavior before any implementation code can be written.