Developers & CodingUpdated October 2026

AI Coding Agent Codebase Audit & Modernization

A structured audit prompt designed for AI coding agents to evaluate an unfamiliar codebase, identify security anti-patterns, spot performance bottlenecks, and generate prioritized action plans.

Target Users: Engineering Managers, Security Auditors, and Principal Architects
Supported Workflow: Due diligence audits, technical debt assessments, and major framework migration planning
Interactive Prompt Builder

Customize & Generate Your Prompt

Adjust the variables below. Your customized prompt updates live in real-time ready to copy with zero setup.

Input Variables (3)runs 100% locally
System / Role Prompt
You are a principal software architect and application security specialist. You evaluate codebases with rigor, identifying vulnerabilities (OWASP Top 10), performance regressions, and architectural anti-patterns.
Assembled User Prompt (Live Preview)1641 chars
You are performing an exhaustive technical audit of an existing codebase.

### Codebase Context
- **Tech Stack**: Next.js 16 (App Router), TypeScript, Tailwind CSS, Prisma, PostgreSQL on Supabase, Upstash Redis
- **Primary Audit Priority**: Security Vulnerabilities & Input Validation (OWASP)
- **Known Constraints or Non-Negotiable Boundaries**:
- Must preserve existing public API contracts and response schemas.
- Must not introduce new heavy runtime dependencies.
- Must maintain backward compatibility for existing active database rows.

### Audit Directives
Analyze the provided architectural files, configuration, and patterns according to this 4-phase framework:

1. **Security & Vulnerability Assessment**:
   - Check for client-side secret exposure, unvalidated inputs, SQL/NoSQL injection risks, SSRF, and unauthenticated endpoints.
   - Evaluate authentication boundaries, session handling, and CORS policies.
2. **Performance & Resource Utilization**:
   - Identify blocking network requests, large bundle culprits, N+1 database queries, and memory leak hazards.
   - Recommend targeted optimizations (caching, query optimization, asset lazy-loading).
3. **Architecture & Code Maintainability**:
   - Assess modularity, circular dependencies, type strictness, and error-handling consistency.
   - Identify legacy patterns that should be deprecated.
4. **Actionable Remediation Matrix**:
   - Deliver a prioritized Markdown table with columns: [Issue, Severity (Critical/High/Medium/Low), Effort (S/M/L), Recommended Fix].
   - Provide code snippets showing before and after implementations for the top 2 highest-impact findings.

How to Use This Prompt Effectively

  1. 1Enter your tech stack details and choose your primary audit priority.
  2. 2Add any constraints such as uptime requirements or database preservation rules.
  3. 3Feed the prompt to your AI model alongside your repository outline or key route handlers for a comprehensive health audit.

Representative AI Output

Sample output produced when using frontier AI models with the default parameters:

### Prioritized Audit Remediation Matrix
| Issue | Severity | Effort | Recommended Fix |
| :--- | :--- | :--- | :--- |
| Unsanitized search params in SQL query | **Critical** | S | Replace raw template string with parameterized query |
| Unbounded in-memory rate limiter | **High** | M | Migrate to atomic Redis sliding window counters |
| Uncompressed dynamic images | **Medium** | S | Route through Next.js Image optimization pipeline |

Pro Optimization & Edge-Case Tips

  • Run this prompt with your `package.json`, database schemas, and main API route files for the most accurate findings.
  • Use the resulting remediation matrix directly in GitHub Issues or Linear tasks for phased team sprints.
  • Combine this with automated linting and static analysis tools like ESLint and SonarQube for continuous coverage.