dev-workflow

Prompt: Codebase Audit

Use this prompt with Claude Code (or similar AI coding assistant) to run a comprehensive codebase audit across one or more repositories. Produces an executive summary with scorecard and detailed per-area reports.


Prerequisites

Run this from a parent directory containing all project repos. Ensure all repos are on their main/master branch and recently pulled.

Instructions for AI

You are conducting a codebase audit for a multi-repo software platform. The audit is an objective technical report intended for founders and stakeholders — not a task list for the development team. Be factual, reference specific files and line numbers, and avoid defensive or apologetic framing.

Setup

  1. Identify all repositories in scope.
  2. Read every settings file, config file, CI/CD workflow, and dependency manifest.
  3. Read environment/secrets files if provided (do NOT include real credential values in any output).
  4. Ask the user for context: team size, how long the codebase has been maintained, any known constraints.

Reports to Create

Create all reports in an audit/ subdirectory. Each report is a standalone markdown file.

1. audit/executive-summary-action-plan.md — Executive Summary

Write this LAST, after all other reports are complete. Structure:

# Platform — Audit Summary & Action Plan
> Date: YYYY-MM-DD | Scope: repo-a, repo-b, repo-c

## Executive Summary
One paragraph: what was reviewed, team context.

### Scorecard
| Area | Score | For a Small Startup Team | Path to Improvement | What It Means |
Use /10 scoring. Include adjusted score for team size. "Path to Improvement" indicates
whether fixes are easy config changes, incremental refactoring, or fundamental rework.
State findings factually — do not justify or defend gaps.

### Top 5 Strengths
Numbered list of what the codebase does well.

### Top 5 Risks
Numbered list of the most impactful issues.

## Platform Architecture
Architecture diagram (or reference to one) + brief description of tier separation
and communication patterns.

## [Per-Area Sections]
For each audit area: **Highlights** (what works) and **Concerns** (what doesn't).
Include the score in the heading: "## Security — 4/10"

## Action Plan
Table of prioritized items organized by sprint/phase:
| # | Action | Area | Effort |
Mark as "findings from the audit — not prescriptive assignments."

## Appendix: Audit Methodology
Document: process (scope → exploration → documentation → scoring), what was reviewed,
what was NOT reviewed (production metrics, pen testing, etc.), tools used.

2. audit/security-audit.md — Security

3. audit/code-quality-architecture.md — Code Quality & Architecture

4. audit/performance-audit.md — Performance

5. audit/error-documentation.md — Error Handling

6. audit/third-party-integrations.md — Third-Party Integrations

7. audit/infrastructure-ci-cd.md — Infrastructure & CI/CD

8. audit/testing-coverage.md — Testing

9. audit/documentation-audit.md — Documentation

10. audit/blockchain-audit.md (if applicable)

Scoring Guidelines

Score Meaning
9-10 Industry best practice. Few or no issues.
7-8 Solid. Minor gaps that don’t pose risk.
5-6 Functional but with notable gaps. Works for current scale.
3-4 Significant gaps. Risks exist that need addressing.
1-2 Critical gaps. Major risk area.

For “Small Startup Team” adjusted score: add 1-2 points where the gap is clearly due to team size/time constraints rather than poor decisions. Do not adjust for gaps that would exist regardless of team size (e.g., shared credentials, no error monitoring).

Tone Guidelines

Process

  1. If documentation was generated from Prompt 1, read all generated docs before starting the audit. Reference the documentation where relevant rather than re-describing architecture.
  2. Read all repos thoroughly before writing anything. Scan: settings, configs, CI/CD, dependencies, env files, model files, view/controller files, test files, README files.
  3. Create a plan listing all reports and key findings per area.
  4. Write detailed reports first (security, code quality, etc.).
  5. Write the executive summary LAST — it synthesizes the detailed reports.
  6. Review all files for: real credential values (remove), defensive language (rewrite), factual accuracy.
  7. Skip section 10 (Blockchain Audit) unless the project has blockchain/smart contract components.
  8. Update CLAUDE.md and README.md to link to the audit reports.