Module 1: Onboarding with AI — 5-10x Faster

The Cost of Manual Onboarding and Why AI Transforms It

The Cost of Manual Onboarding and Why AI Transforms It

Capsule description

You join a new team. You're assigned a 20K-line codebase with partial documentation, an outdated wiki, and a colleague who "can explain it to you when they have time." You spend the first two weeks reading code, grepping, asking on Slack, and building a fragmented mental model that doesn't click until the third week. It's the universal onboarding experience in software — and it's extraordinarily expensive.

This capsule puts concrete numbers on the problem. Manual onboarding to a medium codebase costs between $15K and $30K in lost productivity per developer. Not because of incompetence — because of the nature of the process: reading code is slow, context is lost between files, documentation lies, and tribal knowledge lives in the heads of people who are busy. You're going to understand why the process is slow, what makes it expensive, and how Claude Code changes the equation by making reading and analyzing code orders of magnitude faster.

By the end of this capsule you'll have a clear understanding of the problem we solve in this module, you'll have seen your first demo of Claude Code exploring an unfamiliar project, and you'll have data-based motivation to invest in a systematic method for onboarding with AI.


The Real Cost of Manual Onboarding

The numbers nobody measures

When a developer joins an existing team, the time to full productivity follows a predictable pattern:

PhaseTypical durationWhat happens
OrientationDays 1-3Local setup, permissions, meeting the team, reading READMEs
ExplorationDays 4-10Reading code, grepping, asking questions, understanding the structure
Partial comprehensionWeeks 2-3Understanding the main modules, making a first small change, requesting code review
Basic productivityWeek 4+Making changes without constant supervision, understanding 60-70% of the codebase

The direct cost:

For a developer with a $100K-$150K annual salary (or the region-adjusted equivalent):

Approximate daily salary: $400-$600
Onboarding days (productivity < 50%): 10-20 days
Cost of lost productivity: $4,000-$12,000

+ Cost of the mentor/buddy dedicating 2-4 hrs/day: $2,000-$5,000
+ Cost of slower code reviews (they explain more): $1,000-$3,000
+ Cost of bugs from incomplete comprehension: $2,000-$10,000

Total range: $9,000-$30,000 per new developer

These numbers are conservative. In companies with larger or more complex codebases, onboarding can stretch to 2-3 months. And the cost multiplies: if your team hires 5 people a year, you're spending $45K-$150K annually on onboarding alone.

What doesn't show up on the balance sheet

Beyond the direct cost, there are invisible costs:

  • The new developer doesn't contribute features for weeks. The roadmap slips.
  • The mentor loses their own productive hours. Two people operate at reduced capacity.
  • The new developer's first PRs generate more rounds of code review. The whole team slows down.
  • The frustration is real. A senior developer who spends 3 weeks unable to contribute gets demotivated. Some leave before finishing onboarding.

The compound cost

The real impact shows up at scale:

# Calculate the annual onboarding cost for a team

def calculate_onboarding_cost(
    new_developers_per_year: int = 5,
    cost_per_onboarding_min: int = 9_000,
    cost_per_onboarding_max: int = 30_000,
    turnover_rate: float = 0.15  # 15% annual turnover
):
    """
    Calculate the annual onboarding cost for a team.
    Includes new hires + internal turnover.
    """
    # New hires
    new_hires_cost_min = new_developers_per_year * cost_per_onboarding_min
    new_hires_cost_max = new_developers_per_year * cost_per_onboarding_max
    
    # Internal turnover (team/project changes)
    internal_changes = int(new_developers_per_year / turnover_rate * 0.10)
    internal_cost_min = internal_changes * (cost_per_onboarding_min * 0.5)
    internal_cost_max = internal_changes * (cost_per_onboarding_max * 0.5)
    
    total_min = new_hires_cost_min + internal_cost_min
    total_max = new_hires_cost_max + internal_cost_max
    
    return {
        "annual_range": f"${total_min:,.0f} - ${total_max:,.0f}",
        "new_hires": f"${new_hires_cost_min:,.0f} - ${new_hires_cost_max:,.0f}",
        "internal_turnover": f"${internal_cost_min:,.0f} - ${internal_cost_max:,.0f}"
    }

result = calculate_onboarding_cost()
print(f"Total annual cost: {result['annual_range']}")
print(f"  New hires: {result['new_hires']}")
print(f"  Internal turnover: {result['internal_turnover']}")

# Expected output:
# Total annual cost: $59,500 - $195,000
# New hires: $45,000 - $150,000
# Internal turnover: $14,500 - $45,000

Why Onboarding Is Slow

Onboarding isn't slow due to a lack of intelligence or skill. It's slow for structural reasons that affect all developers equally.

Reason 1: Reading code is harder than writing it

Writing code is a creative process where you control the decisions. Reading code is a reverse-engineering process where you have to reconstruct someone else's decisions. It's like reading a book starting from chapter 7: you need to infer what happened in the earlier chapters.

Code isn't read linearly. One file imports functions from 5 other files. One class inherits from another in a different module. A decorator modifies behavior in a non-obvious way. To understand a single function, you sometimes need to read 10 files.

# Example: to understand WHAT this function does...
@require_auth
@rate_limit(max_calls=100, period=3600)
@cache(ttl=300)
async def get_user_dashboard(user_id: int, db: Session = Depends(get_db)):
    user = await user_service.get_with_preferences(user_id, db)
    stats = await analytics_service.get_user_stats(user_id, db)
    recommendations = await recommendation_engine.for_user(user, stats)
    return DashboardResponse(user=user, stats=stats, recommendations=recommendations)

# ...you need to understand THESE files:
# 1. auth/decorators.py        -> what does @require_auth do?
# 2. middleware/rate_limit.py   -> how does rate limiting work?
# 3. cache/decorators.py       -> what's cached and for how long?
# 4. dependencies.py           -> what is get_db?
# 5. services/user_service.py  -> what does get_with_preferences do?
# 6. services/analytics.py     -> what stats are computed?
# 7. services/recommendations.py -> how does the engine work?
# 8. schemas/dashboard.py      -> what does DashboardResponse include?

# That's 8 files to understand 4 lines of code.

Reason 2: Context is lost between files

When you read user_service.py, you understand how the user service works. Then you open auth_middleware.py to understand authentication. By the time you finish auth, you've already forgotten half of what you read in user_service. It's the working memory problem: a human can keep 5-9 chunks of information active. A medium codebase has hundreds of relevant chunks.

# Your typical manual exploration session:
#
# 09:00 - You open user_service.py     -> "Ah, it uses repository pattern"
# 09:15 - You open user_repository.py  -> "SQLAlchemy, OK"
# 09:30 - You open auth_middleware.py   -> "JWT tokens, got it"
# 09:45 - You open payment_service.py  -> "Stripe API... wait,
#          how does this connect to users?"
# 10:00 - You go back to user_service.py -> "I already forgot what I saw here"
# 10:15 - Frustration. 1.5 hrs in and your mental model is fragmented.

Reason 3: Documentation lies

Not out of malice — out of staleness. The README says "uses Flask" but the team migrated to FastAPI 6 months ago. The wiki describes a 3-layer architecture but the real code has 5. The comments in the code say "TODO: refactor this" since 2021. Documentation is a frozen snapshot of a codebase that keeps evolving.

Reason 4: Tribal knowledge

"Why does the payments module have that weird structure?" "Ah, that was because in 2022 we had a Stripe incident and had to add an emergency retry layer. Juan did it. He's not at the company anymore."

The most valuable knowledge about a codebase lives in the heads of the people who built it. When those people leave, the knowledge is lost. There's no documentation that captures the "why" behind each decision.

Reason 5: Constant context switching

Manual onboarding is an infinite loop of:

  1. Open a file
  2. Find an interesting function
  3. See that it imports something from another module
  4. Open that module
  5. Lose track of why you opened the first file
  6. Go back to the first file
  7. Repeat

Each context switch has a cognitive cost. After 2 hours of this loop, productivity drops dramatically.


How AI Changes the Equation

The fundamental advantage: reading speed

A human reads code at ~200-400 lines per hour with deep comprehension. Claude Code can process thousands of lines in seconds. But it's not just speed — it's the ability to keep everything in context simultaneously.

When you ask Claude Code "how does the authentication system work?", it doesn't open one file at a time. It reads all the relevant files, traces the dependencies, and gives you an answer that integrates information from multiple sources. It's as if you could read 20 files at once and remember every detail.

Advantage 1: Instant cross-file analysis

What takes a human hours (tracing a data flow across 10 files), Claude Code does in a single interaction:

# In your terminal, inside the project directory:
claude

> In this project, how does a request flow from when it hits the 
  /api/users endpoint to when it's saved in the database? Show me every 
  file and function involved.

Expected output from Claude Code:

Flow of POST /api/users:

1. app/api/routes/users.py:create_user()
   -> Receives UserCreateSchema (Pydantic validation)
   -> Calls user_service.create()

2. app/services/user_service.py:create()
   -> Checks email isn't duplicated via repository
   -> Hashes password with bcrypt (core/security.py)
   -> Creates a UserModel instance

3. app/repositories/user_repo.py:create()
   -> session.add(user_model)
   -> session.commit()
   -> session.refresh(user_model)

4. Returns UserResponseSchema (excludes password_hash)

Files involved: 5 (routes, service, repository, schemas, security)

Claude Code reads the relevant files, identifies the call chain, and produces a map of the complete flow. It doesn't lose context between files because it has them all in memory.

Advantage 2: Pattern recognition at scale

A new developer needs to read enough code to detect the project's patterns. "Ah, they use repository pattern here." "The DTOs are defined with Pydantic." "Errors are handled with custom exceptions." Detecting those patterns manually requires reading dozens of files.

claude

> Analyze this project and tell me which design patterns are used. 
  Give me concrete examples of each one with the file where they're found.

Expected output:

Design patterns identified:

1. Repository Pattern
   - user_repo.py, task_repo.py, tag_repo.py
   - Each entity has a repository that encapsulates queries
   
2. Service Layer
   - the entire services/ directory
   - Business logic separated from endpoints and data access
   
3. DTO Pattern (via Pydantic)
   - the schemas/ directory
   - Separate schemas for Create, Update, Response
   
4. Dependency Injection
   - Depends(get_db), Depends(get_current_user)
   - Native FastAPI DI
   
5. Middleware Pattern
   - CORS, error handling, request logging
   - Registered in main.py

Consistency: High. Only the reports module (reports/) 
doesn't follow the service->repository pattern — it accesses the DB directly.

Advantage 3: Direct questions, immediate answers

In manual onboarding, you have to wait for your mentor to have time to answer. With Claude Code, you ask and get an answer immediately:

claude

> Why does this project have two authentication modules 
  (auth/ and auth_v2/)? Which one is currently used?

Expected output:

auth/ vs auth_v2/:

- auth/ contains the original session-based system.
  Only the legacy endpoint /api/v0/login uses it.
  
- auth_v2/ is the current JWT-based system.
  All v1 endpoints use it.
  
- The file auth/__init__.py has a comment:
  "# DEPRECATED: use auth_v2. Kept for backward compatibility."
  
- 95% of the code uses auth_v2. auth/ can be considered legacy.

Recommendation: for new development, use auth_v2 exclusively.

Claude Code analyzes the code, sees the imports, identifies which one is active, and explains it to you. You don't need to interrupt anyone.

Advantage 4: It doesn't get tired, it doesn't get frustrated

At hour 6 of reading code, a human is fatigued. Their retention capacity drops. They make comprehension errors. Claude Code keeps the same analysis capacity on the first question and on the fiftieth.


Claude Code: Specific Advantages for Onboarding

It reads the codebase in its context

Claude Code with the Opus model has access to a 1M token context window. For a medium codebase (5K-30K lines), it can have a significant portion of the project in context simultaneously. It doesn't need to open files one by one.

It answers questions about structure

One of the first things you need to know when entering a codebase is how it's organized:

claude

> Describe the directory structure of this project. 
  What does each main folder do? What architecture pattern does it follow?

Expected output:

This project follows a layered architecture:

src/
+-- api/          -> Presentation layer: FastAPI endpoints
|   +-- v1/       -> API versioning (v1 active)
|   +-- deps.py   -> Shared dependencies (auth, DB session)
+-- models/       -> Data layer: SQLAlchemy models
+-- schemas/      -> DTOs: Pydantic schemas for request/response
+-- services/     -> Business layer: domain logic
+-- repositories/ -> Data access layer: DB queries
+-- core/         -> Cross-cutting: config, security, exceptions

Pattern: Service Layer + Repository Pattern
- Endpoints call services
- Services call repositories
- Repositories talk to the DB
- Schemas validate input/output

It traces data flows

One of the most valuable analyses and the hardest to do manually:

claude

> Trace the complete user creation flow: from the 
  HTTP request to the commit in the database. Include 
  validations, transformations, and error handling.

Expected output:

User creation flow:

1. POST /api/v1/users (api/v1/users.py:create_user)
   -> Receives UserCreateSchema (schemas/user.py)
   -> Pydantic validates: email format, password length

2. UserService.create(data) (services/user_service.py:create)
   -> Checks email isn't duplicated -> calls repo.get_by_email()
   -> Hashes password -> core/security.py:hash_password()
   -> Creates UserModel from data

3. UserRepository.create(user) (repositories/user_repo.py:create)
   -> session.add(user)
   -> session.commit()
   -> session.refresh(user)

4. Return UserResponseSchema (without password hash)

Possible errors:
- 422: Pydantic validation (invalid email, short password)
- 409: Duplicate email (service level check)
- 500: DB connection error (handled by middleware)

Getting this level of detail manually requires opening 5-6 files, tracing imports, and keeping the flow in your head. With Claude Code, it's a single question.

It identifies tech debt and quirks

The tribal knowledge that's lost when people leave the team, Claude Code can infer from the code:

claude

> Identify possible tech debt in this project. Are there inconsistent 
  patterns, duplicated code, pending TODOs, or practices 
  that should be updated?

Expected output:

Tech debt identified:

1. Pending TODOs (7 found):
   - services/payment.py:45 "# TODO: add retry logic"
   - models/user.py:12 "# TODO: migrate to UUID"
   - api/v1/tasks.py:89 "# TODO: add pagination"

2. Inconsistencies:
   - reports/ accesses the DB directly (doesn't use repository pattern)
   - Some endpoints return dict, others return schemas
   
3. Duplicated code:
   - Pagination logic copied across 4 endpoints
   - Permission validation repeated (should be middleware)
   
4. Outdated dependencies:
   - SQLAlchemy 1.4 (current: 2.0)
   - pydantic v1 (current: v2)
   
5. Dead code:
   - utils/legacy_helpers.py has no imports from any file
   - auth/session_auth.py is only used by one deprecated endpoint

First Demo: Exploring a Project with Claude Code

You're going to see a real Claude Code session exploring an unfamiliar project. This is a medium-sized Python project — a REST API for task management.

Step 1: Understand the structure

# Clone the project
git clone https://github.com/example/task-api.git
cd task-api

# Open Claude Code
claude

> I just cloned this project and I've never seen it before. Give me an 
  overview of the structure: what folders there are, what framework it uses, 
  how the code is organized.

Expected output from Claude Code:

This is a FastAPI project for task management.

Main structure:
app/
+-- main.py           -> Entry point, creates the FastAPI app
+-- api/
|   +-- routes/       -> Endpoints organized by resource
|       +-- tasks.py  -> Task CRUD
|       +-- users.py  -> Registration, login, profile
|       +-- tags.py   -> Tags for tasks
+-- models/           -> SQLAlchemy models (ORM)
|   +-- task.py
|   +-- user.py
|   +-- tag.py
+-- schemas/          -> Pydantic schemas
+-- services/         -> Business logic
+-- db/               -> Database config, session
+-- core/             -> Settings, auth (JWT), middleware

Tests in tests/ with pytest. Config in pyproject.toml.
Uses Alembic for migrations (alembic/ dir).
Docker available (docker-compose.yml).

Step 2: Identify entry points

> What's the application's entry point? How are the 
  routes wired up? Show me the flow from main.py to the endpoints.

Expected output:

Entry point: app/main.py

Flow:
1. main.py creates the FastAPI() app
2. Includes routers:
   - app.include_router(tasks.router, prefix="/api/v1/tasks")
   - app.include_router(users.router, prefix="/api/v1/users")  
   - app.include_router(tags.router, prefix="/api/v1/tags")
3. Middleware: CORS, global error handler
4. Startup event: connects to DB, runs pending migrations
5. Started with: uvicorn app.main:app

Each router defines its endpoints with decorators @router.get(), 
@router.post(), etc. Dependencies injected via Depends().

Step 3: Understand a data flow

> How does task creation work? From when the request arrives 
  to when it's saved in the DB. What validations are there?

Step 4: Discover patterns

> What design patterns are used in this project? Is it consistent 
  in their use? Is there any module that doesn't follow the general pattern?

Step 5: Identify possible problems

> Do you see tech debt or possible problems in this codebase? Pending 
  TODOs, duplicated code, inconsistencies, outdated 
  dependencies.

In 5 questions and less than 10 minutes, you have an overview that manually would have taken 2-3 hours. It's not total comprehension — but it's enough to start being productive and to know where to dig deeper.


Comparison: Manual Onboarding vs Onboarding with Claude Code

AspectManualWith Claude Code
Understanding structure1-2 hrs (opening folders, reading files, grepping)2-5 min (one question)
Identifying entry points30-60 min (looking for main, app, index)1-3 min (one question)
Tracing a data flow2-4 hrs (following imports between files)3-5 min (one question)
Detecting patterns1-3 days (reading enough code to see the pattern)5-10 min (one question)
Finding tech debtWeeks (discovered gradually)5-10 min (one question)
Creating a basic mental model1-2 weeks30-60 min
Producing documentationRarely happensGenerated as part of the process
Context retentionLost between filesEverything kept in memory
"Mentor" availabilityLimited (busy people)Unlimited (24/7)
Cost per developer$9K-30KClaude Code subscription cost
ScalabilityDoesn't scale (each developer repeats the process)The generated onboarding doc serves the next developer

The key difference: the output

Manual onboarding produces ephemeral individual understanding. If you don't document it (and almost nobody does), it's lost when you change projects or when someone new arrives.

Onboarding with Claude Code produces a tangible artifact: an onboarding doc that captures the understanding. That document serves you (future reference), your team (the next new developer), and the project (updated documentation).


When Onboarding with AI Has the Greatest Impact

Not all scenarios are equal. Onboarding with AI has the greatest impact on:

High impact:

  • ✅ Medium-large codebase (5K-100K+ lines): Enough complexity that manual exploration is costly
  • ✅ Incomplete or outdated documentation: Claude Code reads the real code, not the documentation
  • ✅ Multiple frameworks or technologies: Claude Code knows most popular frameworks
  • ✅ Distributed team or no availability for mentoring: Claude Code is always available
  • ✅ Open source contribution: There's no mentor; Claude Code is your guide

Lower impact:

  • ⚠️ Trivial codebase (< 1K lines): You can read it directly in 30 minutes
  • ⚠️ Code with excellent, up-to-date documentation: The documentation already gives you the context
  • ⚠️ Very niche languages or frameworks: Claude Code may have less specialized knowledge

Connection with the Project

What you'll practice in the mini-project (capsule 06):

In the module project you're going to apply exactly what you saw in this capsule's demo, but on a real open-source codebase. The difference: in the demo you saw isolated questions. In the project you're going to run the 5 questions in a systematic sequence (which you'll learn in capsule 03) and produce a complete onboarding doc.

How it connects with what's coming:

Capsule 02 (this one):  You understand WHY onboarding is costly and how AI helps
         |
Capsule 03 (next): You learn WHAT to ask and IN WHAT ORDER
         |
Capsule 04: You learn to build the MENTAL MODEL
         |
Capsule 05: You learn to DOCUMENT the findings
         |
Capsule 06: You do it ALL together on a real codebase

Troubleshooting

Problem 1: "Claude Code doesn't know my framework/language"

Cause: Niche frameworks or less popular languages may have lower coverage in the model.

Solution:

# Instead of asking without context:
> What does this code do?

# Provide explicit context:
> This project uses the Litestar framework (formerly Starlite) for Python.
  It's similar to FastAPI but with a different approach to DI.
  Explain the project structure to me knowing this.

You can also include the framework's documentation in the prompt using @-references to relevant files. For most popular frameworks (FastAPI, Django, Flask, Express, Rails, Spring), Claude Code has excellent coverage.

Problem 2: "Claude Code's answers are too general"

Cause: A vague or overly broad prompt.

Solution:

# Too general:
> Explain this project to me.

# Specific and actionable:
> How does a request flow from the POST /api/tasks endpoint 
  to when it's saved in the database? Show me every 
  file and function involved, including validations.

The more specific the question, the more specific the answer. If the initial answer is general, ask follow-up questions: "go deeper on step 3" or "show me the code for that function."

Problem 3: "The codebase is very large and Claude Code can't read all of it"

Cause: Codebases of 100K+ lines exceed what can be processed in a single session.

Solution:

# Instead of asking it to analyze everything:
> Analyze the whole project.

# Focus on specific modules:
> Analyze only the src/auth/ folder and explain to me how 
  authentication works in this project.

For this module, work with medium codebases (5K-30K lines). Module 6 covers context management for large projects.

Problem 4: "I don't know if Claude Code's answer is correct"

Cause: A legitimate concern — models can make mistakes.

Solution:

# After Claude Code explains something, validate:
> Show me the exact code of the create_user function in 
  services/user_service.py to verify what you told me.

The rule: trust but verify. If Claude Code says "the entry point is main.py", open main.py and verify. Capsule 04 covers techniques for validating the mental model.

Problem 5: "My team won't adopt AI onboarding"

Cause: Resistance to change or skepticism.

Solution: Don't propose a process change. Do it quietly yourself. When your onboarding is 5x faster than average, the result speaks for itself. Share your onboarding doc with the team as a contribution. When they see the quality and speed, adoption happens naturally.


Exercises

Exercise 1: Calculate your onboarding cost (Easy)

Think about the last time you joined an existing project (work, open source, or a school project). Estimate:

  1. How many days did it take you to understand the general structure?
  2. How many days until your first significant PR?
  3. How many hours of your mentor's or colleagues' time did you consume?

Calculate an approximate cost using your daily rate (or that of a developer in your market).

See solution

Example calculation:

# Calculate your personal onboarding cost

structure_days = 5          # days to understand the general structure
first_pr_days = 12          # days until the first significant PR
mentor_hours = 20          # mentor/colleague hours consumed
your_hourly_rate = 50      # your hourly rate (USD)
mentor_hourly_rate = 60    # mentor's hourly rate (USD)

# Calculation
low_productivity_hours = first_pr_days * 4  # 4 hrs/day of low productivity
my_cost = low_productivity_hours * your_hourly_rate
mentor_cost = mentor_hours * mentor_hourly_rate
extra_code_review = 400  # conservative estimate

total = my_cost + mentor_cost + extra_code_review
print(f"Total estimated cost: ${total:,.0f}")
print(f"  My reduced productivity: ${my_cost:,.0f}")
print(f"  Mentor time: ${mentor_cost:,.0f}")
print(f"  Extra code reviews: ${extra_code_review:,.0f}")

# Expected output:
# Total estimated cost: $4,000
#   My reduced productivity: $2,400
#   Mentor time: $1,200
#   Extra code reviews: $400

The point isn't the precision of the number — it's making visible a cost that's usually invisible. Even with conservative estimates, the numbers are significant.

Exercise 2: Identify reasons for slowness (Easy)

Of the 5 reasons why onboarding is slow (listed in this capsule), identify which ones apply to your current or last project:

  1. Reading code is harder than writing it
  2. Context is lost between files
  3. Documentation lies (it's outdated)
  4. Tribal knowledge isn't documented
  5. Constant context switching

For each one that applies, give a concrete example from your experience.

See solution

Example answer:

  1. ✅ Reading code is harder than writing it. In the payments project, a single processing function imported from 8 different files. Understanding that function required understanding all 8.

  2. ✅ Context is lost between files. Every time I jumped from payment_service.py to stripe_client.py to retry_handler.py, I lost track of the main flow.

  3. ✅ Documentation lies. The README said "uses SQLite for development" but the team had already migrated to local PostgreSQL with Docker. I lost 2 hours configuring SQLite before someone told me.

  4. ✅ Tribal knowledge. Nobody knew why the reports module had a completely different structure from the rest. The person who designed it was no longer at the company.

  5. ✅ Context switching. On my first day I tried to understand the notification system. I jumped between 12 files in an hour and in the end I didn't have a coherent mental model of any of them.

Reflection: If you identified 3 or more, your onboarding would have been significantly faster with AI. Each of these reasons is a direct use case for Claude Code.

Exercise 3: First exploration with Claude Code (Medium)

Clone a small open-source project you've never seen. Suggestions:

  • httpx — HTTP client for Python
  • typer — CLI framework
  • rich — Terminal formatting

Open Claude Code in the project's directory and ask these 3 questions:

# Clone the project
git clone https://github.com/tiangolo/typer.git
cd typer

# Open Claude Code
claude

# Question 1:
> What's the structure of this project? What does each main folder do?

# Question 2:
> What's the main entry point? How is this library used?

# Question 3:
> What design patterns are used?

Document the answers and the time it took you.

See solution

Example with typer:

Question 1 — Structure (time: ~30 seconds):

typer/
+-- typer/           -> Main source code
|   +-- __init__.py  -> Exports Typer, Argument, Option
|   +-- main.py      -> Main Typer class
|   +-- params.py    -> Argument and Option classes
|   +-- models.py    -> Internal models
|   +-- testing.py   -> CliRunner for tests
+-- tests/           -> Tests with pytest
+-- docs/            -> MkDocs documentation
+-- pyproject.toml   -> Project config

Question 2 — Entry point (time: ~30 seconds):

The entry point is the Typer class in typer/main.py.
Usage: create a Typer() instance, decorate functions with @app.command(),
call app() in __main__. Click is the base — typer wraps Click
with type hints.

Question 3 — Patterns (time: ~45 seconds):

- Decorator pattern: @app.command() registers functions as commands
- Facade pattern: Typer simplifies Click's API
- Builder pattern: parameters are built incrementally
- Convention over configuration: type hints determine the behavior

Total time: ~2 minutes for a functional overview.
Manually it would have taken 30-60 minutes reading files.

Reflection: In 2 minutes you got a basic mental model that lets you understand how the project is organized, how it's used, and what patterns it follows. It's enough to start contributing or to decide whether you want to dig deeper.

Exercise 4: Compare manual vs AI (Medium)

Use the same project from exercise 3. Try to answer this question manually (without AI), timing yourself:

"How does this project handle errors? Are there custom exceptions? How do errors reach the user?"

Then ask Claude Code the same question. Compare:

  • Manual vs AI time
  • Completeness of the answer
  • Confidence in the answer
See solution

Example with httpx:

Manual exploration (time: ~15-25 minutes):

  1. Search for "exception" or "error" with grep in the project: 3 min
  2. Find relevant files (_exceptions.py): 2 min
  3. Read each exception class: 5 min
  4. Look for where they're raised (raise): 5 min
  5. Understand the error flow: 5-10 min
  6. Result: partial list of exceptions, incomplete flow

With Claude Code (time: ~1 minute):

claude

> How does httpx handle errors? What custom exceptions are there? 
  How do errors reach the user?

Complete answer with:

  • Exception hierarchy (HTTPStatusError, RequestError, TimeoutException, etc.)
  • When each one is raised
  • How the user catches them (try/except patterns)
  • The relationship with httpcore's exceptions

Comparison:

MetricManualClaude Code
Time15-25 min~1 min
CompletenessPartial (~60%)Almost complete (~90%)
ConfidenceMedium (I might have missed something)High (but I verify)
Cognitive effortHigh (jumping between files)Low (reading one answer)

Acceleration factor: ~15-25x on this specific task.

Exercise 5: Identify tribal knowledge (Advanced)

In the open-source project you chose, ask Claude Code:

claude

> Identify non-obvious design decisions in this project. 
  Is there anything that seems unusual, unexpected, or that would only make 
  sense if you knew the historical context?

Evaluate the answer: did it identify things you wouldn't have noticed reading the code directly?

See solution

Example with rich:

claude

> Identify non-obvious design decisions in the rich project.

Claude Code's answer (summary):

1. The console.py module is unusually large (~2000 lines).
   Probable reason: Console is the central object that orchestrates 
   all rendering. Splitting it would break the state flow.

2. There's an internal "protocol" system (rich/protocol.py) that 
   lets objects render themselves. It's not obvious 
   why it doesn't use __str__ or __repr__ — the reason is that 
   Rich's rendering is more complex than plain text.

3. The _inspect.py module has an underscore prefix, suggesting
   it's "private," but it's exported publicly as 
   rich.inspect(). The underscore avoids a conflict with Python's 
   builtin inspect.

4. There are renderables that seem redundant (Text vs Padding vs
   Panel) but each one handles a different aspect of the terminal 
   layout.

Evaluation: Claude Code identified design decisions that would have taken days to discover manually — especially point 3 (underscore naming) and point 4 (why there are so many similar renderables). These are exactly the kinds of insights that make up "tribal knowledge" in a project.

Note: Not every answer will be correct. Always validate against the real code and, if possible, against the project's git history or issues.

Exercise 6: Design your onboarding process (Advanced)

Based on what you learned in this capsule, design a 5-step onboarding process you'd use the next time you're assigned a new codebase. For each step, write:

  1. The main question you'd ask Claude Code
  2. What you expect to get as output
  3. How you'd validate the answer
See solution

5-step onboarding process:

StepKey questionExpected outputValidation
1. Structure"What's the structure? What architecture pattern does it follow?"Directory mapOpen 2-3 folders and verify
2. Entry points"Where does execution start? How are routes registered?"Flow from main to handlersRun the app and verify
3. Data flow"Trace the main data flow from input to output"Call chain with filesPut a print in the flow
4. Patterns"What design patterns and conventions are used?"List of patterns with examplesOpen 3-4 files and verify
5. Tech debt"Are there TODOs, inconsistencies, or gotchas for a new developer?"Prioritized list of issuesVerify 2+ mentioned items

Note: This process is formalized in capsule 03 as "The 5 initial questions." What you designed here is your personal version of the framework.


Summary

In this capsule you learned:

  • ✅ Manual onboarding to a medium codebase costs $9K-30K per developer in lost productivity
  • ✅ It's slow for structural reasons: reading > writing, context loss, outdated docs, tribal knowledge
  • ✅ Claude Code changes the equation: instant cross-file analysis, pattern recognition at scale, unlimited questions
  • ✅ The specific advantages: it reads the full codebase, traces data flows, identifies patterns and tech debt
  • ✅ Direct comparison: mental model in 30-60 min with AI vs 1-2 weeks manual
  • ✅ The output of AI onboarding is an artifact (document), not just ephemeral individual understanding
  • ✅ Greatest impact on medium-large codebases with incomplete documentation

Next capsule: Systematic Exploration — What to Ask and In What Order — the 5 initial questions, why order matters (big picture first, details later), and practical prompts for each question.


Additional Resources

  1. The Onboarding Problem in Software Engineering — Stripe Engineering Blog — A large company's perspective on the cost of onboarding
  2. Working Effectively with Legacy Code — Michael Feathers — Chapter 1 on the cost of not understanding existing code
  3. Claude Code Documentation — Anthropic — Code analysis and exploration features
  4. Measuring Developer Productivity — ACM Queue — A framework for measuring developer productivity (includes onboarding)
  5. The Mythical Man-Month — Fred Brooks — The classic on why adding people to a project doesn't speed it up linearly
  6. Google's Engineering Practices — Code Review Guide — How Google handles code review and developer onboarding
  7. httpx — Python HTTP Client — Suggested project for exploration exercises
  8. typer — CLI Framework — Suggested project for exploration exercises

Next capsule: Systematic Exploration — What to Ask and In What Order — the 5 initial questions, why order matters (big picture first, details later), and practical prompts for each question.


Module 1, Capsule 02 — Refactoring & Legacy Code with Claude Code Guide