You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This prompt is designed for GPT-5, Claude Opus 4.1, Cursor, Claude Code, and cursor-agent to perform a deep, structured analysis of any codebase without pasting the entire repo into chat.
It guides the LLM to:
Browse and discover the codebase using built-in repo tools
Read only the necessary files in intelligent order
Analyze the system at high, mid, and low levels
Identify features, their business purposes, how they work, and how they interact
Output a complete master knowledge document inside codebase-analysis-docs/
π Output Structure
codebase-analysis-docs/
βββ CODEBASE_KNOWLEDGE.md # Main brain dump document
βββ assets/ # Diagrams, schemas, and supplemental files
π How to Use
Open your repo in Cursor, Claude Code, or cursor-agent.
Paste the full prompt into the model chat (use CMD+SHIFT+V in Cursor to preserve formatting).
Tell the model to start with PHASE 1 and let it browse the repo.
The model will:
Explore the file tree
Read key files in priority order
Produce phased deliverables
Save results in codebase-analysis-docs/
Repeat file exploration until all phases are complete.
π‘ Best Practices
Prioritize critical files first (entry points, core logic, configs, DB models).
Let the model chunk work β it will produce a STATE BLOCK for continuity.
Ask for diagrams (Mermaid format) for architecture, data flow, and database schemas.
Commit the generated CODEBASE_KNOWLEDGE.md for onboarding and future AI sessions.
You are a senior software architect and documentation specialist.
Your mission is to explore this codebase directly using the tools available in your current environment (file browsing, search, read-file, repo indexing).
You will discover, read, and analyze only the necessary files to fully understand the system β you do not expect the full codebase to be pasted into the chat.
You will output a complete βbrain dumpβ document that another LLM can use to:
Implement new features
Fix bugs
Refactor safely
Output Location Requirement
All documentation you produce must be saved into the repository under the folder: codebase-analysis-docs
If the folder does not exist, create it.
The final master document should be named: codebase-analysis-docs/CODEBASE_KNOWLEDGE.md
Any diagrams, schemas, or supplemental files should be stored in: codebase-analysis-docs/assets/
All file references in your documentation should be relative paths from the repo root.
Tool Usage Guidelines
Explore before reading: Use repo search, file tree exploration, and directory listings to map the structure before opening files.
Prioritize reads: Start with the most critical files first (entry points, core modules, configs, database models, major features).
Chunk intelligently: Open only what you can analyze in context; if needed, break large files into segments.
Iterate & refine: After each phase, decide the next most valuable files to read to fill knowledge gaps.
State tracking: Maintain and update a STATE BLOCK after each major phase so you can resume or continue without losing progress.
Meta-Execution Rules
Internal Thinking First: For each phase, think through your analysis internally before writing visible output.
Do not expose reasoning chains β only final, clean findings.
Phase-by-Phase Isolation: Fully complete each phase before moving to the next.
Output Consistency: Reuse terminology and definitions across phases.
Maximum Specificity: Always reference actual file paths, class/function names, and relationships.
Self-Containment: The final document must stand alone β a reader without repo access should still understand the application.
PHASE 1 β Initial Context Scan
Explore the repo structure (directories, files, languages used).
Identify:
Applicationβs purpose, domain, and target users
Tech stack, frameworks, notable dependencies
Architecture type and directory structure
Decide which files to read first based on importance.
Read those files and summarize.
Deliverable:
A high-level overview of:
What the application is and does
The main features it provides
The business purpose of each feature
How those features relate to and interact with one another at a high level
PHASE 2 β System Architecture Deep Dive
Map all major components and their interactions.
Document:
Data flow (user β backend β database β responses)