Prompt Library ⚙️ Technical Long-Context Codebase Analysis Agent
GPT-4o ⚙️ Technical Advanced

Long-Context Codebase Analysis Agent

Build an agent that ingests entire codebases using long-context models and delivers architectural analysis, security audits, and refactoring recommendations.

👁 6 views ⎘ 0 copies ♥ 0 likes

The Prompt

# Long-Context Codebase Analysis Agent

You are a senior software architect and security engineer. Design an agent that analyzes entire [LANGUAGE] codebases using long-context AI models.

## Analysis Scope

- Language and framework: [LANGUAGE]
- Codebase size estimate: [LOC] lines of code
- Primary analysis goal: [ANALYSIS_GOAL] (architecture review / security audit / refactoring plan / onboarding guide)
- Target model context window: [CONTEXT_WINDOW] tokens
- Team size: [TEAM_SIZE]

## Ingestion Strategy

Design how the agent loads the codebase within context limits:
1. Priority ordering: which files to include first (entry points, core modules, interfaces)
2. Compression strategy: how to summarize low-priority files that exceed the context budget
3. Chunking for oversized repos: how to split analysis across multiple agent runs
4. Dependency mapping: how to ensure related files are always loaded together

## Analysis Modules

**Architecture Module**
- Entry points and request flow
- Dependency graph summary
- Layering and separation of concerns violations
- Over-coupled components

**Security Module**
- Input validation gaps
- Authentication and authorization checks
- Secrets or credentials in code
- Known vulnerable patterns for [LANGUAGE]

**Quality Module**
- Dead code and unused dependencies
- Duplicated logic across files
- Functions exceeding [COMPLEXITY_THRESHOLD] cyclomatic complexity
- Test coverage gaps by module

**Debt Module**
- TODOs, FIXMEs, and temporary workarounds
- Outdated dependencies and deprecated API usage

## Output Deliverables

For each analysis type, define the report format and the top-N findings surfaced.

## Prioritization Engine

Write the scoring formula that determines which findings to fix first, weighing: security risk, business impact, effort to fix, and frequency of the affected code path.

📝 Fill in the blanks

Replace these placeholders with your own content:

[LANGUAGE]
[LOC]
[ANALYSIS_GOAL]
[CONTEXT_WINDOW]
[TEAM_SIZE]
[COMPLEXITY_THRESHOLD]

How to use this prompt

1
Copy the prompt

Click "Copy Prompt" above to copy the full prompt text to your clipboard.

2
Replace the placeholders

Swap out anything in [BRACKETS] with your specific details.

3
Paste into GPT-4o

Open your preferred AI assistant and paste the prompt to get started.