Skip to main content
rule CX Codex

incremental-verify — Claude Code rule: what it does, how to install

incremental-verify keeps the agent on one failing test at a time: the smallest change that passes it, then a commit, before the next behavior starts.

MIT ★ 2,966 updated 2026-09-29

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/incremental-verify.mdc
Open on GitHub

What incremental-verify does

One failing assertion, the smallest change that turns it green, a commit, then repeat. The rule bans writing a pile of tests up front. Tests for code that does not exist yet describe imagined behavior: they pin down signatures and data shapes, miss real regressions, and break on refactors that change nothing.

Along with the principle, the file carries a four-question checklist and three failure modes to catch: assertions on object keys instead of observable output, tests that mostly configure mocks, and a suite that went green on the first run. That last one is the sharpest signal, since a test that never failed did not shape the design.

There is one escape hatch. Exploratory spikes against an unfamiliar API are allowed, provided the branch is marked throwaway and its tests stay out of the merge. The frontmatter sets alwaysApply: true, so the rule is in play in every session — mark the spike branch when you open it, not afterwards.

What it helps with

  • split a feature into test-first steps: failing assertion, minimal code, commit
  • catch tests that assert on object keys instead of what a caller sees
  • spot a test that configures mocks and then checks the mocks were called
  • flag a first-run green suite as suspect and rewrite it
  • keep an exploratory spike out of the main branch

Example prompts for the agent

  • Write one failing test for the email validation, make it pass with the smallest change, then commit.
  • Run the incremental-verify checklist: is there exactly one failing test right now?
  • This is a throwaway spike on an unfamiliar API, so keep its tests out of the merge.

How to install incremental-verify

Manually: put the files in place

.cursor/rules/incremental-verify.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about incremental-verify

How do I install incremental-verify in Claude Code?

Add the marketplace with /plugin marketplace add rohitg00/pro-workflow, then install the plugin: /plugin install pro-workflow@pro-workflow.

What does incremental-verify do?

It stops the agent from writing tests in bulk before the code exists. Each behavior gets a failing check, the minimum implementation that satisfies it, and a commit.

When can I break the rule?

During an exploratory spike on an unfamiliar API. Mark the branch as throwaway and leave its tests out of the merge.

Source text

incremental-verify.mdc · MIT
---
description: Verify each behavior before building the next. One test, one implementation, one commit. No bulk-writing tests for behavior that does not yet exist.
globs:
alwaysApply: true
---

# Incremental Verification

## Principle

Behavior you have not written cannot be tested honestly. Writing many tests
before any implementation produces tests shaped by **imagined** behavior,
not actual behavior — they assert on function signatures and data shapes,
survive real regressions silently, and break on harmless refactors.

## Rule

For every new behavior: write one failing assertion, write the minimum
implementation that makes it pass, commit, repeat. No batched test
authoring. No scaffolding dozens of test cases before a single green run.

## Checklist

- [ ] Is there exactly one failing test right now? If more, split the commit.
- [ ] Does the test exercise a public interface a caller would actually hit?
- [ ] Would the test still make sense after a full internal refactor?
- [ ] Was the implementation written **after** seeing the test fail?

## Failure modes to catch

- "Shape tests": asserting on object keys, array length, or types rather
  than observable output. Rewrite against a caller's perspective.
- "Mock-driven tests": the test mostly configures mocks then asserts the
  mock was called. Move the mock to a system boundary or delete it.
- "Green before red": if every test you wrote passed on the first run,
  the test did not drive the design — treat it as suspect.

## When to break the rule

Exploratory spikes where you are probing an unknown API. Mark the spike
branch as throwaway and do not merge its tests.

© Rohit Ghumare · MIT · rohitg00/pro-workflow

Similar IDE rules

All IDE rules for Testing and QA →

From the same set83

The whole set →
sprint-status sprint-status is a Claude Code command that summarizes active sessions and branches. Run it to resume work or check parallel sessions. CX Codex +1 ★ 2,966repo stars deslop The /deslop command cleans the current branch of unnecessary code added by AI: obvious comments, defensive try/catch blocks, one-off abstractions, and docstrings on unchanged functions. CX Codex +1 ★ 2,966repo stars learn-rule learn-rule extracts session mistakes into one-line rules and saves them to your project memory after explicit confirmation. CX Codex +1 ★ 2,966repo stars wrap-up The wrap-up skill audits code changes, runs quality checks, and records what to pick up next. Use it when you are about to end a coding session. CX Codex +1 ★ 2,966repo stars token-efficiency token-efficiency cuts token burn in Claude Code by removing conversational filler, enforcing read-before-write, and stopping unwanted refactoring loops. CX Codex +1 ★ 2,966repo stars scout scout examines a codebase before implementation and rates readiness across five dimensions. Use it to see whether the task is ready to start or needs more investigation. CX Codex ★ 2,966repo stars core-rules core-rules — a rule file for your project: commit checks, Git habits, context discipline and the way the agent replies. Paste it into CLAUDE.md or keep it standalone. CX Codex +1 ★ 2,966repo stars context-optimizer The context-optimizer command checks context window fill rates in Claude Code and helps cut token waste before responses degrade. CX Codex +1 ★ 2,966repo stars

Project sponsors

Companies that keep this analytics open