writing-tests

Enforce a red-green-refactor workflow to reduce flaky tests across codebases.

Updated Mar 29, 2026
One-click install
npx skills add https://github.com/Ovid/smudge --skill writing-tests-ovid
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: writing-tests
Source: https://github.com/Ovid/smudge/tree/main/.claude/skills/writing-tests
Command: npx skills add https://github.com/Ovid/smudge --skill writing-tests-ovid

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill guides developers to write, modify, or review tests using a red-green-refactor workflow, reducing flaky tests and improving overall test quality.

Core Features & Use Cases

  • Enforces red-green-refactor discipline across unit, integration, and e2e tests.
  • Provides guidance to avoid flaky-test patterns and improve test reliability.
  • Supports best practices for test coverage, structure, and maintainability.

Quick Start

Describe a failing test, implement the minimal code to pass, and refactor while keeping tests green.

Frequently Asked Questions about writing-tests

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

FAQPage Schema
How do I reduce flaky tests in my unit and integration test suites?

You reduce flaky tests by enforcing a red-green-refactor workflow and applying deterministic mocking. This approach eliminates non-deterministic patterns, ensuring reliable early feedback across unit, integration, and e2e testing.

What is the red-green-refactor workflow in test-driven development?

The red-green-refactor workflow is a test-driven cycle where you describe a failing test, implement minimal code to pass, and refactor while keeping tests green. It improves test structure and maintainability across the codebase.

How to apply deterministic mocking to improve test robustness?

Deterministic mocking improves test robustness by replacing volatile dependencies with predictable responses. This avoids flaky-test patterns and ensures tests pass consistently across unit and integration scenarios.

When do I need to review tests for flaky-test patterns?

You need to review tests for flaky-test patterns when test reliability drops or early feedback becomes inconsistent. Applying red-green-refactor discipline during test modification or review identifies and removes non-deterministic behaviors.

Can I use red-green-refactor discipline for end-to-end testing scenarios?

Yes, you can apply red-green-refactor discipline to end-to-end testing scenarios. The workflow ensures test reliability and early feedback across unit, integration, and e2e environments by avoiding flaky patterns and applying deterministic mocks.

What is the best way to enforce test quality before shipping code?

The best way to enforce test quality is following a red-green-refactor workflow with deterministic mocks and coverage practices. This reduces flaky tests and ensures reliable early feedback before shipping across the codebase.