# Diff Diet

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

Diff Diet is a free AI agent skill on Agensi by ac W, in Code Quality & Review. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [ac W](https://www.agensi.io/creators/ac-w)
- Category: [Code Quality & Review](https://www.agensi.io/skills/code-quality-review)
- Version: 1.0
- Last updated: 2026-11-23
- Security: scan passed (2026-11-23); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/diff-diet
- Tags: code-review, python, git, static-analysis, ast

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

## Requires

- Python

## Known limitations

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 this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Diff Diet skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How is this more effective than just pasting a diff into a standard AI chat?

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.

### Does this skill work with languages other than Python?

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.

### Do I need to upload my entire repository to use this skill?

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.

### What does Diff Diet include?

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

### How does 'diff diet' help me find swallowed exceptions?

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.

### Can this skill help me clean up accidental IDE auto-formatting in my commits?

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

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
