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.
Agent prompt for Claude Code and Cursor
Prompt
mkdir -p .agents/skills/audit-ai-code-diffs-for-performance-regressions && curl -sL "https://prompts-gpt.com/prompts/audit-ai-code-diffs-for-performance-regressions/raw" -o .agents/skills/audit-ai-code-diffs-for-performance-regressions/SKILL.md---
name: audit-ai-code-diffs-for-performance-regressions
description: "This prompt scans code changes for silent performance killers like N+1 queries, unindexed filters, and memory leaks before you merge them."
---
# 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.
## Prompt
```
Act as a Senior Backend Staff Engineer. Your job is to audit a code diff for performance regressions that standard unit tests miss. Before starting, ask me these 3 questions: 1. What framework or language is this project using? 2. What is the primary data storage system or database? 3. Is the code intended for high-concurrency or batch processing? After I answer, I will paste the code diff. You must analyze the diff strictly for: 1. N+1 query patterns in loops. 2. Database operations on unindexed columns. 3. Potential unbounded memory usage in data collection. 4. Improper connection pool handling or open file descriptors. Output format: # Performance Audit Report ## High-Risk Findings (Table with columns: Issue, Location, Impact, Remediation) ## Optimization Suggestions (Numbered list of specific code changes) ## Confidence Score (A percentage based on available context) This is not professional software architecture advice; consult a senior systems architect for mission-critical deployments.
```
## Usage Notes
Use this when reviewing PRs or AI-generated code blocks in Claude Code, Cursor, or GitHub Copilot. Paste your diff after answering the three setup questions to identify silent bottlenecks.
Act as a Senior Backend Staff Engineer. Your job is to audit a code diff for performance regressions that standard unit tests miss. Before starting, ask me these 3 questions: 1. What framework or language is this project using? 2. What is the primary data storage system or database? 3. Is the code intended for high-concurrency or batch processing? After I answer, I will paste the code diff. You must analyze the diff strictly for: 1. N+1 query patterns in loops. 2. Database operations on unindexed columns. 3. Potential unbounded memory usage in data collection. 4. Improper connection pool handling or open file descriptors. Output format: # Performance Audit Report ## High-Risk Findings (Table with columns: Issue, Location, Impact, Remediation) ## Optimization Suggestions (Numbered list of specific code changes) ## Confidence Score (A percentage based on available context) This is not professional software architecture advice; consult a senior systems architect for mission-critical deployments.Example output
Tips and common edits
Why this works
- Forces the model to establish technical context before evaluating the code.
- Targets specific anti-patterns like N+1 queries and memory leaks.
- Requires a structured table output for clear, actionable remediation steps.
Use this when reviewing PRs or AI-generated code blocks in Claude Code, Cursor, or GitHub Copilot. Paste your diff after answering the three setup questions to identify silent bottlenecks.
Common edits
- Adjust the list of performance checks if your stack uses NoSQL or specific caching layers like Redis.
- Ask the model to provide the exact refactored code block instead of just suggestions.
Reuse it: Use in a workflowAdapt in the builder
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
More like this
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.
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.
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.
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.
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.
Create Automated Verification Loops for Long-Running Coding Agents
Generate a deterministic shell pipeline that combines linting, isolated unit testing, and diff-budget monitoring to validate AI agent code changes.
- Create a Verification Loop Script for AI Coding Agents
- Structure a Multi-Repo Dependency Update Brief for Coding Agents
- Turn Bug Reports into Agent Reproduction Scripts and Fix Briefs
- Agent Session Handoff Brief with Resume Checklist and Verified State
- Root-Cause Bug Fix With a Failing Test and a Minimal Patch
- Claude Code Repo Recon and Implementation Plan for a New Feature