test-driven-development

Guide developers through the Test-Driven Development Red-Green-Refactor cycle.

18|8|Updated May 31, 2023
One-click install
npx skills add https://github.com/jpmorgan-payments/embedded-finance --skill test-driven-development-jpmorgan-payments
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/jpmorgan-payments/embedded-finance/tree/main/.github/skills/superpowers/test-driven-development
Command: npx skills add https://github.com/jpmorgan-payments/embedded-finance --skill test-driven-development-jpmorgan-payments

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enforces a rigorous development process that leads to more robust, maintainable, and bug-free code by ensuring tests are written before implementation.

Core Features & Use Cases

  • Enforces Test-First Development: Guides users to write failing tests before writing any production code.
  • Red-Green-Refactor Cycle: Implements the core TDD loop for iterative development.
  • Use Case: When starting a new feature, use this Skill to ensure you write a test that defines the expected behavior, then write the minimal code to pass that test, and finally refactor.

Quick Start

Follow the test-driven development process for any new feature or bug fix.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I start using test-driven development for new features?

Test-driven development starts by writing a failing test that defines expected behavior, then writing minimal code to pass it, and finally refactoring. This enforces the Red-Green-Refactor cycle for iterative development.

What is the Red-Green-Refactor cycle in TDD?

The Red-Green-Refactor cycle is the core TDD loop. You write a failing test (Red), implement minimal code to make it pass (Green), and refactor the code while keeping tests green to improve code quality.

Can I use TDD for bug fixes and refactoring existing code?

Yes, test-driven development applies to bug fixes and refactoring. You write a test defining the expected behavior or verifying the bug, then implement minimal changes to pass the test before refactoring.

Why write failing tests before implementation code?

Writing failing tests before implementation ensures verifiable code and reduces bugs. This strict testing principle enforces test-first development, leading to more robust, maintainable code.

Does test-driven development work within an agile development process?

Yes, test-driven development integrates with agile processes. It enforces a rigorous iterative development loop, ensuring code quality and reducing bugs across iterative development cycles.