Lesson 5.7 — Capstone: A Swarm for a Real Job
Introduction to AI · Module 5: AI Agents · About 90 min · Windows PC, PowerShell 5, Claude Code (Max)
Goal: use everything from Module 5 on one real recurring job of yours: instructions, tools, permissions, a plan, subagents and evals. It runs from one command.
Before you start
Step 1 · Define "done" (⏱ 0:00–0:10)
mkdir $HOME\capstone -Force | Out-Null
cd $HOME\capstone
notepad DONE.mdWrite 3–5 checkable lines, e.g. "out\report.md exists", "every input file is mentioned", "total matches".
Step 2 · Inputs and a checker (⏱ 0:10–0:25)
Copy sample inputs into $HOME\capstone\input. Then ask Claude to write the checker for you:
claude>) means you're talking to Claude; PS C:\...> means you're in PowerShell. PowerShell commands only work at the PS prompt, so always /exit Claude first.Read DONE.md. Write check.ps1 (Windows PowerShell 5) that prints PASS only if
every line in DONE.md is true for the files in out\, otherwise FAIL plus reasons.
Then run it once; it should FAIL because out\ is empty.Step 3 · Design the team (⏱ 0:25–0:40)
Still in Claude:
Design 2-3 subagents for this job (see DONE.md, input\). Write them to
.claude\agents\ with name, description, tools (least needed) and instructions.
Also write CLAUDE.md for the orchestrator: never modify input\, outputs go
to out\, finish by running .\check.ps1 and fix until PASS (max 3 rounds).
Show me the plan before writing files.Read the plan and approve it. Then /agents to confirm (press Esc to close it).
Now leave Claude, because the next step is PowerShell: **type /exit and press Enter. Wait until you see PS C:\...> before the next command.**
Step 4 · Safety rails (⏱ 0:40–0:45)
mkdir .claude -Force | Out-Null
$json = '{"permissions":{"deny":["Bash(rm:*)","PowerShell(Remove-Item:*)","PowerShell(rm:*)"]}}'
[IO.File]::WriteAllText("$HOME\capstone\.claude\settings.json", $json)Step 5 · One-command run (⏱ 0:45–1:00)
@'
Remove-Item out -Recurse -ErrorAction SilentlyContinue
claude -p "Do the job described in CLAUDE.md using your subagents. Report PASS or FAIL." --allowedTools "Read,Write,Edit,Glob,Grep,Task,PowerShell,Bash,WebFetch"
.\check.ps1
'@ | Out-File run.ps1 -Encoding utf8
.\run.ps1You should see a summary from Claude, then PASS.
Step 6 · Mini eval: 5 cases (⏱ 1:00–1:25)
Make 5 variations of input (e.g. one extra file, one odd format, one empty file) in cases\c1–c5, then:
$pass = 0
foreach ($n in 1..5) {
Remove-Item input -Recurse -ErrorAction SilentlyContinue
Copy-Item "cases\c$n" input -Recurse
$r = (.\run.ps1 | Select-Object -Last 1); Write-Host "case $n : $r"
if ($r -eq "PASS") { $pass++ }
}
"PASS RATE: $pass / 5"Step 7 · Show and tell (⏱ 1:25–1:30)
Send Skills Coach: the job, the team (agent names), the pass rate, and one thing you'd improve.
✅ Pass check
Troubleshooting
| Problem | Fix |
|---|---|
| Job too big, keeps failing | Shrink it: fewer inputs, fewer DONE lines. Small and passing beats big and broken. |
| Subagents not used | Make sure Task is in --allowedTools, and CLAUDE.md says "use the subagents". |
| check.ps1 is wrong | Open it with notepad check.ps1, or ask Claude to fix it against DONE.md. |
| Usage limit | Stop after Step 5. Do the eval another day. |
Finish this lesson
Nice work! Pick your next step: