BUILD · PHASE 00 · LESSON 1

Dev Environment

After this lesson your terminal, editor and shell are configured the way this

Type
Build
Prerequisites
none — first lesson in the course
Time
~30 minutes

Learning Objectives

  • Set a shell that keeps your working directory and shows which git branch you are on
  • Point your editor at a line of output you were given, without hunting for it
  • Create the throwaway repo this course will break on purpose, and confirm it is a git repo
  • Name the three places a command can run, and say which one an agent uses

The Problem

Two hours into your first session you ask an agent to change one file. It reports success. Nothing changed. The file it edited was in a different folder than the one you are looking at — and you have no way to tell, because your terminal shows a bare prompt with no path in it.

That is the whole problem. Not the tooling. Not knowing which folder you are in. Everything this course builds later — sending several agents at once, isolating their work, merging it back — assumes you can always answer "where am I?" without thinking. Get that habit in place now and the rest is mechanical.


The Concept

Three places a command can run. Confusing them is the most common way a session goes wrong.

flowchart TD
    A[You type a command] --> B{Which shell?}
    B -->|your terminal| C[Your machine, your folders]
    B -->|the agent's shell| D[The same machine, the session's working folder]
    B -->|a server elsewhere| E[Not your files at all]
    D -.-> F[Both usually agree — until one of them changes folder]
Mermaid source — renders as a diagram where mermaid.js is available

The middle row is the one that surprises people. The agent does not get a special machine. It runs commands in a specific folder, and that folder was decided when the session started. It is not re-decided every time you talk to it.

So two habits cover most of it:

  1. Your prompt shows the folder. A path and a branch, always visible.
  2. You say the folder once, at the start. "We're working in ~/projects/my-app." Then you never think about it again.

The reframe: the working folder is set once, at session start, and never

moves — so verifying it once is worth more than being careful forever.

What "set up" actually means

Not a theme. Not a font. Four things, in this order:

#ThingWhy this course needs it
1Git installed and configuredEvery later phase leans on it
2A shell prompt showing path + branchYou must never be unsure where you are
3An editor you can drive from the terminalReading a diff without leaving the keyboard
4A throwaway repo to experiment onPractice modules break things on purpose

Build It

Do these in order. Each step ends with something you can look at.

1. Check git, and set who you are

git --version
git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Without those two config lines every commit in this course fails, and the error message does not explain why.

✅ You pass when git --version prints a version and both config lines are set.

2. Make your prompt show path and branch

Append one line to your shell profile. Bash and zsh differ; use the one that matches what you actually run.

# zsh (~/.zshrc) or bash (~/.bashrc)
PS1='$(git branch --show-current 2>/dev/null || echo "no-repo") %c $ '

Then reload it and move into any git repo.

source ~/.zshrc    # or ~/.bashrc
cd ~/.claude       # any repo you have

Your prompt should now read something like main ~ $.

✅ You pass when your prompt shows a branch name while you are in a repo.

3. Open a file at a given line from the terminal

# macOS / Linux
code path/to/file.ts:42

# Windows PowerShell
code path\to\file.ts:42

Add the alias so you never retype it:

alias c='code'     # add to the same profile

✅ You pass when the editor opens with the cursor on line 42.

4. Create the practice repo

This is the repo the Break modules will destroy on purpose. Make it boring and disposable.

mkdir -p ~/claude-course-lab
cd ~/claude-course-lab
git init
mkdir -p src
printf 'export const sum = (a, b) => a + b\n' > src/index.ts
git add -A
git commit -m "chore: start the lab"
git log --oneline

✅ You pass when git log --oneline shows exactly one commit.

5. Prove you know where you are

pwd
git rev-parse --show-toplevel

These two should agree, and the second should be your lab folder. If they ever disagree later in the course, stop and fix that before continuing — every confusing thing downstream traces back to it.

✅ You pass when both print the same folder.


Use It

Command / conceptWhen you reach for it
pwdAny time you are not sure what folder you are in
git rev-parse --show-toplevelFinding the repo root, not the current subfolder
code file:lineJumping to an error the agent quoted at you
git initStarting a throwaway repo to experiment in
git config --global user.emailOnce per machine, before your first commit
cd -Returning to the folder you were just in

Exercises

  1. Make a folder, git init it, make one commit, then cd somewhere else and recover your position with git rev-parse --show-toplevel alone — without typing the full path. ✅ You pass when you print the lab folder path from a different directory.
  1. Create a file with 60 lines, then open it at line 57 from the terminal in one command. ✅ You pass when the editor lands on line 57 without you scrolling.
  1. Open a brand-new terminal tab and check your prompt. Does it show a branch? If not, your profile edit did not take. ✅ You pass when a fresh tab shows a branch name while you are inside the lab repo.

Key Terms

TermWhat people sayWhat it actually means
working directory"the project folder"One specific folder a command runs in. Not a default. Not negotiable per command.
repo root"wherever I ran git init"The top folder of the repo, found with git rev-parse --show-toplevel. Subfolders are inside it but are not it.
git config"git settings"Identity and defaults, stored per-machine globally and per-repo locally. Without identity, commits fail.
prompt"the thing with the cursor"The text your shell prints before each command. Make it carry path and branch, and you stop needing to check.

What this lesson skipped

No shell scripting, no aliases beyond the two above, no terminal multiplexers. No git concepts beyond "a repo exists and one commit happened" — branches, merging and recovery are Phase 02, and this lesson must not lean on them.

One warning, because it has already bitten us: run git init before you start a session, not during one. A session that begins outside a repo will not pick up a repo created later, and every tool that assumes a repo will fail with a message that does not explain why. Restart your session in an existing repo instead.

Check yourself

3 questions. Answer before you reveal — recognising the right option is not the same as being able to produce it.

  1. You start a session in ~/notes, then git init a repo at ~/projects/api and cd into it in your own terminal. The agent still edits files under ~/notes. Why?

    1. Git caches the folder a session began in, and only updates after you commit
    2. The agent's working directory was set when the session started and does not follow your terminal
    3. The agent cannot edit files outside the folder it was launched from
    4. cd in your terminal is scoped to your terminal, so the agent sees a different prompt
    Show answer

    B. The agent's working directory was set when the session started and does not follow your terminal

    The working directory is decided once, at session start, and does not move as you talk to the agent. Fix: say the folder explicitly at the start of a session, or restart the session in the repo. Option C sounds right but is wrong — the agent can reach any folder you grant; it simply defaults to the session's folder.

  2. You are deep in a repo at repo/src/components/Button/. Which single command reliably tells you the folder you should report problems against?

    1. pwd
    2. ls
    3. git rev-parse --show-toplevel
    4. git status
    Show answer

    C. git rev-parse --show-toplevel

    git rev-parse --show-toplevel prints the repo root regardless of how deep you are. pwd is right when you want your current subfolder and wrong when you want the project — and it will disagree with the path in a stack trace.

  3. A colleague's git commit fails with an error mentioning identity. Nothing in the repo looks wrong. What is the actual cause?

    1. The repo has no commits yet, so there is nothing to attach a commit to
    2. The branch has diverged from main
    3. user.name and user.email were never configured on that machine
    4. A file is staged but has never been committed
    Show answer

    C. user.name and user.email were never configured on that machine

    Git refuses to attribute a commit to nobody. The other three are real situations but produce different messages — none of them mention identity.