Testing Test Writing

Guide developers through the TDD RED-GREEN-REFACTOR cycle with failing tests first.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/grimmolf/mga-soap-calculator --skill testing-test-writing-grimmolf
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Testing Test Writing
Source: https://github.com/grimmolf/mga-soap-calculator/tree/main/.claude/skills/testing-test-writing
Command: npx skills add https://github.com/grimmolf/mga-soap-calculator --skill testing-test-writing-grimmolf

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill ensures code quality, prevents regressions, and provides fast feedback during development by guiding the adoption of the TDD cycle, comprehensive test coverage, and maintainable test suites.

Core Features & Use Cases

  • TDD Cycle Adherence: Promotes writing failing tests first (RED), then implementing code to pass (GREEN), and refactoring.
  • Comprehensive Coverage: Guides on covering edge cases, error states, and boundary conditions.
  • Maintainable Test Suites: Advises on explicit fixtures, minimal mocking, and fast test execution.
  • Use Case: When developing a new business logic function, use this skill to write failing tests first, then implement the code to pass them, covering all edge cases and ensuring high code coverage.

Quick Start

Apply the Testing Test Writing skill to develop a new calculateDiscount function, starting with a failing test for a 10% discount scenario.

Frequently Asked Questions about Testing Test Writing

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

FAQPage Schema
How do I write tests using the TDD red-green-refactor cycle?

TDD red-green-refactor means writing a failing test first (red), implementing minimal code to pass it (green), then refactoring for clarity. Start by defining what your function should do in a test, watch it fail, write the simplest code to pass, then clean up without changing behavior.

What's the best way to ensure high code coverage in my test suite?

Enforce coverage thresholds that block merges when statement or branch coverage falls below your target. Write tests for edge cases, error states, and boundary conditions. Use explicit fixtures and test builders to keep tests maintainable while covering all code paths systematically.

How do I structure tests for Jest, Vitest, and pytest projects?

Place test files in standard directories like tests/, __tests__/, or spec/, using naming patterns like *.test.ts, *.spec.js, or *.py. Each framework supports these conventions; organize tests near source files or in a dedicated folder, use fixtures for setup, and keep execution under one second for fast CI feedback.

Can I use TDD with integration tests and contract testing?

Yes, TDD applies to integration and contract tests as well as unit tests. Write failing integration tests first to define expected behavior across components, then implement the integration logic. Contract tests verify API agreements between services using the same red-green-refactor approach.

Why should I minimize mocking in my tests?

Excessive mocking creates brittle tests that pass but don't catch real failures. Use explicit fixtures and test builders instead to set up realistic state. Mock only external dependencies; test your own code with real objects so refactoring doesn't break tests unnecessarily.

Do I need prior testing experience to adopt TDD effectively?

No, but understanding basic test concepts helps. Start with a simple function like calculateDiscount, write a failing test, implement code to pass it, then refactor. TDD itself teaches best practices; follow the cycle consistently and coverage thresholds will naturally enforce quality.