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
.cursor/rules/incremental-verify.mdcWhat 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
emailvalidation, 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.mdcFrontmatter: description, globs, alwaysApply
1Plugin marketplace
/plugin marketplace add rohitg00/pro-workflow/plugin install pro-workflow@pro-workflow2Manually: put the files in place
.claude/rules/incremental-verify.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/incremental-verify.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/incremental-verify.mdManually: put the files in place
.clinerules/incremental-verify.mdStep 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