test-driven-development

Automate the red-green-refactor cycle for Swift projects with failing tests first.

1|Updated Nov 22, 2025
One-click install
npx skills add https://github.com/gmliao/swift-state-tree --skill test-driven-development-gmliao
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/gmliao/swift-state-tree/tree/main/.agent/skills/Superpowers/test-driven-development
Command: npx skills add https://github.com/gmliao/swift-state-tree --skill test-driven-development-gmliao

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill guides engineers to adopt test-driven development by requiring tests to fail before implementing production code, reducing buggy behavior and enabling safer refactors.

Core Features & Use Cases

  • Red-Green-Refactor: Follow the cycle of writing a failing test, making minimal production changes to pass, and refactoring for clarity.
  • Predictable Quality Gate: Ensure new features, bug fixes, and refactors are guarded by automated tests before deployment.
  • Use Case: During a Swift feature upgrade, apply TDD to validate that changes meet expectations without introducing regressions.

Quick Start

  1. Write a failing test for the intended behavior.
  2. Implement the minimal code to make the test pass.
  3. Refactor for readability and maintainability while keeping all tests green.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
What is test-driven development and how does the red-green-refactor cycle work?

Test-driven development is a workflow where you write a failing test first, implement minimal production code to pass it, then refactor for clarity. The red-green-refactor cycle enforces this sequence to prevent regressions and ensure predictable quality gates.

How do I apply TDD to a Swift feature upgrade without introducing regressions?

To apply TDD to a Swift feature upgrade, write a failing test for the intended behavior, implement the minimal code to make the test pass, and refactor while keeping all tests green. This validates changes meet expectations without introducing regressions.

Can I use this TDD workflow for bug fixes and refactoring, not just new features?

Yes, this TDD workflow applies to bug fixes and refactors across Swift projects, not just new features. It enforces mandatory failing tests before production changes, ensuring fixes and refactoring are guarded by automated tests to prevent buggy behavior.

Why do I need to write a failing test before implementing production code?

Writing a failing test before implementing production code is required to validate the test's effectiveness and reduce buggy behavior. This mandatory step enables safer refactors by ensuring new features and bug fixes are guarded by automated tests.

Does this test-driven development workflow require any specific testing frameworks?

No specific testing frameworks are required. The workflow guides engineers through the red-green-refactor cycle across Swift projects, focusing on writing failing tests first and implementing minimal production code to pass them.