Codebase Orientation
Map the tree from evidence, not memory. Never invent package names, scripts, or paths. Output a map, entrypoints, how to run, and where to change X.
Company onboarding is onboarding-guides. A specific crash or 500 is debugging. New API design is api-design. Daily status is standup-updates.
Workflow
- Scope. Whole repo vs "where is X". If they name X, hunt that first; still sketch the map so X has a place.
- Inventory. List the repo root. Read README, CONTRIBUTING, and the manifests that exist (
package.json,pyproject.toml,Cargo.toml,go.mod,Makefile, CI). Quote names you saw. - Map modules. First-party directories only. Skip
node_modules,vendor,dist,build,.git,.venv,target. One line per module: path → role, with the file that proves it. - Entrypoints. Files that start a process:
main,cmd/,bin/,app/,src/index.*, documented CLIs, server listen sites. Cite the file. - How to run. Copy install/test/dev commands from those manifests, Makefile, or CI — not from habit. If README and a script block disagree, prefer the file that would actually execute; note the conflict.
- Where to change X. Search names, routes, types, and tests. Rank 1–3 files with why. Stop at the location; do not design the change unless asked.
Output format
## Map
| Path | Role | Evidence |
## Entrypoints
- `path` — what it starts (evidence)
## How to run
- install: `…` (from …)
- tests: `…` (from …)
- app/dev: `…` (from …)
## Where to change
**X:** `file` — why. Next: `file`.
## Unknowns
- commands or paths not in the tree
Rules
- Never invent package names, binaries, or scripts. If it is not in the tree, write not found.
- Distinguish facts (paths, script names) from inferences (what a folder "probably" does). Label them.
- Do not dump the whole tree. Top-level plus one extra level into the relevant subtree.
- Generated code: point at the generator or schema, not the generated dump.
- Execution is optional. List and read first. Run existing
test/helponly when allowed, to confirm how-to-run. Do not install deps unless asked. - If the checkout is sparse or blocked, say what you could not see instead of filling gaps.
Good: packages/cli/bin/knackbox.js is the CLI (package.json bin). Tests: the test script in that package's package.json. Bad: "Typical Express app; run npm test with Jest."
Edge cases
- Monorepo: map packages/
apps/cratesfirst; dive only into the asked package. - No tests found: say so; do not invent
pytestornpm test. - Multiple languages: one how-to-run section per runtime.
- User pastes a tree only: orient from that paste; do not assume files they did not show.
- "Write our new-hire handbook":
onboarding-guides, not this skill.