tdd

Enforces a strict Python TDD workflow using the red-green-refactor methodology.

15.8k|1.5k|Updated Jul 30, 2024
One-click install
npx skills add https://github.com/MODSetter/SurfSense --skill tdd-modsetter
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/MODSetter/SurfSense/tree/main/.cursor/skills/tdd
Command: npx skills add https://github.com/MODSetter/SurfSense --skill tdd-modsetter

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers write more robust and maintainable code by enforcing a strict Test-Driven Development (TDD) workflow, ensuring that code is built with a clear understanding of its intended behavior and is thoroughly tested from the outset.

Core Features & Use Cases

  • Red-Green-Refactor Loop: Guides users through the iterative process of writing a failing test, writing minimal code to pass, and then refactoring.
  • Integration-Style Tests: Emphasizes testing through public interfaces rather than implementation details, leading to more resilient tests.
  • Use Case: When developing a new feature, use this Skill to write a test for the desired behavior first, then implement the code, and finally refactor to improve the design.

Quick Start

Follow the red-green-refactor cycle to implement the next piece of functionality.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I implement test-driven development in Python?

Test-driven development in Python is implemented by following a strict red-green-refactor loop: write a failing test, write minimal code to pass it, then refactor to improve design and maintainability.

What's the best way to write pytest tests that don't break during refactoring?

The best way to write resilient pytest tests is to use integration-style tests that verify behavior through public interfaces rather than testing implementation details, ensuring tests remain valid during refactoring.

Why does TDD focus on integration-style tests over implementation details?

TDD focuses on integration-style tests over implementation details because testing through public interfaces ensures code is built with a clear understanding of intended behavior and yields more resilient, maintainable tests.

How do I start a new feature using the red-green-refactor methodology?

To start a new feature using the red-green-refactor methodology, plan the desired behavior, write a failing test for it, implement the minimal code to pass, and iteratively refactor to improve the design.

Can I use this TDD workflow for incremental Python development?

Yes, this TDD workflow supports incremental Python development by guiding you through tracer bullet implementation and incremental red-green-refactor loops to ensure code quality at each stage.

When should I not use TDD for Python code?

You should avoid TDD when the desired behavior is not yet clearly understood, as the methodology requires defining intended behavior through tests before writing any implementation code.