A prompt specification for LLM agents (designed for Claude Code) that scans a software repository and generates structured Markdown documentation covering every dimension of the codebase — from executive summary to module-level details.
A .context/ directory at the repository root containing:
| File | What it covers |
|---|---|
CODEBASE.md |
Entry point — executive summary + index to all documents |
ARCHITECTURE.md |
System design, boundaries, topology, layers |
TECH_STACK.md |
Languages, frameworks, libraries, infra |
DOMAIN_MODEL.md |
Business entities, bounded contexts, data flow |
MODULES.md |
Module inventory, responsibilities, dependency graph |
PATTERNS.md |
Code patterns, conventions, idioms, anti-patterns |
DATA_LAYER.md |
Databases, ORMs, caching, migrations |
API_SURFACE.md |
External/internal APIs, auth, versioning |
TESTING.md |
Test strategy, frameworks, coverage |
BUILD_AND_DEPLOY.md |
CI/CD, build system, environments |
TECH_DEBT.md |
Debt areas, coupling hotspots, legacy zones |
CONVENTIONS.md |
Naming, file org, commit/PR patterns |
GLOSSARY.md |
Domain and project terminology |
Any LLM session that starts with the .context/ documents loaded has dramatically better accuracy when working on the codebase. It eliminates the cold-start problem where the LLM has to rediscover architecture, patterns, and conventions on every session.
Open Claude Code at the repository root and run:
Analyze this repository and generate complete codebase context documentation following the Codebase Context Mapper specification. Create all output files in the .context/ directory.
Analyze this repository following the Codebase Context Mapper spec. Focus deep analysis on the src/payments/ and src/billing/ modules. Do shallow analysis for everything else.
Analyze this monorepo following the Codebase Context Mapper spec. Treat each directory under apps/ as a separate application. Create a top-level index and per-app context documents.
The prompt is designed to be idempotent. Run it periodically to keep documentation in sync with code changes. It regenerates all documents from scratch rather than patching.
Decide per team whether to version-control the context docs. If not:
.context/
If yes (recommended for team-shared LLM context), commit the .context/ directory.
The full prompt specification is in PROMPT.md.