Project Documentation
Analyze and document existing codebases to enable AI-assisted development. Systematically scan projects, detect architecture patterns, and generate structured documentation that helps both humans and AI agents understand how to extend the codebase.
Scanning Approach
Perform a thorough scan because AI agents downstream need complete context to make safe code changes. This means:
- Prioritize source directories --
src/, app/, lib/, components/, api/, services/
- Skip generated and vendor code --
node_modules/, dist/, build/, .next/, vendor/, __pycache__/. These are reproducible and add noise without insight
- Sample large test suites -- read representative test files to understand patterns, then note coverage scope. Reading every test file in a 500-file suite is diminishing returns
- Read all config files --
package.json, tsconfig.json, .env.example, CI configs. These are small and high-signal
- Trace entry points fully -- follow the main entry points through the call graph to understand the core architecture
The goal is to produce documentation thorough enough that an AI agent could plan and implement a new feature using only these docs as context.
Workflow
Step 1: Detect Project Structure
Analyze the project root:
- Identify package managers (
package.json, go.mod, requirements.txt, Cargo.toml)
- Detect framework markers (
next.config.*, nuxt.config.*, angular.json)
- Analyze directory layout (
src/, app/, lib/, components/)
- Determine repo type: monolith, monorepo, or multi-part
See references/project-types.md for classification details.
Step 2: Classify Project Type
Match against known types: web, mobile, backend, cli, library, desktop, data, infra. See references/project-types.md for key patterns and critical directories per type.
Step 3: Scan the Codebase
Run these scans against all relevant source code:
| Scan |
Focus Areas |
Key Directories |
| API |
Routes, HTTP methods, auth, middleware |
controllers/, routes/, api/, handlers/ |
| Data Models |
Schemas, relationships, constraints, migrations |
models/, schemas/, prisma/, migrations/ |
| UI Components |
Component library, props, design patterns |
components/, ui/, widgets/ |
| State Management |
Stores, actions, data flow, side effects |
store/, state/, context/ |
| Configuration |
Env vars, build config, feature flags |
root config files, .env.example |
| Tests |
Frameworks, patterns, fixtures, coverage |
tests/, __tests__/, spec/ |
Step 4: Generate Documentation
Generate documentation files into docs/ (or user-specified location). By default, produce all 12 documents. Each template is in references/.
Optional: references/adr.md for Architecture Decision Records.
When generating each document:
- Read the template from
references/
- Fill all
{placeholder} values with actual findings from the scan
- Mark truly inapplicable sections as "Not applicable to this project type"
Step 5: Validate
Use references/validation-checklist.md to verify:
- No
{placeholder} text remains
- No "TODO" or "TBD" markers
- All links resolve correctly
- Examples are realistic
- Mermaid diagrams render
Presets
Users can request a focused subset instead of all 12 documents:
| Preset |
Documents |
--preset=core |
index, project-overview, source-tree-analysis, architecture, development-guide |
--preset=api |
index, architecture, api-contracts, data-models, configuration |
--preset=frontend |
index, architecture, component-inventory, state-management, testing-guide |
--preset=devops |
index, configuration, deployment-guide, testing-guide |
--preset=minimal |
index, project-overview, architecture |
Users can also select or exclude individual documents:
- "Generate only: architecture, api-contracts, data-models"
- "Generate full docs except: component-inventory, state-management"
index.md is included with every selection because it serves as the navigation hub.
Multi-Part Projects
For projects with multiple parts (client/server, microservices):
- Detect all parts by scanning for separate package managers
- Document each part with part-specific files (e.g.,
architecture-client.md)
- Create an integration document covering communication patterns and shared dependencies
- Link everything from a unified
index.md
Write-As-You-Go
To manage context efficiently during generation:
- Write each document immediately after generating it (do not hold all docs in memory)
- Validate each section before moving on
- Keep only summaries in working context after writing
Example Output
A generated project-overview.md looks like this (abbreviated):
# MyApp - Project Overview
**Type:** Web Application (React + TypeScript)
**Framework:** Next.js 14 (App Router)
**Database:** PostgreSQL via Prisma ORM
**State:** Zustand + React Query
## Architecture Summary
Server-rendered React application using Next.js App Router with
API routes serving a PostgreSQL database through Prisma. Authentication
via NextAuth.js with Google and GitHub providers.
## Key Entry Points
| Entry Point | Path | Purpose |
|-------------|------|---------|
| App root | `src/app/layout.tsx` | Root layout with providers |
| API routes | `src/app/api/` | REST endpoints |
| DB schema | `prisma/schema.prisma` | Data model definitions |
## Tech Stack
| Layer | Technology | Version |
|-------|-----------|---------|
| Frontend | React | 18.2 |
| Framework | Next.js | 14.1 |
| Database | PostgreSQL | 15 |
| ORM | Prisma | 5.8 |
| Auth | NextAuth.js | 4.24 |
Best Practices
- CommonMark compliance -- all markdown must follow CommonMark spec
- No time estimates -- they vary too much to be useful
- Active voice, present tense -- "The function returns" not "The function will return"
- Task-oriented -- write for user goals, not feature lists
- Mermaid diagrams -- use appropriate types (flowchart, sequenceDiagram, erDiagram, classDiagram). Keep diagrams focused: 5-10 nodes ideal, 15 max
Additional References
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: j03fr0st-maestro-project-documentation3description: Project Documentation4---56# Project Documentation78Analyze and document existing codebases to enable AI-assisted development. Systematically scan projects, detect architecture patterns, and generate structured documentation that helps both humans and AI agents understand how to extend the codebase.910## Scanning Approach1112Perform a thorough scan because AI agents downstream need complete context to make safe code changes. This means:1314- **Prioritize source directories** -- `src/`, `app/`, `lib/`, `components/`, `api/`, `services/`15- **Skip generated and vendor code** -- `node_modules/`, `dist/`, `build/`, `.next/`, `vendor/`, `__pycache__/`. These are reproducible and add noise without insight16- **Sample large test suites** -- read representative test files to understand patterns, then note coverage scope. Reading every test file in a 500-file suite is diminishing returns17- **Read all config files** -- `package.json`, `tsconfig.json`, `.env.example`, CI configs. These are small and high-signal18- **Trace entry points fully** -- follow the main entry points through the call graph to understand the core architecture1920The goal is to produce documentation thorough enough that an AI agent could plan and implement a new feature using only these docs as context.2122## Workflow2324### Step 1: Detect Project Structure2526Analyze the project root:2728- Identify package managers (`package.json`, `go.mod`, `requirements.txt`, `Cargo.toml`)29- Detect framework markers (`next.config.*`, `nuxt.config.*`, `angular.json`)30- Analyze directory layout (`src/`, `app/`, `lib/`, `components/`)31- Determine repo type: monolith, monorepo, or multi-part3233See [references/project-types.md](./references/project-types.md) for classification details.3435### Step 2: Classify Project Type3637Match against known types: **web**, **mobile**, **backend**, **cli**, **library**, **desktop**, **data**, **infra**. See [references/project-types.md](./references/project-types.md) for key patterns and critical directories per type.3839### Step 3: Scan the Codebase4041Run these scans against all relevant source code:4243| Scan | Focus Areas | Key Directories |44|------|-------------|-----------------|45| API | Routes, HTTP methods, auth, middleware | `controllers/`, `routes/`, `api/`, `handlers/` |46| Data Models | Schemas, relationships, constraints, migrations | `models/`, `schemas/`, `prisma/`, `migrations/` |47| UI Components | Component library, props, design patterns | `components/`, `ui/`, `widgets/` |48| State Management | Stores, actions, data flow, side effects | `store/`, `state/`, `context/` |49| Configuration | Env vars, build config, feature flags | root config files, `.env.example` |50| Tests | Frameworks, patterns, fixtures, coverage | `tests/`, `__tests__/`, `spec/` |5152### Step 4: Generate Documentation5354Generate documentation files into `docs/` (or user-specified location). By default, produce all 12 documents. Each template is in `references/`.5556| Document | Template | Purpose |57|----------|----------|---------|58| `index.md` | [references/index.md](./references/index.md) | Master navigation hub |59| `project-overview.md` | [references/project-overview.md](./references/project-overview.md) | Executive summary |60| `source-tree-analysis.md` | [references/source-tree-analysis.md](./references/source-tree-analysis.md) | Annotated directory tree |61| `architecture.md` | [references/architecture.md](./references/architecture.md) | Technical architecture |62| `component-inventory.md` | [references/component-inventory.md](./references/component-inventory.md) | UI component catalog |63| `development-guide.md` | [references/development-guide.md](./references/development-guide.md) | Setup and workflow |64| `api-contracts.md` | [references/api-contracts.md](./references/api-contracts.md) | API documentation |65| `data-models.md` | [references/data-models.md](./references/data-models.md) | Database schemas |66| `state-management.md` | [references/state-management.md](./references/state-management.md) | State patterns and flow |67| `testing-guide.md` | [references/testing-guide.md](./references/testing-guide.md) | Test structure |68| `configuration.md` | [references/configuration.md](./references/configuration.md) | Environment config |69| `deployment-guide.md` | [references/deployment-guide.md](./references/deployment-guide.md) | Deployment process |7071Optional: [references/adr.md](./references/adr.md) for Architecture Decision Records.7273When generating each document:74751. Read the template from `references/`762. Fill all `{placeholder}` values with actual findings from the scan773. Mark truly inapplicable sections as "Not applicable to this project type"7879### Step 5: Validate8081Use [references/validation-checklist.md](./references/validation-checklist.md) to verify:8283- No `{placeholder}` text remains84- No "TODO" or "TBD" markers85- All links resolve correctly86- Examples are realistic87- Mermaid diagrams render8889## Presets9091Users can request a focused subset instead of all 12 documents:9293| Preset | Documents |94|--------|-----------|95| `--preset=core` | index, project-overview, source-tree-analysis, architecture, development-guide |96| `--preset=api` | index, architecture, api-contracts, data-models, configuration |97| `--preset=frontend` | index, architecture, component-inventory, state-management, testing-guide |98| `--preset=devops` | index, configuration, deployment-guide, testing-guide |99| `--preset=minimal` | index, project-overview, architecture |100101Users can also select or exclude individual documents:102- *"Generate only: architecture, api-contracts, data-models"*103- *"Generate full docs except: component-inventory, state-management"*104105`index.md` is included with every selection because it serves as the navigation hub.106107## Multi-Part Projects108109For projects with multiple parts (client/server, microservices):1101111. Detect all parts by scanning for separate package managers1122. Document each part with part-specific files (e.g., `architecture-client.md`)1133. Create an integration document covering communication patterns and shared dependencies1144. Link everything from a unified `index.md`115116## Write-As-You-Go117118To manage context efficiently during generation:1191201. Write each document immediately after generating it (do not hold all docs in memory)1212. Validate each section before moving on1223. Keep only summaries in working context after writing123124## Example Output125126A generated `project-overview.md` looks like this (abbreviated):127128```markdown129# MyApp - Project Overview130131**Type:** Web Application (React + TypeScript)132**Framework:** Next.js 14 (App Router)133**Database:** PostgreSQL via Prisma ORM134**State:** Zustand + React Query135136## Architecture Summary137138Server-rendered React application using Next.js App Router with139API routes serving a PostgreSQL database through Prisma. Authentication140via NextAuth.js with Google and GitHub providers.141142## Key Entry Points143144| Entry Point | Path | Purpose |145|-------------|------|---------|146| App root | `src/app/layout.tsx` | Root layout with providers |147| API routes | `src/app/api/` | REST endpoints |148| DB schema | `prisma/schema.prisma` | Data model definitions |149150## Tech Stack151152| Layer | Technology | Version |153|-------|-----------|---------|154| Frontend | React | 18.2 |155| Framework | Next.js | 14.1 |156| Database | PostgreSQL | 15 |157| ORM | Prisma | 5.8 |158| Auth | NextAuth.js | 4.24 |159```160161## Best Practices162163- **CommonMark compliance** -- all markdown must follow CommonMark spec164- **No time estimates** -- they vary too much to be useful165- **Active voice, present tense** -- "The function returns" not "The function will return"166- **Task-oriented** -- write for user goals, not feature lists167- **Mermaid diagrams** -- use appropriate types (flowchart, sequenceDiagram, erDiagram, classDiagram). Keep diagrams focused: 5-10 nodes ideal, 15 max168169## Additional References170171- [Project Type Detection](./references/project-types.md)172- [Example Prompts](./references/examples.md)173- [Validation Checklist](./references/validation-checklist.md)174175---176> Converted and distributed by [TomeVault](https://tomevault.io/claim/j03fr0st) — claim your Tome and manage your conversions.177<!-- tomevault:4.0:skill_md:2026-04-15 -->