tdd-mastery_skill

This skill enforces strict test-first discipline to deliver robust JavaScript code by guiding you through the red-green-refactor cycle.
  • JavaScript

202

GitHub Stars

2

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill xenitv1/claude-code-maestro --skill tdd-mastery

  • SKILL.md8.5 KB
  • testing-anti-patterns.md8.0 KB

Overview

This skill enforces a strict Test-Driven Development (TDD) iron law: always write the failing test first, then implement the minimal code to pass, and only then refactor. It documents a step-by-step Red-Green-Refactor cycle and a verification checklist to guarantee every change is backed by observable tests. The goal is reliable, reviewable code and to prevent AI or human shortcuts that introduce unverified production code.

How this skill works

The skill walks developers through writing one minimal, focused failing test (RED), verifying it fails for the expected reason, implementing the smallest possible change to make it pass (GREEN), re-running tests to confirm success, and finally refactoring while keeping tests green. It rejects any workflow that contains production code written before a failed test or tests created after implementation. Built-in checklists and examples show what to run and what to watch for.

When to use it

  • Adding any new function, method, or feature to a codebase
  • Fixing a bug—always reproduce it with a failing test first
  • Refactoring or extracting behavior that lacks tests
  • Onboarding developers to enforce consistent TDD practices
  • Automating CI gates that must block legacy-code submissions

Best practices

  • Write one behavior per test with a clear descriptive name
  • Run the test and confirm it fails for the expected reason before coding
  • Implement only the minimal code needed to pass the test (no YAGNI features)
  • After green, refactor for clarity and remove duplication while keeping tests green
  • Delete any production code written prior to a failing test—do not keep it as reference

Example use cases

  • Implementing a retry helper: write failing test for 3 attempts, verify failure, implement minimal loop
  • Reproducing and fixing a bug: add failing test that exposes the bug, implement fix, verify pass
  • Adding input validation: write tests for empty, invalid, and valid inputs before coding
  • CI pre-merge check: reject pull requests that add production code without prior failing tests
  • Front-end API contract: create MSW handlers and tests first to decouple from backend availability

FAQ

If a new test passes without implementation, it proves the test is wrong or the behavior already exists. Fix the test so it fails for the intended missing behavior before implementing.

Can I keep pre-written production code as a reference while writing tests?

No. The iron law requires deleting such code. Keeping it biases the tests and defeats the purpose of verifying behavior from a failing test.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational