Day 2: Loops and your environment

3 Days of Spec-Driven Development · Day 2 of 3 · four lessons, four exercises, a wrap-up · about three hours: 159 minutes including the opener

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

Opener · 10 min

Claude Fable, Claude Tag, and Anthropic's Culture — Cat Wu & Thariq Shihipar ft Simon Willison

AI Engineer, 2026-07-15. Watch the chapter Safety, security, and using Auto Mode, 30:57 to 37:53: seven minutes of video, and three for writing down the two things below.

What to listen for. Two people from the Claude Code team on handing an agent a long-running task and then not watching it. Write down what has to be true before a run goes unattended, and what they look at afterwards to satisfy themselves that it was. Lesson 2 turns them into a stop condition and a gate.

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.

Swift lane
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
Kotlin lane
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 lane
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.

Kotlin lane
./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.

What today needs

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.

Videos and reading

No video is required to finish an exercise.

Sources