cd /news/ai-agents/a-review-slash-command-that-makes-cl… · home › topics › ai-agents › article
[ARTICLE · art-154969] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

A /review slash command that makes Claude Code check its own diff before you commit

A developer published a custom Claude Code slash command, `/review`, defined in a `.claude/commands/review.md` file that runs `git diff --staged` and reports leftover debug output, incomplete renames, weakened or skipped tests, and changes touching secrets, auth, or config before a commit lands. The command restricts itself to read-only git commands via `allowed-tools`, so the review cannot modify files, and it ends with either "OK to commit" or a short fix list. The author recommends committing the commands folder so a team shares the command and pairing it with a Stop hook that prompts a review when a session ends with uncommitted changes.

by read1 min views11 publishedOct 22, 2026

Most bad commits from an agent aren't wrong code. They're leftover debug prints, a half-renamed variable, or a test that got skipped "for now". A one-file custom slash command catches most of that before it lands.

Create .claude/commands/review.md in your repo:

---
description: Review the staged diff before committing
allowed-tools: Bash(git diff:*), Bash(git status:*)
---

Run `git diff --staged` and review only what changed.

Report, in this order:
1. Leftover debug output, commented-out code, or TODOs added in this diff.
2. Renames or signature changes that weren't applied everywhere.
3. Tests that were skipped, deleted, or weakened.
4. Anything that touches secrets, auth, or config files.

Do not edit files. End with "OK to commit" or a short list of what to fix.

Now /review in a session runs it. Because allowed-tools only lists read-only git commands, the review can't quietly "fix" things behind your back.

/review after. Commit the .claude/commands/ folder so the whole team gets the same command. Pair it with a Stop hook that reminds you to run /review when a session ends with uncommitted changes.

I ship this command alongside a Bash allow-list, .env deny rules, safety hooks, and a short CLAUDE.md in Vildanden Agent Config. The free sample is enough to try the pattern today.

── more in #ai-agents 4 stories · sorted by recency
── more on @claude code 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/a-review-slash-comma…] indexed:0 read:1min 2026-10-22 · —