Review AI Pull Requests for Phantom Imports and Bloat

Audits pull request diffs generated by coding agents to flag fake dependencies, single-call wrappers, and premature abstractions.

Agent prompt for Claude Code and Cursor

You get: Unresolved Dependencies, over-Engineered Layers and review Verdict

Prompt

Prompt
Act as a principal software engineer conducting a strict code review on an AI-generated pull request. I will paste the git diff alongside our project dependency manifest (such as package.json, pyproject.toml, or Cargo.toml).

Review the submission against these rules:
1. Verify every newly introduced import against the provided manifest; mark any missing package as an unverified external dependency.
2. Identify phantom abstractions: single-use wrapper functions, unnecessary factory patterns, or utility classes created around native platform APIs.
3. Spot over-engineered typing, such as multi-level generic interfaces created for one concrete implementation.
4. Propose inline simplifications that replace synthetic helpers with standard library or direct native calls.

Output format:
- Unresolved Dependencies: table with columns Import Path, Status (Hallucinated or Missing from Manifest), Suggested Native Alternative.
- Over-Engineered Layers: numbered list of phantom abstractions with file name, lines, why it is redundant, and the exact simplified replacement.
- Review Verdict: approve, request changes, or reject with one summary sentence.

State any assumptions about missing context or unpasted files before the final verdict.

Example output

Flagged imports and their native alternativesTwo unresolved dependencies in the tenant auth diff
ItemStatusNative alternative
jwt_claims_extractorHallucinatedDict access on pyjwt.decode() output
dateparser_utilsMissing from Manifestdatetime.datetime.fromisoformat()

Example for: a Python FastAPI service diff touching tenant authentication and token parsing.

Unresolved Dependencies
Import PathStatusSuggested Native Alternative
jwt_claims_extractorHallucinatedUse native dictionary access on pyjwt.decode() output
dateparser_utilsMissing from ManifestUse standard library datetime.datetime.fromisoformat()
Over-Engineered Layers
  1. app/auth/factory.py, lines 14-38: TokenParserFactory and AbstractTokenParser interface.

    • Redundancy: The codebase only supports standard RS256 JWTs. The factory abstracts a single class that wraps two PyJWT calls.
    • Simplified replacement:
    def parse_user_token(raw_token: str, public_key: str) -> dict:
        return jwt.decode(raw_token, public_key, algorithms=["RS256"])
  2. app/utils/tenant_string.py, lines 5-16: TenantStringSanitizer utility class.

    • Redundancy: Created a class with static methods to strip whitespace and lowercase strings, called in exactly one controller endpoint.
    • Simplified replacement: Inline tenant_slug.strip().lower() directly inside app/api/tenants.py.
Assumptions

Assumes the repository relies exclusively on pyproject.toml for dependencies and does not vendor untracked wheels in another directory.

Review Verdict

Request Changes: Remove the hallucinated package imports and replace the token parser factory with a single standalone validation function.

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • Forces a side-by-side reconciliation between actual import statements and the project dependency manifest.
  • Specifically targets AI habits like generating unnecessary abstract classes and factory wrappers for single calls.
  • Demands direct standard-library replacements rather than vague refactoring advice.

Paste your git diff and package manifest directly after the prompt in Claude Code, Cursor, Codex, or GitHub Copilot chat before merging agent PRs.

Common edits

  • Add your team's specific package manager check, like enforcing pnpm or poetry lockfile parity.
  • Add a rule to enforce maximum file length or prevent the introduction of new utility files entirely.

Reuse it: Use in a workflowAdapt in the builder

Prompt details

By
Prompts-GPT editors
Published
How prompts are written and checked

Did this prompt work?

AI Coding AgentsClaude Code

Audit PR Git Diffs for Scope Creep and Churn

Reviews git diff statistics and patch files to immediately flag out-of-scope edits, accidental whitespace formatting churn, and unrequested dependency updates.

AI Coding AgentsClaude Code

Verify the Coding Agent's 'Done' Claim Against the Diff and Test Output

Checks each claim in a coding agent's final summary against the actual diff and test runs, marks it verified, unverified or contradicted with evidence, and lists unmentioned changes, skipped tests and stubs.

AI Coding AgentsClaude Code

Audit AI Code Diffs for Performance Regressions

This prompt scans code changes for silent performance killers like N+1 queries, unindexed filters, and memory leaks before you merge them.

AI Coding AgentsClaude Code

Evaluate Coding Agent Test Suites for False Positive Traps

Audits agent-generated unit tests to catch tautological assertions, over-mocking, and tests that still pass when core business logic is disabled.

AI Coding AgentsClaude Code

Pre-Merge Self-Review of a Git Diff: Correctness, Security, and Test Gaps

Has Claude Code review a branch diff like a skeptical maintainer, producing severity-ranked findings with evidence and a clear merge, fix, or block recommendation. Use it before opening or approving a pull request.

AI Coding AgentsClaude Code

Convert User Stories into Strict Acceptance Test Assertions

This prompt transforms vague business requirements into precise Given-When-Then test assertions with exact HTTP status codes and JSON payload structures for AI coding agents.