Codebase Onboarding Doc Generator
Generate a comprehensive ONBOARDING.md file that helps a new developer get productive in a codebase quickly. The doc should answer the questions a new team member would ask in their first week.
Process
1. Discover the codebase
Run these investigations in parallel to build a mental model:
Project identity:
- Read
README.md, CLAUDE.md, package.json, Cargo.toml, pyproject.toml, go.mod, or equivalent to understand the project's purpose, language, and framework
- Check for monorepo indicators (
workspaces, lerna.json, nx.json, turbo.json, pnpm-workspace.yaml)
Architecture:
- Map the top-level directory structure (
ls -la and one level deep)
- Identify the entry points (e.g.,
main.ts, index.js, app.py, cmd/, src/main.rs)
- Look for architectural patterns: routes/, controllers/, services/, models/, hooks/, components/, etc.
- Check for infrastructure config:
docker-compose.yml, Dockerfile, terraform/, k8s/, .github/workflows/
Setup and tooling:
- Find setup scripts:
Makefile, justfile, scripts/, bin/setup
- Check dependency files:
package-lock.json, yarn.lock, Pipfile.lock, poetry.lock, Gemfile.lock
- Look for environment config:
.env.example, .env.template, .envrc
- Check for database migrations:
migrations/, prisma/, alembic/, db/migrate/
Testing and CI:
- Find test directories and config:
jest.config, pytest.ini, vitest.config, .github/workflows/
- Check for linting/formatting config:
.eslintrc, .prettierrc, ruff.toml, rustfmt.toml
Gotcha indicators:
- Read
.gitignore for clues about generated files and local config
- Check for
CONTRIBUTING.md or docs/ directory
- Look for non-obvious dependencies:
.tool-versions, .nvmrc, .python-version, rust-toolchain.toml
- Scan recent git history for patterns:
git log --oneline -30
2. Identify key files
Select 10-20 files that a new developer should read first. Prioritize:
- Entry points and main application wiring
- Core domain models or types
- Key configuration files
- The most-changed files (they're often the most important):
git log --format= --name-only -100 | sort | uniq -c | sort -rn | head -20
- README and contributing guides
3. Detect common gotchas
Look for things that trip up new developers:
- Required environment variables without defaults
- Non-obvious setup steps (database seeding, code generation, certificate setup)
- Unconventional project conventions (custom scripts, unusual directory structure)
- Version pinning requirements (Node version, Python version, etc.)
- Known issues in CI/CD that affect local development
- Files or directories that look important but are generated (and shouldn't be edited)
4. Write ONBOARDING.md
Save the file to the repository root. Use this structure:
# Onboarding: [Project Name]
## What is this?
[2-3 sentence description of what the project does and who uses it]
## Architecture Overview
[High-level description of the system architecture. Include a text diagram if the system has multiple components or services.]
### Directory Structure
[Annotated tree of the important top-level directories — skip node_modules, vendor, etc.]
### Key Patterns
[Architectural patterns used: MVC, hexagonal, event-driven, etc. How data flows through the system.]
## Key Files to Read First
[Ordered list of 10-20 files with a one-line description of why each matters. Group by theme if helpful.]
## Local Setup
### Prerequisites
[Required tools and versions]
### Getting Started
[Step-by-step setup instructions — clone, install, configure, run]
### Running Tests
[How to run the test suite, including any setup needed]
### Common Commands
[Table or list of frequently used commands: build, test, lint, deploy, etc.]
## Common Gotchas
[Numbered list of things that trip up new developers, with solutions]
## Useful Links
[Links to relevant docs, dashboards, design docs, Slack channels, etc. — only if discoverable from the repo]
Writing guidelines
- Write for someone who is a competent developer but knows nothing about this specific codebase
- Be concrete — use actual file paths, actual command names, actual environment variable names
- If you're uncertain about something (e.g., whether a setup step is still current), flag it with a "Verify:" note rather than guessing
- Keep the total doc under 300 lines — long onboarding docs don't get read
- Don't include information you can't verify from the codebase itself
1---2name: onboard3description: Generates a comprehensive ONBOARDING.md for a codebase, covering architecture, key files, setup, and common gotchas.4---56# Codebase Onboarding Doc Generator78Generate a comprehensive `ONBOARDING.md` file that helps a new developer get productive in a codebase quickly. The doc should answer the questions a new team member would ask in their first week.910## Process1112### 1. Discover the codebase1314Run these investigations in parallel to build a mental model:1516**Project identity:**17- Read `README.md`, `CLAUDE.md`, `package.json`, `Cargo.toml`, `pyproject.toml`, `go.mod`, or equivalent to understand the project's purpose, language, and framework18- Check for monorepo indicators (`workspaces`, `lerna.json`, `nx.json`, `turbo.json`, `pnpm-workspace.yaml`)1920**Architecture:**21- Map the top-level directory structure (`ls -la` and one level deep)22- Identify the entry points (e.g., `main.ts`, `index.js`, `app.py`, `cmd/`, `src/main.rs`)23- Look for architectural patterns: routes/, controllers/, services/, models/, hooks/, components/, etc.24- Check for infrastructure config: `docker-compose.yml`, `Dockerfile`, `terraform/`, `k8s/`, `.github/workflows/`2526**Setup and tooling:**27- Find setup scripts: `Makefile`, `justfile`, `scripts/`, `bin/setup`28- Check dependency files: `package-lock.json`, `yarn.lock`, `Pipfile.lock`, `poetry.lock`, `Gemfile.lock`29- Look for environment config: `.env.example`, `.env.template`, `.envrc`30- Check for database migrations: `migrations/`, `prisma/`, `alembic/`, `db/migrate/`3132**Testing and CI:**33- Find test directories and config: `jest.config`, `pytest.ini`, `vitest.config`, `.github/workflows/`34- Check for linting/formatting config: `.eslintrc`, `.prettierrc`, `ruff.toml`, `rustfmt.toml`3536**Gotcha indicators:**37- Read `.gitignore` for clues about generated files and local config38- Check for `CONTRIBUTING.md` or `docs/` directory39- Look for non-obvious dependencies: `.tool-versions`, `.nvmrc`, `.python-version`, `rust-toolchain.toml`40- Scan recent git history for patterns: `git log --oneline -30`4142### 2. Identify key files4344Select 10-20 files that a new developer should read first. Prioritize:45- Entry points and main application wiring46- Core domain models or types47- Key configuration files48- The most-changed files (they're often the most important): `git log --format= --name-only -100 | sort | uniq -c | sort -rn | head -20`49- README and contributing guides5051### 3. Detect common gotchas5253Look for things that trip up new developers:54- Required environment variables without defaults55- Non-obvious setup steps (database seeding, code generation, certificate setup)56- Unconventional project conventions (custom scripts, unusual directory structure)57- Version pinning requirements (Node version, Python version, etc.)58- Known issues in CI/CD that affect local development59- Files or directories that look important but are generated (and shouldn't be edited)6061### 4. Write ONBOARDING.md6263Save the file to the repository root. Use this structure:6465```markdown66# Onboarding: [Project Name]6768## What is this?69[2-3 sentence description of what the project does and who uses it]7071## Architecture Overview72[High-level description of the system architecture. Include a text diagram if the system has multiple components or services.]7374### Directory Structure75[Annotated tree of the important top-level directories — skip node_modules, vendor, etc.]7677### Key Patterns78[Architectural patterns used: MVC, hexagonal, event-driven, etc. How data flows through the system.]7980## Key Files to Read First81[Ordered list of 10-20 files with a one-line description of why each matters. Group by theme if helpful.]8283## Local Setup8485### Prerequisites86[Required tools and versions]8788### Getting Started89[Step-by-step setup instructions — clone, install, configure, run]9091### Running Tests92[How to run the test suite, including any setup needed]9394### Common Commands95[Table or list of frequently used commands: build, test, lint, deploy, etc.]9697## Common Gotchas98[Numbered list of things that trip up new developers, with solutions]99100## Useful Links101[Links to relevant docs, dashboards, design docs, Slack channels, etc. — only if discoverable from the repo]102```103104### Writing guidelines105106- Write for someone who is a competent developer but knows nothing about this specific codebase107- Be concrete — use actual file paths, actual command names, actual environment variable names108- If you're uncertain about something (e.g., whether a setup step is still current), flag it with a "Verify:" note rather than guessing109- Keep the total doc under 300 lines — long onboarding docs don't get read110- Don't include information you can't verify from the codebase itself