TL;DR Create
.claude/skills/verify/SKILL.mdat the root of your repo with the steps that start your app and walk through what you changed, then open a new session. From then on, Claude Code's commit instructions tell Claude to run it right before everygit commit. Don't adddisable-model-invocation: true: the instruction goes away.
Claude says it's done, the tests pass, it commits, and the feature is broken. Since v2.1.286, a skill of yours named verify changes that: if it exists when the session starts, Claude Code adds one sentence to its commit instructions and Claude runs the skill before every commit. It's what the Claude Code team does: without that loop, you check everything yourself and can't run more than one or two sessions at a time.
The sentence Claude gets
In a test repo with the skill at the root, claude -p on v2.1.337 quotes this line from its commit instructions:
Always run `/verify` right before the `commit` command (never for docs or tests).
In the same repo without the skill, the same question answers NONE. The /verify that ships with Claude Code doesn't count: you run that one by hand, and since v2.1.215 Claude doesn't run it on its own.
What changes in a commit
Same request in both repos: "add a --shout flag to app.js and commit it". These are Claude's calls with the verify skill, taken from --output-format stream-json:
Bash(cat > app.js <<'EOF' … EOF; node app.js Ana --shout; …)
⎿ HELLO, ANA
Skill(verify)
Bash(node app.js Ana | cat -A)
⎿ Hello, Ana$
Bash(git add app.js && git commit -q -m "Add --shout flag …")
⎿ 80b03db Add --shout flag to print greeting in uppercase
Without it, Claude tested its change too, but the checks and the commit were one command, chained with ;: the commit would have gone through whatever the output said. With the skill, the check is your recipe, as its own step, before the commit.
Bash(cat > app.js <<'EOF' … EOF
node app.js Ana --shout; node app.js Ana; node app.js --shout;
git add app.js && git commit -q -m "Add --shout flag …")
⎿ HELLO, ANA
Hello, Ana
HELLO, WORLD
db3e0a4 Add --shout flag to print greeting in uppercase
When the instruction arrives and when it doesn't
Where your verify lives |
Arrives? | Source |
|---|---|---|
.claude/skills/verify/ at the root, session at the root |
Yes | Tested |
With disable-model-invocation: true |
No | Tested |
Only in packages/web/.claude/skills/verify/, session at the root |
No | Tested |
The same, with the session opened in packages/web |
Yes | Tested |
~/.claude/skills/verify/ |
Yes, in every repo you open | Docs |
| In a plugin or your claude.ai account | No | Docs |
In a folder added with --add-dir |
No | Binary |
"includeGitInstructions": false in settings |
No, all the commit instructions go | Docs |
A skill of yours named simplify |
Yes, the sentence names it too | Docs |
It's not a gate. It's a sentence in the instructions: Claude can skip it, and it doesn't run it for commits that only touch docs or tests. If a commit must never go out untested, the article suggests a hook that runs the tests when Claude finishes, or a /goal with a passing suite as the condition.
The steps
1. Write the skill
In .claude/skills/verify/SKILL.md, at the root of the repo. An example for a web app:
---
name: verify
description: Start the app and walk through the flow the change touches. Use it before every commit.
---
1. Start the server in the background with `npm run dev` and wait until it answers on http://localhost:3000.
2. Open the page the change touches and do what a user would: navigate, fill in the form, submit.
3. Read the browser console and the server log, and say what you saw, with the URL and the result.
If a check still fails after three rounds of fixes, stop and tell me what fails. Don't commit.
The last line is the Claude Code team's rule: three rounds, then a person steps in. Step 2 depends on where your change lives; the article uses one tool per surface:
| Your change | What Claude drives it with |
|---|---|
| Web | The Chrome extension, through /chrome, or Playwright MCP |
| Mobile | An iOS or Android simulator MCP |
| Desktop | Computer use |
| Backend | The service running locally and requests to its endpoints |
2. Or let /verify write it
When /verify has to start your app with no recipe, it saves what worked to .claude/skills/verify/SKILL.md. Run it once after a change, review the file and commit it: at the root, it replaces Claude Code's own /verify and turns the instruction on from the next session.
3. Check that it arrives
Claude Code settles the instruction at startup: a skill created mid-session doesn't count until the next one. Open a new session at the repo root, or ask without the interactive mode. If it answers NONE, go back to the table above:
claude -p "Quote word for word any sentence in your commit instructions that names a skill to run before committing. If there is none, answer NONE."
4. Make it fast
It runs before every commit: if it takes three minutes, every commit takes three minutes longer. The article calls it your smoke test harness and recommends asking Claude to iterate on it and stress test it until it's fast and reliable.
In a monorepo
The article says to put it as close to the relevant code as you can and to add as many as you need. But with the session at the root, a verify that only lives in packages/web doesn't trigger the sentence.
With one at the root and another in packages/web, the sentence names /verify, and in the test, with a change inside packages/web, Claude ran the root one before the commit, not packages/web:verify. The root one is the entry point. Say in it which recipe each folder follows, for example "if the change touches packages/web, follow packages/web/.claude/skills/verify/SKILL.md", or open the session inside the package.
Official docs: Run your checks before each commit
Requirements
Claude Code v2.1.286 or later. Tested on v2.1.337 on Linux with claude -p: the sentence, the cases marked as tested and three real commits. Personal skills, plugins and includeGitInstructions come from the docs; --add-dir, from the binary.