DiffDoctor is an open-standard Agent Skill (SKILL.md) that solves the 441% code review bottleneck. It automatically inspects git diffs, PR branches, and AI modifications for the 6 Classic AI Traps before code ever reaches human review or production CI.
Recent 2026 telemetry across 8.1M pull requests (LinearB & Faros AI) reveals a crisis in AI code quality:
- Review time has surged by 441.5%: Engineers spend 5x longer reviewing AI code because errors are subtle, plausible, and easy to overlook.
- PR acceptance dropped to 32.7%: Down from 84.4% for human-authored PRs.
- The "Almost-Right" Trap: 66% of developers report that AI produces code that looks working on the surface, but conceals swallowed exceptions, weakened tests, and silent regressions.
Run DiffDoctor against any active git diff, base branch, or .patch file with zero configuration:
# 1. Audit active git diff (staged + unstaged)
$ diffdoctor
# 2. Audit branch against main branch
$ diffdoctor origin/main
# 3. Audit a patch file
$ diffdoctor my_feature.patch
# 4. Generate GitHub PR review comment markdown
$ diffdoctor --markdown
# 5. Install automated pre-commit hook
$ diffdoctor --install-hook🩺 DiffDoctor AI Review Triage — Safety Grade: [F]
======================================================
• [CRITICAL] Trap: Test Theater at test/billing.test.ts:20
Issue: Skipped test suite or test case
Code : it.skip('should charge customer accurately', async () => {
💡 Remedy: Restore strict equality assertions (`expect(val).toEqual(...)`) and fix the underlying typing or test logic.
• [CRITICAL] Trap: Swallowed Exception at src/services/billing.ts:15
Issue: Catch block contains no error handling or recovery logic
Code : catch (...) { ... }
💡 Remedy: Replace empty catch/except with error logging or explicit rethrow:
catch (error) {
logger.error("Failed to complete operation", error);
throw error;
}
• [WARNING] Trap: Debug Debris at src/services/billing.ts:13
Issue: Leftover console.log debug statement
Code : console.log("Charged:", result);
💡 Remedy: Remove all temporary `console.log(...)`, `debugger;`, and debug print statements prior to committing.
================================================ ❌ FAILED: Severe traps detected. Resolve before submitting PR.
---
## 🩺 The 6 Classic AI Traps Checked
| Trap | How AI Injects It | DiffDoctor Remedy |
|---|---|---|
| **1. Test Theater** | Softens assertions to `toBeTruthy()`, skips tests (`it.skip`), or adds `@ts-ignore` to fake green CI. | Flags weakened tests and forces strict deep-equality assertions. |
| **2. Swallowed Exceptions** | Silently catches errors with empty `catch (e) {}` blocks, hiding runtime failures from monitoring. | Flags unhandled error blocks and demands explicit error handling. |
| **3. Phantom Imports** | Hallucinates packages or methods not listed in project manifests. | Verifies import resolution against installed dependencies. |
| **4. Unintended Scope Creep** | AI quietly modifies lockfiles, `tsconfig.json`, or unprompted files. | Warns when sensitive configuration files are touched. |
| **5. Missing Edge States** | Generates views with 0 handling for Empty, Loading, and Network Error states. | Mandates explicit edge-case branches before PR approval. |
| **6. Reinvented Helpers** | Re-implements helper functions when standard repo utilities already exist. | Enforces reuse of canonical utilities. |
---
## 🚀 Universal Agent Installation
### 1. Claude Code
Install directly into your project's skills directory:
```bash
git clone https://github.com/subinz1/diffdoctor-skill.git .claude/skills/diffdoctor
Copy SKILL.md into .cursor/rules/ or add to project rules.
Clone into .codex/skills/ or reference SKILL.md in your agent prompt.
Block trap-laden diffs before git commit:
echo "python3 scripts/diffdoctor.py" >> .git/hooks/pre-commit
chmod +x .git/hooks/pre-commitname: DiffDoctor AI PR Audit
on: [pull_request]
jobs:
diffdoctor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: python3 scripts/diffdoctor.py --diff-file <(git diff origin/main...HEAD)DiffDoctor has zero npm or pip dependencies. It runs in under 5 milliseconds using Python standard libraries (re, subprocess, argparse, json).
diffdoctor-skill/
├── SKILL.md # Universal Agent Skill specification
├── scripts/
│ └── diffdoctor.py # Zero-dependency diff triage scanner
├── references/
│ └── AI_REVIEW_TRAPS.md # Comprehensive 6 Classic AI Traps guide
├── fixtures/
│ ├── trapped_diff.patch # Real-world diff exhibiting AI traps (Grade F)
│ └── healthy_diff.patch # Hardened, production-ready diff (Grade A)
├── tests/
│ └── test_diffdoctor.py # Automated unit test suite
├── package.json
├── LICENSE # MIT License
└── TODO.md # Phase 2 roadmap (GitHub PR bot, auto-remedy commit)
MIT © Subin George