- Home
- Skills
- Code Quality & Review
- Diff Diet
Diff Diet
by ac W
Review Git patches for swallowed exceptions, redundant guards, and unrelated edits. Diff Diet reports files, snapshots, and exact lines, then guides a review with blockers, items to verify, and safe deletions.
Free
Diff Diet
Example session with this skill installed
Review this invoice-total fix. Flag silent failures, redundant guards, unrelated formatting, and local changes outside the patch.
- Read your context and instructions
- Compiled the diff diet
Bad Case diff
Captured from git diff --cached -- in the acceptance repository.
diff --git a/totals.py b/totals.py
index 82d7144..26dbb59 100644
--- a/totals.py
+++ b/totals.py
@@ -1,5 +1,10 @@
def total(items: tuple[int, ...]) -> int:
- return sum(items) + 1
+ if items is None:
+ return 0
+ try:
+ return sum(items)
+ except Exception:
+ return 0
def example() -> int:
diff --git a/ui.py b/ui.py
index 5980d7c..9cc047c 100644
--- a/ui.py
+++ b/ui.py
@@ -1 +1 @@
-TITLE = "Invoice"
+TITLE="Invoice"
🔴 Blockers
- Staged ·
totals.py:6–7— The broad catch converts an unexpected failure into a zero invoice total. The fixture injected aRuntimeErrorintosum, and the call returned0. Remove the catch and keep the correctedreturn sum(items)so unexpected errors propagate.
🟡 Review
- Staged ·
ui.py:1— The spacing change leaves the invoice title's string unchanged. Leave it out of the total fix. - Worktree ·
scratch.txt,notes.txt— The former is unstaged and the latter is untracked. Keep both outside the invoice fix.
✂️ Safe-to-delete lines
- Staged ·
totals.py:2–3— Remove the null guard. The function acceptstuple[int, ...], and the fixture's sole caller,example(), passes(2, 3)directly.
CLI evidence
Selected fields from the recorded output of python3 ../skill/scripts/diff_diet.py --repo . in the same repository.
{
"worktree": {
"dirty": true,
"entries": [
{
"xy": " M",
"path": "scratch.txt"
},
{
"xy": "M ",
"path": "totals.py"
},
{
"xy": "M ",
"path": "ui.py"
},
{
"xy": "??",
"path": "notes.txt"
}
]
},
"sections": [
{
"scope": "staged",
"files": [
{
"path": "totals.py",
"findings": [
{
"kind": "none_guard",
"line": 2,
"end_line": 3
},
{
"kind": "try_added",
"line": 4
},
{
"kind": "handler_touched",
"line": 6,
"broad": true
},
{
"kind": "possible_swallow",
"line": 6,
"end_line": 7,
"pattern": "fallback_return"
}
]
},
{
"path": "ui.py",
"whitespace_hunks": [
{
"old_start": 1,
"old_count": 1,
"new_start": 1,
"new_count": 1
}
]
}
]
},
{
"scope": "unstaged",
"files": [
{
"path": "scratch.txt",
"status": "M"
}
]
}
]
}
The Good Case changed only totals.py:2. The fixture result moved from 6 to 5. The scan reported a clean worktree with empty findings and whitespace candidates.
Connects securely to your tools. The creator never sees your data.
About this skill
Diff Diet turns a real Git diff into structured evidence for reviewing AI-generated patches and keeping fixes small.
- Catch silent failures. Python AST scanning locates broad catches that only log, skip work, or return a default. It also flags broad
contextlib.suppresscalls. - Check defensive code against its contract. Spot common null, falsy, and type guards, including compound conditions and literal fallback assignments. Verify the caller and surrounding control flow before deleting a line.
- Check patch scope. Separate staged and unstaged changes or compare two commits. See untracked paths and whitespace-only candidates.
Deep AST scanning covers Python. Other languages get Git scope, whitespace, and worktree-status evidence. The review uses the requested task and the code's contracts to decide each finding's severity.
AST analysis is limited to Python 3.9+. Other languages are restricted to Git-level scope and whitespace analysis. Requires a local Git repository and the provided collection script.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 11 days ago
- Free with an Agensi account
- Software
Python
Permissions
What's inside
Creator
ac W
3 skills on Agensi
Frequently Asked Questions
New in Code Quality & Review
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.