Diff Diet

    by ac W

    1

    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

    Security scanned

    Works with the AI Agents you already use

    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 a RuntimeError into sum, and the call returned 0. Remove the catch and keep the corrected return 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 accepts tuple[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.suppress calls.
    • 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. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 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

    Terminal / Shell
    Read Files
    Write Files
    Environment Variables
    Listed11 days ago

    What's inside

    Creator

    ac W

    ac W

    3 skills on Agensi

    Frequently Asked Questions

    The skill uses Python's Abstract Syntax Tree (AST) to analyze the actual logic and control flow of your code, whereas standard LLMs often rely on pattern matching and can miss subtle redundancies or hallucinate whitespace changes.

    Deep logical analysis like redundant guard detection and exception tracing is currently exclusive to Python (3.9+). For all other languages, the skill provides Git scope drift detection and whitespace auditing.

    The tool performs a local analysis of your Git diffs and worktree status, meaning it evaluates the code as it exists in your environment rather than just reviewing a static text file.

    The package includes SKILL.md and a Python standard-library scanner that collects structured evidence from a local Git repository.

    It is designed to identify broad 'try-except' blocks or 'contextlib.suppress' calls that were added in a patch, flagging instances where errors might be silenced without proper handling.

    Yes. The scan flags hunks that differ only in whitespace. Verify indentation, strings, and syntax before deciding whether a hunk belongs in the patch.

    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.

    Free