Orient
Systematically explore a codebase and produce a structured orientation that
tells a developer everything they need to start working productively. Depth
scales with project size — small projects get a tight summary, large projects
get a layered map.
Phase 1 — Project Identity
Establish what the project is before reading any source code.
Read top-level files (in order of priority)
README.md / README — stated purpose, setup instructions, feature list
AGENTS.md — architecture boundaries, "always do / never do" rules
.cursor/rules/ — workspace conventions for this project
- Manifest file —
package.json, pyproject.toml, Cargo.toml, go.mod,
pom.xml, Gemfile, composer.json, or equivalent
CONTRIBUTING.md, ARCHITECTURE.md, docs/ index — if present
Extract
- One-sentence purpose: What does this project do, for whom?
- Domain: What problem space does it operate in?
- Stage: Early build, growth, or mature/stable?
- Key dependencies: Frameworks, databases, external services
If the README is absent or unhelpful, infer purpose from the manifest
description field, directory names, and import patterns.
Phase 2 — Shape
Map the physical layout without reading file contents yet.
# Get directory tree (depth 2–3 depending on project size)
find . -type f | head -200
# or
tree -L 3 -I 'node_modules|.git|dist|build|__pycache__|venv|.venv|target'
Categorize top-level directories
| Role |
Common names |
What to look for |
| Source |
src/, lib/, app/, pkg/, internal/ |
Production code |
| Tests |
test/, tests/, spec/, __tests__/ |
Test suites |
| Config |
Root dotfiles, config/, .github/ |
Build/CI/lint config |
| Docs |
docs/, doc/, wiki/ |
Documentation |
| Infra |
infra/, deploy/, terraform/, k8s/, docker/ |
Deployment |
| Scripts |
scripts/, bin/, tools/ |
Automation helpers |
| Generated |
dist/, build/, out/, target/ |
Build artifacts (skip) |
Identify the tech stack
From manifest files and directory structure, determine:
- Language(s) and version constraints
- Framework(s) — web, CLI, library, monorepo tooling
- Database / storage layer
- Build system and package manager
- CI/CD platform (from
.github/workflows/, .gitlab-ci.yml, etc.)
Phase 3 — Architecture
Now read code — but strategically. The goal is to understand the skeleton, not
every function.
Scaling strategy
| Project size |
Approach |
| Small (≤20 files) |
Read every source file. Full picture is cheap. |
| Medium (21–100 files) |
Read entry points + 3–5 core modules. Skim the rest by name/export. |
| Large (>100 files) |
Read entry points, trace one request/command end-to-end, read the 5 highest-import-count modules. |
Find entry points
Look for:
main.ts, index.ts, app.ts, server.ts — web/API entry
main.py, app.py, __main__.py, manage.py — Python entry
main.go, cmd/ — Go entry
src/main.rs, src/lib.rs — Rust entry
bin/ scripts, CLI definitions
package.json "main", "bin", "exports" fields
- Framework-specific:
pages/, app/ (Next.js), routes/ (Express/Rails)
Trace the skeleton
From entry points, follow the import graph to identify:
- Core modules — where the main logic lives
- Data layer — models, schemas, database access
- API surface — routes, handlers, controllers, exported functions
- Shared utilities — helpers used across modules
- Configuration — how settings flow into the system
Read 3–5 pivotal files fully to understand the primary abstraction patterns.
Identify boundaries
- Monorepo packages / workspaces
- Service boundaries (if microservices)
- Plugin / extension points
- Public API vs internal implementation
Phase 4 — Features and Functionality
Shift from code structure to user/consumer perspective.
For applications (web, CLI, desktop)
Enumerate:
- User-facing features (routes, pages, commands)
- Authentication / authorization model
- Data inputs and outputs
- Background jobs, workers, scheduled tasks
- External integrations (APIs, webhooks, third-party services)
For libraries / SDKs
Enumerate:
- Public exports and their purpose
- Primary use cases (from README examples or test files)
- Extension points (plugins, middleware, hooks)
- Versioning / compatibility guarantees
For infrastructure / tooling
Enumerate:
- What it provisions or manages
- Configuration surface (env vars, config files, CLI flags)
- Operational commands (deploy, rollback, scale)
Phase 5 — Conventions and Patterns
Extract the implicit rules that make contributions consistent.
Look for
- Naming: File naming (kebab, camel, pascal), variable/function style
- Code organization: Feature-based vs layer-based, barrel exports
- Error handling: Custom error types, Result patterns, try/catch strategy
- Testing: Unit vs integration split, fixture patterns, mocking approach
- State management: Where state lives, how it flows
- Type patterns: Strict vs loose typing, shared type definitions
- Logging / observability: Structured logging, tracing, metrics
Sources of truth (in priority order)
AGENTS.md explicit rules
.cursor/rules/ files
- Linter/formatter config (
.eslintrc, prettier, ruff.toml, clippy)
- Existing code patterns (what the majority of files actually do)
When explicit rules conflict with existing code, note the discrepancy.
Phase 6 — Developer Workflows
Document the practical "how do I..." answers.
Essential workflows to cover
| Workflow |
Where to find it |
| Install dependencies |
README, manifest lockfile presence |
| Run locally |
README, scripts in package.json, Makefile, docker-compose.yml |
| Run tests |
test script, CI config, test framework config |
| Build / compile |
build script, build tool config |
| Lint / format |
lint script, pre-commit hooks, editor config |
| Deploy |
CI/CD config, deploy scripts, infra/ directory |
| Add a new feature |
CONTRIBUTING.md, existing PR patterns |
Environment setup
Note any required:
- Environment variables (from
.env.example, .env.template, docs)
- External services (databases, queues, caches)
- System-level dependencies (specific runtime versions, native libs)
Output
Present findings as a structured orientation document. Adapt depth to what the
project warrants — a 10-file CLI tool does not need the same treatment as a
200-file web platform.
Format
# [Project Name] — Orientation
## What this project does
[One paragraph: purpose, domain, users/consumers, stage]
## Tech stack
[Language, framework, database, key dependencies — bullet list]
## Project structure
[Directory map with role annotations — only meaningful directories]
## Architecture
[How components connect. Entry points → core logic → data layer.
Include a brief data flow description for the primary use case.]
## Key features
[Bulleted list of what the project does from a user/consumer perspective]
## Conventions
[Naming, patterns, testing approach, error handling — the implicit rules]
## Developer workflows
[How to: install, run, test, build, deploy — with actual commands]
## Caveats and gotchas
[Anything surprising, non-obvious, or likely to trip up a new contributor]
Adaptation rules
- Skip empty sections. If there's no infra directory, don't fabricate a
deployment section.
- Flag unknowns. If something is unclear from the code alone, say so
rather than guessing.
- Prioritize actionability. A new developer should be able to start
working after reading this.
- Keep it concise. Target 1–2 pages for small projects, 3–4 for large
ones. Link to existing docs rather than reproducing them.
Principles
- Read before you conclude. Every claim about the project should be grounded
in something you actually read, not inferred from the name.
- Shape before depth. Understand the map before zooming into any territory.
- User perspective matters. Features are what the project does, not how the
code is organized.
- Flag, don't fabricate. If the README is stale or docs are missing, say so.
- Respect existing documentation. Point to it rather than restating it when
it's accurate and current.
1---2name: orient3description: Orient a developer to an unfamiliar codebase by systematically exploring its structure, purpose, features, conventions, and workflows. Produces a concise orientation document. Use when the user says "orient me", "what does this project do", "walk me through this codebase", "help me understand this repo", "onboard me", "give me the lay of the land", "codebase overview", or any variation of wanting to quickly understand a project they're new to.4license: MIT5---67# Orient89Systematically explore a codebase and produce a structured orientation that10tells a developer everything they need to start working productively. Depth11scales with project size — small projects get a tight summary, large projects12get a layered map.1314## Phase 1 — Project Identity1516Establish what the project *is* before reading any source code.1718### Read top-level files (in order of priority)19201. `README.md` / `README` — stated purpose, setup instructions, feature list212. `AGENTS.md` — architecture boundaries, "always do / never do" rules223. `.cursor/rules/` — workspace conventions for this project234. Manifest file — `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`,24 `pom.xml`, `Gemfile`, `composer.json`, or equivalent255. `CONTRIBUTING.md`, `ARCHITECTURE.md`, `docs/` index — if present2627### Extract2829- **One-sentence purpose**: What does this project do, for whom?30- **Domain**: What problem space does it operate in?31- **Stage**: Early build, growth, or mature/stable?32- **Key dependencies**: Frameworks, databases, external services3334If the README is absent or unhelpful, infer purpose from the manifest35description field, directory names, and import patterns.3637## Phase 2 — Shape3839Map the physical layout without reading file contents yet.4041```bash42# Get directory tree (depth 2–3 depending on project size)43find . -type f | head -20044# or45tree -L 3 -I 'node_modules|.git|dist|build|__pycache__|venv|.venv|target'46```4748### Categorize top-level directories4950| Role | Common names | What to look for |51|------|-------------|------------------|52| Source | `src/`, `lib/`, `app/`, `pkg/`, `internal/` | Production code |53| Tests | `test/`, `tests/`, `spec/`, `__tests__/` | Test suites |54| Config | Root dotfiles, `config/`, `.github/` | Build/CI/lint config |55| Docs | `docs/`, `doc/`, `wiki/` | Documentation |56| Infra | `infra/`, `deploy/`, `terraform/`, `k8s/`, `docker/` | Deployment |57| Scripts | `scripts/`, `bin/`, `tools/` | Automation helpers |58| Generated | `dist/`, `build/`, `out/`, `target/` | Build artifacts (skip) |5960### Identify the tech stack6162From manifest files and directory structure, determine:63- Language(s) and version constraints64- Framework(s) — web, CLI, library, monorepo tooling65- Database / storage layer66- Build system and package manager67- CI/CD platform (from `.github/workflows/`, `.gitlab-ci.yml`, etc.)6869## Phase 3 — Architecture7071Now read code — but strategically. The goal is to understand the skeleton, not72every function.7374### Scaling strategy7576| Project size | Approach |77|--------------|----------|78| **Small** (≤20 files) | Read every source file. Full picture is cheap. |79| **Medium** (21–100 files) | Read entry points + 3–5 core modules. Skim the rest by name/export. |80| **Large** (>100 files) | Read entry points, trace one request/command end-to-end, read the 5 highest-import-count modules. |8182### Find entry points8384Look for:85- `main.ts`, `index.ts`, `app.ts`, `server.ts` — web/API entry86- `main.py`, `app.py`, `__main__.py`, `manage.py` — Python entry87- `main.go`, `cmd/` — Go entry88- `src/main.rs`, `src/lib.rs` — Rust entry89- `bin/` scripts, CLI definitions90- `package.json` `"main"`, `"bin"`, `"exports"` fields91- Framework-specific: `pages/`, `app/` (Next.js), `routes/` (Express/Rails)9293### Trace the skeleton9495From entry points, follow the import graph to identify:96- **Core modules** — where the main logic lives97- **Data layer** — models, schemas, database access98- **API surface** — routes, handlers, controllers, exported functions99- **Shared utilities** — helpers used across modules100- **Configuration** — how settings flow into the system101102Read 3–5 pivotal files fully to understand the primary abstraction patterns.103104### Identify boundaries105106- Monorepo packages / workspaces107- Service boundaries (if microservices)108- Plugin / extension points109- Public API vs internal implementation110111## Phase 4 — Features and Functionality112113Shift from code structure to user/consumer perspective.114115### For applications (web, CLI, desktop)116117Enumerate:118- User-facing features (routes, pages, commands)119- Authentication / authorization model120- Data inputs and outputs121- Background jobs, workers, scheduled tasks122- External integrations (APIs, webhooks, third-party services)123124### For libraries / SDKs125126Enumerate:127- Public exports and their purpose128- Primary use cases (from README examples or test files)129- Extension points (plugins, middleware, hooks)130- Versioning / compatibility guarantees131132### For infrastructure / tooling133134Enumerate:135- What it provisions or manages136- Configuration surface (env vars, config files, CLI flags)137- Operational commands (deploy, rollback, scale)138139## Phase 5 — Conventions and Patterns140141Extract the implicit rules that make contributions consistent.142143### Look for144145- **Naming**: File naming (kebab, camel, pascal), variable/function style146- **Code organization**: Feature-based vs layer-based, barrel exports147- **Error handling**: Custom error types, Result patterns, try/catch strategy148- **Testing**: Unit vs integration split, fixture patterns, mocking approach149- **State management**: Where state lives, how it flows150- **Type patterns**: Strict vs loose typing, shared type definitions151- **Logging / observability**: Structured logging, tracing, metrics152153### Sources of truth (in priority order)1541551. `AGENTS.md` explicit rules1562. `.cursor/rules/` files1573. Linter/formatter config (`.eslintrc`, `prettier`, `ruff.toml`, `clippy`)1584. Existing code patterns (what the majority of files actually do)159160When explicit rules conflict with existing code, note the discrepancy.161162## Phase 6 — Developer Workflows163164Document the practical "how do I..." answers.165166### Essential workflows to cover167168| Workflow | Where to find it |169|----------|-----------------|170| Install dependencies | README, manifest lockfile presence |171| Run locally | README, `scripts` in package.json, `Makefile`, `docker-compose.yml` |172| Run tests | `test` script, CI config, test framework config |173| Build / compile | `build` script, build tool config |174| Lint / format | `lint` script, pre-commit hooks, editor config |175| Deploy | CI/CD config, deploy scripts, `infra/` directory |176| Add a new feature | CONTRIBUTING.md, existing PR patterns |177178### Environment setup179180Note any required:181- Environment variables (from `.env.example`, `.env.template`, docs)182- External services (databases, queues, caches)183- System-level dependencies (specific runtime versions, native libs)184185## Output186187Present findings as a structured orientation document. Adapt depth to what the188project warrants — a 10-file CLI tool does not need the same treatment as a189200-file web platform.190191### Format192193```markdown194# [Project Name] — Orientation195196## What this project does197[One paragraph: purpose, domain, users/consumers, stage]198199## Tech stack200[Language, framework, database, key dependencies — bullet list]201202## Project structure203[Directory map with role annotations — only meaningful directories]204205## Architecture206[How components connect. Entry points → core logic → data layer.207Include a brief data flow description for the primary use case.]208209## Key features210[Bulleted list of what the project does from a user/consumer perspective]211212## Conventions213[Naming, patterns, testing approach, error handling — the implicit rules]214215## Developer workflows216[How to: install, run, test, build, deploy — with actual commands]217218## Caveats and gotchas219[Anything surprising, non-obvious, or likely to trip up a new contributor]220```221222### Adaptation rules223224- **Skip empty sections.** If there's no infra directory, don't fabricate a225 deployment section.226- **Flag unknowns.** If something is unclear from the code alone, say so227 rather than guessing.228- **Prioritize actionability.** A new developer should be able to start229 working after reading this.230- **Keep it concise.** Target 1–2 pages for small projects, 3–4 for large231 ones. Link to existing docs rather than reproducing them.232233## Principles234235- Read before you conclude. Every claim about the project should be grounded236 in something you actually read, not inferred from the name.237- Shape before depth. Understand the map before zooming into any territory.238- User perspective matters. Features are what the project does, not how the239 code is organized.240- Flag, don't fabricate. If the README is stale or docs are missing, say so.241- Respect existing documentation. Point to it rather than restating it when242 it's accurate and current.