Skip to content

Commit cb618ac

Browse files
balzssclaude
andcommitted
chore: add comprehension-check gate before /commit
Add a /comprehension-check skill that quizzes the author on the current diff's design decisions before committing, to stop AI-generated code the author can't explain from landing. It skips trivial diffs, asks free-text design questions, grades against the diff, and teaches then re-quizzes on gaps. Wire it into /commit as a step-0 preamble and whitelist the new skill file in .gitignore so it ships alongside the other shared commands. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 98e2a29 commit cb618ac

3 files changed

Lines changed: 70 additions & 0 deletions

File tree

.claude/commands/commit.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Co-Authored-By: Claude <noreply@anthropic.com>
2626

2727
## Steps
2828

29+
0. **Comprehension gate.** Unless the diff is trivial (pure docs/config/formatting/version bump/generated files), run the `/comprehension-check` skill first and only continue once the author has demonstrated understanding. Skip silently for trivial diffs.
2930
1. `git status` + `git diff` (and `git diff --staged` if anything's staged), and **check the current branch is the right place for this commit**:
3031
- **Never commit on `master`/`main`.** If you're on it, stop and **offer to create a feature branch** from the current HEAD — `git switch -c <type>/<short-desc>` carries the uncommitted changes onto the new branch — then commit there. Don't proceed on `master` even if the user didn't mention branching; confirm first.
3132
- If you're on a feature branch, glance at its name. If it looks **unrelated** to the change you're about to commit, flag it and offer to branch off (so you don't pile an unrelated commit onto someone else's WIP); otherwise proceed.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
description: Quiz the author on the current diff's design before committing — a comprehension gate to prevent shipping code nobody understands
3+
---
4+
5+
Gate a commit on the author demonstrating they understand the change. The point is to stop
6+
"ok-looking" AI-generated code — and creeping architectural complexity — from landing when
7+
the author can't actually explain it. This is a teaching gate, not a rubber stamp.
8+
9+
## 1. Read the diff
10+
11+
`git diff` and `git diff --staged`. Understand what actually changed.
12+
13+
## 2. Decide if a quiz is warranted
14+
15+
**Skip (say so and proceed straight to committing)** when the diff is only: Markdown/docs,
16+
config, formatting/lint-only churn, version bumps, lockfiles, or generated files.
17+
18+
**Quiz** when the diff introduces or changes real logic: new abstractions/components,
19+
control flow, data flow, state, public API/props, cross-package wiring, or anything with a
20+
non-obvious "why". Scale the number of questions to the change: ~2 for a small focused diff,
21+
up to ~5 for a large or architectural one.
22+
23+
Before writing questions, pick the 2-3 spots with the most hidden complexity or highest
24+
"AI-slop risk" — clever one-liners, non-obvious control flow, React effect/memo dependency
25+
arrays and referential stability, error/edge handling — and make at least one question target
26+
each. Don't spend the quiz on the parts that were easy to write.
27+
28+
## 3. Ask — one or two questions at a time, in plain chat
29+
30+
Target the **decisions embedded in the code**, never syntax or trivia. Good angles:
31+
32+
- **Why this way?** — why this approach over the obvious alternative; what trade-off was made.
33+
- **Blast radius** — what else depends on this; what breaks if it changes; who calls it.
34+
- **Data/control flow** — where does this get invoked from, and what happens next.
35+
- **Edge cases** — what inputs/states does it handle (or deliberately not), and why.
36+
- **Integration** — how it fits the monorepo: cross-package deps, theme/tokens, i18n, v1/v2.
37+
38+
Rules:
39+
40+
- Ask questions **you (Claude) already know the answer to from the diff** — so you can grade.
41+
- Before asking, note to yourself the specific points a complete answer must hit — the answer
42+
key straight from the diff. Grade the reply against that key, not against how confident or
43+
fluent it sounds.
44+
- **Never reveal the answer in the question**, and don't hand the author hints before they try.
45+
- Ask in the author's own words territory — "explain…", "why…", "what would happen if…".
46+
47+
## 4. Grade honestly
48+
49+
The gate is worthless if you rubber-stamp. Hold a real bar, but grade the _understanding_,
50+
not the phrasing:
51+
52+
- **All parts, not most.** If a question has multiple parts, it passes only when _every_ part
53+
is answered. Right on one part and silent/vague on another is **partial** → probe the missing
54+
part before moving on. Don't average.
55+
- **Correct & shows understanding** → acknowledge briefly, move on.
56+
- **Coherent alternative that's actually right** (author knows something you didn't, or framed
57+
it differently) → accept it. The goal is demonstrated understanding, not matching your words.
58+
- **Vague / partial** → probe once more on the gap.
59+
- **Wrong, or "I don't know"****teach**: explain the decision clearly with `file:line`
60+
references, then ask a _fresh_ question on the same concept. Loop until the author can
61+
explain it back in their own words. Don't move on until they can.
62+
63+
## 5. Pass
64+
65+
When the author has demonstrated understanding of every key decision, give a one-line summary
66+
of what they showed they understand, then proceed to commit (follow `/commit`). If the author
67+
wrote the code themselves and breezes through, that's a pass — the gate is aimed at code they
68+
haven't internalized, not at making them jump through hoops.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ CLAUDE.local.md
3939
!.claude/commands/slack-setup.md
4040
!.claude/commands/implement.md
4141
!.claude/commands/ticket.md
42+
!.claude/commands/comprehension-check.md
4243

4344
# Playwright MCP
4445
.playwright-mcp

0 commit comments

Comments
 (0)