codebase-onboarding
Helps developers quickly understand unfamiliar codebases by reading code, tracing paths, and explaining structure factually. Specializing in code exploration, dependency mapping, and onboarding documentation. Trigger: When onboarding to a new project, exploring an unfamiliar codebase, understanding architecture, or explaining code structure to new team members.
- License 许可
- MIT
- 最近更新
- 2026-08-26
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- codebase-onboarding
- description
- Helps developers quickly understand unfamiliar codebases by reading code, tracing paths, and explaining structure factually. Specializing in code exploration, dependency mapping, and onboarding documentation. Trigger: When onboarding to a new project, exploring an unfamiliar codebase, understanding architecture, or explaining code structure to new team members.
02 资源文件 5
- 参考文档.skill-meta.json501 B
- 脚本assets/01-example.ts35 B
- 参考文档README.md431 B
- 参考文档references/01-fundamentals.md31 B
- 参考文档references/02-practice.md35 B
03 SKILL.md 正文
When to Use
- Onboarding to a new project or codebase
- Understanding unfamiliar code structure
- Explaining codebase architecture to new team members
- Navigating large monorepos
- Auditing code before taking ownership
Core Principles
- Read code, not docs — Docs lie, code doesn't. Start from source.
- Trace, don't assume — Follow execution paths, don't guess what happens
- State facts, not opinions — "This module handles auth" not "This module is messy"
- Map before diving — Understand the forest before examining trees
Onboarding Workflow
Phase 1: Map the Territory (First 30 minutes)
1. Find entry points: main.ts, index.ts, app.ts, server.ts
2. Identify architecture: monolith? microservices? monorepo?
3. Locate config: package.json, tsconfig, docker-compose, .env.example
4. Trace dependency graph: who imports whom?
5. Identify data flow: where does user input enter? where does data persist?
Phase 2: Trace Critical Paths (Next 1-2 hours)
1. Auth flow: login → middleware → session → protected route
2. Data flow: request → controller → service → repository → DB
3. Error flow: where do errors surface? how are they handled?
4. Test flow: what's tested? what's not? where are fixtures?
Phase 3: Build Mental Model (Ongoing)
1. Module boundaries: what belongs together? what's coupled?
2. Naming patterns: how are files/classes/functions named?
3. Convention over configuration: what's implicit?
4. Pain points: what's complex? what's fragile? what's legacy?
Quick Orientation Commands
# Project structure overview
find . -type f -name "*.ts" -o -name "*.tsx" | head -50
ls -la src/
# Find entry points
grep -r "main\|bootstrap\|start" --include="*.ts" -l
# Dependency tree (who imports what)
grep -r "import.*from" src/ | sort | uniq -c | sort -rn | head -20
# Find the most-changed files (hotspots)
git log --oneline --name-only | grep -v "^$" | sort | uniq -c | sort -rn | head -20
# Find TODOs and FIXMEs (known issues)
grep -rn "TODO\|FIXME\|HACK\|XXX" src/
# Identify API endpoints
grep -rn "router\.\|app\.\(get\|post\|put\|delete\|patch\)" src/
# Find configuration
cat package.json | grep -A 5 '"scripts"'
cat tsconfig.json 2>/dev/null || cat jsconfig.json 2>/dev/null
Codebase Assessment Template
# Codebase: [Name]
## Architecture
- **Pattern**: [MVC / Clean / Hexagonal / Monolith / Microservices]
- **Language**: [Primary + versions]
- **Framework**: [Framework + version]
- **DB**: [Database + ORM]
## Entry Points
- [URL/Port] → [Handler] → [Service]
## Key Modules
| Module | Responsibility | Coupling Level |
|--------|---------------|----------------|
| auth/ | Authentication & authorization | High (used everywhere) |
| api/ | REST API handlers | Medium |
| db/ | Data access layer | Low |
## Critical Paths
1. **Auth**: `POST /login` → AuthController → AuthService → UserRepository
2. **Data**: `GET /users` → UserController → UserService → UserRepository
3. **Events**: [Message queue?] → [Handler?] → [Side effect?]
## Conventions
- File naming: [kebab-case / camelCase / PascalCase]
- Folder structure: [by-feature / by-layer]
- Error handling: [exceptions / Result type / error codes]
- Testing: [Jest / Vitest / Pytest] — [unit / integration / e2e]
## Hotspots (Most Changed Files)
1. [file] — [why it changes often]
2. [file] — [why it changes often]
## Unknowns / Questions
- [What I still don't understand]
- [What I need to ask the team]
Key Questions to Ask
Architecture:
- What's the deployment model? (containers, serverless, VMs)
- What's the CI/CD pipeline? How does code get to production?
- What are the main external dependencies? (databases, APIs, services)
Team:
- Who are the domain experts for each module?
- What's the review process? Who approves PRs?
- What are the team's biggest pain points?
History:
- What's the oldest code? What's legacy vs modern?
- Are there any known tech debt items?
- What recent refactorings have happened?
Anti-Patterns
- ❌ Don't read every file sequentially
- ❌ Don't start by running all tests
- ❌ Don't assume naming conventions — verify
- ❌ Don't modify code during onboarding (read-only first)
- ❌ Don't skip the dependency graph — it's the architecture
Resources
See references/ for detailed guides and code examples in assets/.
External Resources
- [Official Documentation]
04 同仓库更多 Skills
zustand-5
Zustand 5 state management patterns. Trigger: When managing React state with Zustand.
zod-4
Zod 4 schema validation patterns. Trigger: When using Zod for validation - breaking changes from v3.
x-bookmark-quote-posts
Workflow para revisar bookmarks de X/Twitter y convertirlos en drafts de quote posts. Accede a la sección de bookmarks vía browser headless, extrae posts recientes, y genera drafts con voz personal del usuario. No publica ni muta X — solo genera contenido para revisión. Trigger: X bookmarks, Twitter bookmarks, quote posts, bookmark automation, crear quote posts, revisar bookmarks, growth content X.
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
writing-plans
Use when you have a spec or requirements for a multi-step task, before touching code
work-unit-commits
Plan commits as reviewable work units. Trigger: implementation, commit splitting, chained PRs, or keeping tests and docs with code.