Have an agent review your staged changes before you commit
언제 쓸까: About to commit. Want a second pair of eyes to catch obvious smell before the commit lands.
사전 조건
- Local repo with staged changes —
git add -pas usual, then ask the agent
흐름
-
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>'.✓ 복사됨→ Specific file:line flags
-
Suggest a commit messageWrite a commit message following conventional commits. First line under 60 chars, body explains why not what.✓ 복사됨→ Copy-pasteable message
-
Confirm scopeBased on the diff, is this commit appropriately small? Suggest splits if it touches multiple concerns.✓ 복사됨→ Go/no-go with rationale
결과: A cleaner commit with fewer 'oops' follow-ups.
함정
- 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