Day 2: Loops and your environment
Trust, but verify.
a Russian proverb, and the line Ronald Reagan made famous
Yesterday you drove every step: you wrote a spec, read a plan, approved it, and checked the diff yourself. Today you let go of the steering wheel on purpose, which only works if you know exactly what will make the run stop and what you will look at when it does. You will build a runner with three exits and a gate you answer from evidence, put a fresh-context critic on its output and route what it finds without growing your instructions, then write down the environment you actually work in and encode it as permission rules and one narrow write path. Everything today is framework-agnostic; tomorrow you pick a framework.
Watch this first
Claude Fable, Claude Tag, and Anthropic's Culture — Cat Wu & Thariq Shihipar ft Simon Willison
Before you start
Day 2 works in day2-work, a copy of your lane at the course root; the shipped
sandbox/ is never edited. Exercise 1 opens with this block, pasted from the course
root: it makes work/ at the course root, which is where your written answers go,
makes the copy, installs the runner skill, the Change B spec and the run-log template,
and leaves you inside day2-work. Do not run it yet; Exercise 1 has you paste it.
mkdir -p work
cp -R sandbox/swift day2-work && cd day2-work
mkdir -p .claude/skills/run-spec
cp ../day-2-loops-and-your-environment/starter/skills/run-spec/SKILL.md .claude/skills/run-spec/
cp ../day-2-loops-and-your-environment/starter/specs/daily-summary.md specs/
cp ../day-2-loops-and-your-environment/starter/run-log.template.md .
ls .claude/skills/run-spec specs
mkdir -p work
cp -R sandbox/kotlin day2-work && cd day2-work
mkdir -p .claude/skills/run-spec
cp ../day-2-loops-and-your-environment/starter/skills/run-spec/SKILL.md .claude/skills/run-spec/
cp ../day-2-loops-and-your-environment/starter/specs/daily-summary.md specs/
cp ../day-2-loops-and-your-environment/starter/run-log.template.md .
ls .claude/skills/run-spec specs
Start Claude Code there, because a session works in the directory you launch it from: it
reads the project's CLAUDE.md from
./CLAUDE.md or ./.claude/CLAUDE.md, and a project skill from
.claude/skills/<name>/SKILL.md. Every Day 2 command runs from inside
day2-work, except a setup block pasted from the course root, which says so. Starters
are at ../day-2-loops-and-your-environment/starter/; answers go in
../work/.
Exercise 1 then confirms the copy is green, so any later red came from the run.
swift test
A fresh copy prints this verdict:
Test Suite 'All tests' passed at ….
Executed 34 tests, with 1 test skipped and 0 failures (0 unexpected) in … (…) seconds
The skipped test is LEDGER-7's; day2-work starts from the shipped lane
whatever you did on Day 1.
./gradlew test
A fresh copy prints this verdict:
BUILD SUCCESSFUL in …
5 actionable tasks: …
BUILD SUCCESSFUL decides; the task counts differ on a repeat run. A green run
prints no test counts, and LEDGER-7's test runs only when an environment variable is set.
No step today depends on git, so a download works as well as a clone: runs are measured by diffing against the shipped lane. To start an exercise over, use the Reset section at the bottom of its page.
- Claude Code, signed in.
claude --versionprints your version; these pages were checked against 2.1.280 on 2026-09-22. - Your lane's toolchain from Setup: Swift 6.2, or JDK 17 or later.
python3, which Exercise 3 uses to check that a settings file parses.- A second terminal tab in
day2-work, for checking the tree mid-run. - No account or credential: Exercise 4 writes to a local fixture directory.
The day in order
Nine pages after the video. Lessons 1 and 2 share Exercise 1, Lesson 3 has Exercise 2, and Lesson 4 has Exercises 3 and 4.
Ticks need JavaScript and stay in this browser.
Starter files
Each exercise copies what it needs from ../day-2-loops-and-your-environment/starter/
when it needs it, so there is nothing to install now.
README.md— what each file is for and where it is copied.skills/run-spec/SKILL.md— the runner: iteration cap, three exits, gates.specs/daily-summary.md— the reference Change B spec, so Day 2 stands alone.agents/spec-auditor.md— the auditor subagent: a fresh context, atools:line that lets it read but not edit, and amodel:line.reference/after-e1/— a completed Exercise 1 result, if yours did not finish.acceptance/change-b/— the hidden acceptance suite in both lanes, copied in after your own run.answers/andreveal/— the reference findings and net-zeroCLAUDE.mdrevision Exercise 2 reveals.env-profile.mdandprediction-grid.md— the blank profile and the predict-then-observe grid Exercise 3 fills in.settings.example.json— a starting permissions file, deny list first, explained insettings.example.md.scripts/andfixtures/local-repo/— the vetted write wrapper, its allowlist and self-test, and the local directory it writes to.run-log.template.md— the one-line-per-iteration format the runner appends to.
Videos and reading
No video is required to finish an exercise.
- Recommended videos — the opener and one clip per lesson, with segments.
- Reading — the articles, docs and repositories behind the lessons.
Sources
cc-automation-01— a project skill lives at.claude/skills/<skill-name>/SKILL.md, from Agent Skills.cc-core-08— a project'sCLAUDE.mdis read from./CLAUDE.mdor./.claude/CLAUDE.md, from Memory.cc-core-41— the directory you launch Claude Code in is the session's primary working directory, from Configure permissions, accessed 2026-09-23.cc-core-25,cc-core-26,cc-core-27,cc-core-38— a subagent is YAML frontmatter and a Markdown body under.claude/agents/; itstools:field lists the tools it may use andmodel:names its model; it starts with a fresh, isolated context window and does not see your conversation, from Subagents.cc-core-31,cc-core-32—claude --version, and the version checked against here, Claude Code 2.1.280 on 2026-09-22, from the Claude Code changelog.- The test output quoted above was recorded on this machine on 2026-09-23, one run per lane, in a fresh copy made by Exercise 1's setup block.