Two days · four hours each · hands-on
Working with an agent in your own repositories
You will install it, steer it, break it, and ship real changes to code you actually own. By the end of day two you will know where the sharp edges are.
Set expectations
What this is, and what it isn't
A working session
You do the work, in your repository, on a task you actually care about. Nothing here is a canned demo.
A product pitch
We spend real time on what it does badly, because knowing that is what makes you fast rather than frustrated.
- This is an agent, not autocomplete. It reads files, runs commands, edits code, and decides what to do next in a loop.
- The mental model is a fast colleague with perfect recall and no judgment about your business.
Nothing in these two days changes who is accountable for what lands on the default branch.
Everything that follows assumes you still read the diff.
Day one
From zero to a trusted daily driver
By the end of today, every person in this room has shipped one real change to their own repository and can explain why the agent did what it did.
Module 1 · 45 minutes
Setup and first contact
- Install, log in, and prove it works
- Workspace trust — what you are actually agreeing to
- The four surfaces: terminal, editor, desktop, web
- Lab 1: three questions about your own codebase
Everyone at once
Install
# macOS, Linux, WSL
curl -fsSL https://claude.ai/install.sh | bash
# Windows PowerShell
irm https://claude.ai/install.ps1 | iex
claude --version
claude doctor
Learn claude doctor now. It prints installation and settings diagnostics without starting a session, so every later "it isn't working" has an obvious first step. Homebrew, WinGet, apt, dnf, apk and npm all work too — but only the native install updates itself in the background.
If it goes wrong
The four failures you will see
| Symptom | Cause | Fix |
|---|---|---|
command not found | ~/.local/bin not on PATH | New terminal, then add it to your shell profile |
'&&' is not a valid statement separator | Ran the CMD line in PowerShell | Use the irm command |
'irm' is not recognized | Ran the PowerShell line in CMD | PowerShell shows PS C:\ |
| Download blocked | Corporate proxy | Pair with a neighbour; fix at the break |
Hard cutoff at twenty minutes. Anyone still broken pairs up — the room does not wait.
Read it, don't click past it
Workspace trust
The first time you run Claude in a directory, it asks whether you trust it.
- You are about to let it read this directory and run commands in it
- A repository can carry configuration that runs at startup — hooks, servers, instruction files
- This matters most for repositories you did not write
Same instinct as npm install on a stranger's project. The prompt is the moment you decide.
The UI-versus-CLI question, answered once
Four front ends, one product
| Surface | What it is | Reach for it when |
|---|---|---|
| Terminal | claude in any directory. Every knob exposed. | Default. Everything in this course works here. |
| Editor extension | VS Code, JetBrains. Editor-native diffs. | You live in the editor and review diffs inline. |
| Desktop app | macOS, Windows, Linux. Every session gets its own worktree. | Parallel work without git plumbing. |
| Web | claude.ai/code. Runs in the cloud on a checkout. | Starting work from a phone or a borrowed machine. |
Your configuration in ~/.claude/ and in the repository applies across all of them. The desktop app's automatic worktree is the same mechanism you'll build by hand tomorrow.
Lab 1 · 10 minutes
Your first session
Ask three questions about a part of your codebase you already know well. No edits.
Ask one badly on purpose. Then ask it properly. Compare.
labs/lab-01-first-session.mdWatch what it does before you read what it says. If it answered without opening a file, it guessed — and that tells you something useful about how to prompt it.
Module 2 · 45 minutes
How it actually works
This is the module that makes people effective instead of superstitious.
- The agentic loop, and the two consequences that explain most confusing behaviour
- The context window — made concrete, not mystical
- Permission modes, and why plan mode is the one people skip
- Interrupting as a skill
The whole mechanism
Read, choose a tool, run it, decide
- It reads your request
- It picks a tool — read a file, search, edit, run a shell command, delegate
- It runs the tool and reads the result
- It decides whether it is done, and loops
That is genuinely all of it. Everything else in these two days is about controlling what goes into step one and what tools exist in step two.
Two consequences
Why it behaves the way it does
It only knows what it has read
If it hasn't opened the file, it is guessing. This is why "look at how X works, then do Y" beats "do Y" every single time.
It runs real commands
When it runs your tests, the tests really run. When it deletes a file, the file is really gone. This is the whole value and the whole risk.
Make it concrete
The context window
/context # what is loaded, and how much room is left
/cost # what this session has spent
/clear # start fresh — free, and the habit that matters most
- Long sessions get worse, not better. Output from a hundred commands crowds out the thing you care about.
- Clear between unrelated tasks. This single habit separates people who find the tool reliable from people who don't.
- Compaction is a fallback, not a feature. When the window fills, the conversation gets summarized. Something is always lost.
Shift+Tab cycles the mode
Permission modes
| Mode | Behaviour | When |
|---|---|---|
| default | Asks before edits and commands | Learning a codebase, or any repo you don't own |
| plan | Researches, changes nothing at all | Before anything non-trivial. The most underused mode. |
| acceptEdits | Applies edits, still asks for commands | A tight loop where you're reviewing diffs anyway |
| bypassPermissions | Asks for nothing | Throwaway containers. Not on a work laptop. |
The cheapest place to correct an agent is before it writes any code.
Plan mode makes that the default instead of an act of discipline. Reject one plan on purpose today, even a good one, so you feel how little it costs.
Muscle memory
Stop it early
| Key | Does |
|---|---|
Shift+Tab | Cycle permission mode |
Esc | Stop mid-turn. It keeps the work done so far. |
Esc Esc | Rewind to an earlier message |
Ctrl+O | Transcript view — exactly which tools ran |
Ctrl+C | Interrupt, or clear the input |
Interrupting early is a skill, not rudeness. Watching a wrong approach unfold for two minutes is the most common way people waste time with an agent.
Lab 2 · 10 minutes
Plan mode, and interrupting
Run the same small task twice: once planned, once straight in. Compare the results.
Then start something deliberately over-broad and stop it with Esc. Twice, until it's reflex.
Module 3 · 45 minutes
Stop repeating yourself
Everything in this module is about writing something down once so you never type it again.
CLAUDE.md— persistent instructions, loaded every session.claude/rules/— topic and path scoped, for when that grows- Custom commands, which are now just skills
- Settings and the permission allowlist
Broadest to most specific — they all load
Where instructions live
| Scope | Location | Shared with |
|---|---|---|
| Managed policy | /Library/Application Support/ClaudeCode/CLAUDE.md/etc/claude-code/CLAUDE.md | Everyone on the machine, deployed by IT |
| User | ~/.claude/CLAUDE.md | You, across every project |
| Project | ./CLAUDE.md or ./.claude/CLAUDE.md | The team, via version control |
| Local | ./CLAUDE.local.md | You, this project. Gitignore it. |
/init drafts one from your codebase. /memory opens them. /context proves which ones actually loaded.
The part that matters
Write what it could not have discovered
/init can find your build commands and directory layout by looking. It cannot know any of this:
- Why something is the way it is. "The retry logic in the payment path is deliberate. Don't simplify it."
- What's half-finished. "We're mid-migration. New code uses the new client; don't 'fix' the old call sites."
- Local setup. "Integration tests need a database: run
make db-upfirst." - What a reviewer would flag. "Errors are wrapped with context at every boundary; never return a bare error."
Rules of thumb
Specific enough to verify
| Write this | Not this |
|---|---|
"Run npm test before committing" | "Test your changes" |
| "Use two-space indentation" | "Format code properly" |
"API handlers live in src/api/handlers/" | "Keep files organized" |
| Add a rule the second time you correct the same mistake | Add rules speculatively |
Keep it under about 200 lines. Longer files are followed less reliably, not more — and they cost context every session. Contradictions are worse than gaps: if two rules disagree, behaviour becomes arbitrary.
When one file gets too big
Scope rules to paths
.claude/rules/api-design.md
---
paths:
- "src/api/**/*.ts"
---
# API conventions
- Every endpoint validates its input.
- Errors use the standard error envelope.
The rule only enters context when the agent touches a matching file. This is the answer to "our CLAUDE.md is enormous", and it's how a monorepo keeps frontend conventions out of a backend session.
A command you'll actually use
Custom commands are skills now
.claude/skills/review-diff/SKILL.md
---
description: Reviews the current diff for risk before I open a PR.
---
## Current changes
!`git diff HEAD`
## Instructions
Summarize the change in two or three bullets, then list anything
risky: missing error handling, hardcoded values, tests that
should have changed and didn't.
That's /review-diff. The ! line runs the command and inlines its output before the agent reads the file — so the review is grounded in your real diff. An older .claude/commands/foo.md still works and still gives you /foo.
Stop being asked
The permission allowlist
.claude/settings.local.json
{
"permissions": {
"allow": [
"Bash(git status)",
"Bash(git diff *)",
"Bash(npm test *)"
]
}
}
~/.claude/settings.json is yours everywhere. .claude/settings.json is the team's, committed. .claude/settings.local.json is yours here, gitignored.
Allowlist what is safe to run while you aren't looking.
Reads, status, tests, builds. Not git push. Not anything that deletes or deploys. The prompt is the last check before something irreversible — the allowlist exists to make the prompts you do get worth reading.
Lab 3 · 25 minutes, finish it tonight
Write it down once
A real CLAUDE.md with at least three things /init could not have known.
One custom command you'll use next week. Three allowlist entries.
labs/lab-03-claude-md.mdThis is the highest-value half hour of day one, and it's compressed. Finish it tonight.
Module 4 · 45 minutes
Ship the thing you brought
One loop, learned properly, beats a toolbox of tricks.
- Explore. "Read the files involved and explain how this works." No edits. Check its model against yours.
- Plan. Plan mode. Read it properly. This is where you catch the wrong approach for thirty seconds.
- Implement. Let it work. Interrupt the moment it goes sideways.
- Verify. Tests, build, run the thing. Not "it says it's done."
- Review. Read the diff as you would a colleague's pull request.
Give it a way to check its own work.
A test suite, a type checker, a script that reproduces the bug. An agent with a feedback loop converges. An agent without one produces plausible code and stops. This is the single highest-leverage habit in the whole course.
The pattern that keeps it honest
Failing test first
Write a failing test that captures this bug. Run it, and show me
it fails for the right reason. Don't fix anything yet.
Now make it pass without changing the test.
Confirm the failure is real before you let it fix anything. The test is what stops "done" from meaning "it compiled".
Be blunt about this
What it is bad at
- Large ambiguous refactors where the right answer depends on where the codebase is heading. It optimizes locally.
- Context that exists only in someone's head. A half-finished migration, a deliberate inconsistency, a decision from a meeting. If it isn't written down, it isn't known.
- Knowing when to stop. If the third fix attempt hasn't worked, the approach is wrong. Take over.
- Reporting failure clearly. It can describe work as complete when the tests were never run.
- Wide blast radius. The more files touched, the worse your review — and review is the control.
If you couldn't review the diff properly, the task was too big.
Split it and run the loop again. This is the heuristic that scales to everything on day two.
Lab 4 · 25 minutes
Your real task, end to end
Branch first. Explore, plan, implement, verify, review, commit.
Ask yourself out loud at step four: did I actually run it?
labs/lab-04-ship-a-feature.mdModule 5 · 40 minutes
Version control is the safety net
- Commit before you start. A branch you can throw away is what lets you say yes to an ambitious attempt.
- Let it commit. It reads the diff, so the message describes what actually changed.
- Be deliberate about pushing. Fine on your own branch. Never unattended to a shared one.
- Never let it merge. The review gate is the entire point.
Keep git push out of your allowlist. That prompt is doing real work.
Sort the findings
What automated review is worth
Real, worth fixing
An unhandled error path, a missed edge case, a test that doesn't assert the thing it claims to.
Real, not now
Technically true, out of scope for this change. Say so and move on.
Wrong
It misread the intent. This is the useful pile: it shows where a human reviewer will also get confused.
Good at the boring, real things. No substitute for someone who knows why the system is built this way.
Lab 5 · 15 minutes, then debrief
Open a pull request
Run /code-review on your branch, fix what deserves fixing, push, open the PR.
- Debrief: what worked better than you expected, and where did you have to take over?
- Homework: use it for real work tomorrow morning. Finish your
CLAUDE.md. Bring a task that spans two repositories.
Day two
Scaling out
Yesterday was one person, one repository, one task. Today is everything that breaks when reality is messier than that.
Yesterday's board
Where you had to take over
Some of these get solved today. Some of them stay yours — and saying which is which is the point of this slide.
- Solved today: work that spans repositories, several things in flight at once, and information that lives outside the codebase
- Improved today: repeating yourself, and setup that lives in one person's head
- Still yours: knowing what the business needs, and reviewing what comes back
Module 6 · 45 minutes
Working across repositories
A session is rooted where you launched it, and it will not wander into a sibling repository on its own. That is a safety boundary, not an oversight.
| Shape | Example | Answer |
|---|---|---|
| Monorepo | Many packages, one checkout | Nested instruction files, path-scoped rules |
| Coordinated change | An API and its client, changing together | One session, extra directory added |
| Independent work | Unrelated tasks in unrelated repos | Separate sessions. Don't merge them. |
Adding a directory
One session, two repositories
claude --add-dir ../api-client ../shared-types
# or mid-session
/add-dir ../api-client
# the gotcha: instruction files from added dirs are NOT loaded by default
CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1 claude --add-dir ../shared-config
Without that variable the agent can read the other repository's code but is blind to its conventions. This one surprises everybody.
Finding your way back
Name your sessions
claude -n "payments-migration" # name it when you start
claude -c # continue the most recent one here
claude -r "payments-migration" # resume by name or id
A small habit that pays off the first time you have four sessions going. Start now, while you only have two.
One session per coherent piece of work.
Not one per repository, and not one for everything you're doing today. If two tasks don't need to know about each other, everything one loads is noise for the other — and quality drops accordingly.
Lab 6 · 10 minutes
Across repositories
Make one change spanning two of your repositories with --add-dir.
Then do two unrelated tasks as two separate sessions. Be able to say why each was right.
labs/lab-06-multi-repo.mdModule 7 · 45 minutes
Two agents, one checkout, no
They edit each other's files. One runs tests against the other's half-finished change. Neither result is trustworthy.
- A git worktree is a separate working directory with its own branch, sharing the same history and remote
- Different files on disk, same git database
- It has existed in git for a decade. What's new is having a reason to use it daily.
Built in
Start a session in its own worktree
echo ".claude/worktrees/" >> .gitignore # do this first
claude --worktree feature-one # terminal 1
claude --worktree feature-two # terminal 2
Creates .claude/worktrees/feature-one/ on a new branch worktree-feature-one and starts a session inside it. -w is the short form. Omit the name and it generates one.
In the order you'll hit them
What will surprise you
| Thing | Why |
|---|---|
| Tests fail immediately | A worktree is a fresh checkout. No node_modules, no .env, nothing gitignored. |
| It starts from the default branch | That's the default. Set worktree.baseRef to "head" to branch from your current work. |
--worktree errors about trust | Run plain claude once in the repo and accept the prompt first. |
| Editing a main-checkout file is refused | Intentional. Isolation is enforced, not just conventional. |
Carry your environment across
.worktreeinclude
# .worktreeinclude at the project root — gitignore syntax
.env
.env.local
config/secrets.json
Only files that match and are gitignored get copied, so tracked files are never duplicated. Every worktree Claude creates from now on gets them automatically.
Don't accumulate them
Merge and clean up
git worktree list
git merge worktree-feature-one
git worktree remove .claude/worktrees/feature-two
git worktree remove --force <path> # if it has uncommitted changes
On exit, Claude checks each worktree for work that removal would destroy — changed files, untracked files, unpushed commits — and asks before deleting anything. git worktree list is your "what have I got running?" command.
Your limit isn't how many agents you can run. It's how much code you can properly review in an hour.
Parallelism pays when tasks are genuinely independent and each runs a while unattended. It costs the moment you become the bottleneck and start rubber-stamping the second diff.
Lab 7 · 15 minutes
Two worktrees, two tasks
Create two, run a different task in each, merge one, clean both up.
Then review both diffs and ask yourself honestly whether you reviewed the second as carefully as the first.
labs/lab-07-worktrees.mdModule 8 · 60 minutes · the long one
Connecting the systems outside your codebase
The Model Context Protocol is an open standard for connecting an agent to tools and data. A server exposes tools; the agent can call them.
- Anything you currently copy and paste into a chat window is a candidate. A stack trace, a row of query results, a ticket description.
- The real win isn't saving the paste. It's that the agent can go and get the next piece of information without asking you.
Three transports
Where the server runs
| Transport | What it is | Typical case |
|---|---|---|
stdio | A local process on your machine | A database server, an internal script |
http | A remote endpoint, supports OAuth | Hosted services |
sse | Older remote style, deprecated | Services that still only offer this |
The part teams get wrong
Scopes
| Scope | Stored in | Who gets it |
|---|---|---|
| local (default) | Your own config, per project | Just you, just this project |
| project | .mcp.json, committed | Everyone who checks out the repo |
| user | Your user config | Just you, every project |
Everyone is asked to approve a committed .mcp.json before its servers run. That approval exists because committing a server config is asking your colleagues to run something.
Secrets never go in the file
.mcp.json
{
"mcpServers": {
"dev-db": {
"type": "http",
"url": "https://internal.example/mcp",
"headers": { "Authorization": "Bearer ${DEV_DB_TOKEN}" }
}
}
}
Environment variables are expanded at load. And note "type": an entry with a url but no type is read as a stdio server and silently skipped. That mistake costs ten minutes every time.
The commands
Adding servers
claude mcp add --transport http notion https://mcp.notion.com/mcp
claude mcp add --env DB_URL=... --transport stdio my-db -- npx -y <server>
claude mcp add --scope project --transport http <name> <url>
claude mcp list
claude mcp get <name>
claude mcp login <name>
For stdio servers the -- separates Claude's own options from the command that runs the server. Without it, the server's flags get parsed as Claude's. In session, /mcp lists servers, shows status, and starts authentication.
Tool output is untrusted input.
A ticket description, a log line, a row from a table — whatever a server returns enters the agent's context. If someone can write text into that system, they can write text the agent may act on. This is why "which servers do we trust" is a real question, not paperwork.
Before you connect anything
Five rules
- Read-only replica, read-only role. Not the production primary with write credentials. The most important line in this module.
- Scoped credentials. A token that reads one project, not the whole organization.
- Review a server before committing it to
.mcp.json. - Be deliberate about allowlisting MCP tools. Read-only, fine. Writes to a shared system, no.
- Assume anything it reads can influence it. Pointing it at arbitrary external content is a decision, not a default.
Lab 8 · 25 minutes
Wire up three, finish one
Source control — find the three oldest open pull requests and what's blocking each.
Logs — "there was an error this week; find it, and find the code that produced it."
Database, read-only — a real data question, then the code that writes that table.
labs/lab-08-mcp.mdOne server fully working beats three half-configured. The pay-off in every case is the handoff from operational data to source code.
Module 9 · 45 minutes
Four mechanisms that look alike
| You want | Use | Because |
|---|---|---|
| A fact known in every session | CLAUDE.md | Always loaded |
| A procedure, loaded when relevant | Skill | Costs nothing until used |
| A big side task kept out of your context | Subagent | Separate context, returns a summary |
| Something that must always happen | Hook | Deterministic, not the agent's decision |
| To share any of it across repos | Plugin | Packaged and installable |
A directory with a SKILL.md
Skills
.claude/skills/deploy-preview/SKILL.md
---
description: Deploys the current branch to a preview environment.
Use when asked to deploy a preview or share a build.
disable-model-invocation: true
---
1. Run the test suite; stop if anything fails.
2. Build the application.
3. Deploy to the preview target and report the URL.
description is how the agent decides it's relevant — write it as when to use this. disable-model-invocation means it only runs when you type /name: right for anything with consequences. Write one the second time you paste the same instructions.
The value is in what doesn't come back
Subagents
.claude/agents/test-runner.md
---
name: test-runner
description: Runs the test suite and reports only what failed and why.
tools: Read, Glob, Grep, Bash
---
Run the full test suite. Report only failing tests, with the
assertion that failed and the most likely cause. Do not fix anything.
It can read forty files and run the suite three times; you get three sentences. But it starts fresh — it does not inherit your conversation. If you'd have to re-explain everything, do it in the main session. Add isolation: worktree and it runs in its own checkout.
Shell commands on lifecycle events
Hooks
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{ "type": "command",
"command": "npx prettier --write $CLAUDE_FILE_PATHS" }
]
}
]
}
}
/hooks configures them interactively, which is easier than hand-editing JSON the first time.
Only a hook is guaranteed.
Instruction files and skills are context: persuasive, not enforced. People write "always do X" into CLAUDE.md and are surprised when it happens most of the time. If it must happen every time, it's a hook.
Lab 9 · 15 minutes
One skill, one hook
A skill for something you genuinely repeat — pick it from yesterday's frustrations.
A hook that runs your formatter after every edit, whether the agent thinks of it or not.
labs/lab-09-skills-and-hooks.mdModule 10 · 25 minutes · no lab
What survives contact with Monday
| Commit it | Keep it local |
|---|---|
CLAUDE.md, .claude/rules/ | CLAUDE.local.md |
.claude/skills/, .claude/agents/ | .claude/settings.local.json |
.claude/settings.json | Anything with a credential in it |
.mcp.json (reviewed first) | .claude/worktrees/ — gitignore it |
Treat the committed ones as code and review them in pull requests. A change to the team's instruction file changes how the agent behaves for everyone — same scrutiny as a change to CI.
Two things people ask about
Secrets and cost
Assume it can read what's there
Environment variables, never literals in committed files. Read-only database roles. Scoped tokens, rotated. If a .env sits in the working directory, assume its contents can reach context — permissions.deny can block paths outright.
The expensive thing is the bad thing
/cost for the session, /usage for plan limits. What costs money is long sessions full of irrelevant context — which is the same thing that costs quality. /clear is both the cheap and the good answer.
Somebody will build this before next week
Headless, briefly
claude -p "summarize the changes on this branch"
claude -p --output-format json "list the failing tests"
claude setup-token # a long-lived token for automation
That's the entry point to CI and scripting. It exists, it works, and it's a day-three topic.
Concretely
What to do next
- This week. Everyone uses it for real work, daily. Nothing else.
- Two weeks. Compare
CLAUDE.mdfiles across the team, merge the good parts, commit them. - A month. One shared skill and one shared hook the whole team uses.
- Ongoing. Someone owns the shared configuration the way someone owns CI.
It makes a good engineer faster. It does not make review optional.
The teams who get the most out of this are the ones who stayed rigorous about what they shipped. Everything in these two days was in service of that.