Have an agent review your staged changes before you commit
Quand l'utiliser : About to commit. Want a second pair of eyes to catch obvious smell before the commit lands.
Prérequis
- Local repo with staged changes —
git add -pas usual, then ask the agent
Déroulement
-
Read the staged diffShow me my staged changes. Flag anything that looks like: debug logs, commented code, hardcoded secrets, or changes unrelated to the stated commit goal '<GOAL>'.✓ Copié→ Specific file:line flags
-
Suggest a commit messageWrite a commit message following conventional commits. First line under 60 chars, body explains why not what.✓ Copié→ Copy-pasteable message
-
Confirm scopeBased on the diff, is this commit appropriately small? Suggest splits if it touches multiple concerns.✓ Copié→ Go/no-go with rationale
Résultat : A cleaner commit with fewer 'oops' follow-ups.
Pièges
- Agent misses secrets because they don't look obviously secret-shaped — Don't rely on this as a secret scanner — run
gitleaksortrufflehogin your pre-commit hook as the real defense - Asking for a commit message biases the agent to approve the diff — Always do the review step BEFORE asking for a message — order matters