{"slug": "a-review-slash-command-that-makes-claude-code-check-its-own-diff-before-you", "title": "A /review slash command that makes Claude Code check its own diff before you commit", "summary": "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.", "body_md": "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.\n\nCreate `.claude/commands/review.md` in your repo:\n\n```\n---\ndescription: Review the staged diff before committing\nallowed-tools: Bash(git diff:*), Bash(git status:*)\n---\n\nRun `git diff --staged` and review only what changed.\n\nReport, in this order:\n1. Leftover debug output, commented-out code, or TODOs added in this diff.\n2. Renames or signature changes that weren't applied everywhere.\n3. Tests that were skipped, deleted, or weakened.\n4. Anything that touches secrets, auth, or config files.\n\nDo not edit files. End with \"OK to commit\" or a short list of what to fix.\n```\n\nNow `/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.\n\n`/review` after.\nCommit 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.\n\nI ship this command alongside a Bash allow-list, `.env` deny rules, safety hooks, and a short `CLAUDE.md` in [Vildanden Agent Config](https://justly-mia-429.rehost.page/). The free sample is enough to try the pattern today.", "url": "https://wpnews.pro/news/a-review-slash-command-that-makes-claude-code-check-its-own-diff-before-you", "canonical_source": "https://dev.to/vildandenai/a-review-slash-command-that-makes-claude-code-check-its-own-diff-before-you-commit-823", "published_at": "2026-10-22 01:08:52+00:00", "updated_at": "2026-10-22 01:10:25.300075+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools"], "entities": ["Claude Code", "Anthropic", "Vildanden Agent Config"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/a-review-slash-command-that-makes-claude-code-check-its-own-diff-before-you", "markdown": "https://wpnews.pro/news/a-review-slash-command-that-makes-claude-code-check-its-own-diff-before-you.md", "text": "https://wpnews.pro/news/a-review-slash-command-that-makes-claude-code-check-its-own-diff-before-you.txt", "jsonld": "https://wpnews.pro/news/a-review-slash-command-that-makes-claude-code-check-its-own-diff-before-you.jsonld"}}