Lab 2: Direct the Agent and Deploy¶
| Session | 2 · Thu, Nov 12 |
| Time | About 55 minutes in class, 45 minutes after |
| SDLC phase | Planning: setting the rules the build follows |
| Reading | Directing the Agent |
| Due | Tue, Nov 17, start of class · 25 points |
| { .lab-meta } |
What you will learn¶
- How to build in small, checkable steps instead of one giant prompt
- How to write a
CLAUDE.mdso the agent knows what it cannot see in the code - How to use plan mode, and how to set a permission rule the agent cannot ignore
- How to deploy a web app to a public URL, with every push redeploying it
Part A: One giant prompt versus small steps (15 minutes)¶
Make a folder and start Claude Code there:
Paste exactly this, and nothing more:
Build me a problem tracker web app with all features. Use plain HTML, CSS, and JavaScript in a single index.html, and save data in the browser's localStorage.
Open the result (open index.html on macOS, start index.html on Windows). Write down two things
it built that you did not want and two things you wanted that it did not build. Then exit Claude
(/exit).
Now build it again, the way Conversational Coding
describes. Make a second folder, labs/lab-02/problem-tracker, start Claude there, and send these
one at a time, checking the app in the browser after each:
-
I want to track problems I notice throughout the day. Start simple: a way to add a new problem with a title and description, shown in a list. Use plain HTML, CSS, and JavaScript in a single index.html, and save data in localStorage.
-
Add a timestamp so I know when I captured each problem.
-
Now I want to rate each problem on frequency (daily, weekly, monthly, rarely). Add a dropdown for that.
- One change of your own.
Part B: Write a CLAUDE.md (10 minutes)¶
Claude starts every session knowing only what it can see. CLAUDE.md is where you write what it
cannot work out from the code: decisions, constraints, and traps.
-
In the
problem-trackerfolder, ask Claude to draft one:Create a CLAUDE.md for this project. Include a short project overview, the tech stack, and a Development Notes section. Under Development Notes add: "No frameworks and no build step: everything stays in index.html." and "Never store data on a server; localStorage only."
-
Read it. Delete anything that just repeats what the code already shows. Add one rule of your own.
-
Test it. Type
/exit, start a freshclaudesession in the same folder, and ask:Add a search box that filters problems by title. Use whatever library you think is best.
Does Claude follow your
CLAUDE.mdand avoid adding a library? Write what happened in your reflection.
Part C: Plan mode and a permission rule (10 minutes)¶
Plan mode. Press Shift+Tab until the status line shows plan mode (or type /plan), then ask:
Plan how to add a "status" field (open, in progress, solved) and a way to filter by status. Do not change any files yet.
Read the plan. Ask for one change to it. When it is right, approve it and let Claude build it. Save
the final plan text in labs/lab-02/plan.md.
A permission rule. Advice in CLAUDE.md can be ignored; a permission rule cannot. Ask Claude:
Add a deny rule to .claude/settings.json in this folder so that you can never run rm -rf or git push --force. Then show me the file.
Then ask it to run rm -rf test-folder and record what happens.
Part D: Deploy to the internet (15 minutes)¶
- Commit and push your course repo (ask Claude to do it).
- Go to vercel.com, choose Add New → Project, and import your course repo.
- Under Root Directory, click Edit and choose
labs/lab-02/problem-tracker. Leave the framework as Other. Click Deploy. - Open the URL Vercel gives you (something like
problem-tracker-abc.vercel.app) on your laptop and on your phone. - Make one small visible change (for example, the page title), commit, and push. Watch Vercel redeploy automatically. Refresh the live site.
Put the live URL at the top of labs/lab-02/reflection.md.
Why your data does not follow you to your phone
The problems you add on your laptop do not appear on your phone. localStorage lives in each browser, on each device. A shared database fixes that, and you will add one in Lab 6. Hold on to this observation for Anatomy of an Application.
Reflection¶
Write labs/lab-02/reflection.md, in your own words:
- Live URL.
- Compare the one-shot build and the step-by-step build. Which would you rather maintain, and why?
- Did the fresh session follow your
CLAUDE.md? What does that tell you about where to write down decisions? - What is the difference between a rule in
CLAUDE.mdand a rule insettings.json? When would you need the second kind?
Turn in¶
Submit the link to labs/lab-02/ on Canvas. It should contain:
-
one-shot/andproblem-tracker/(with itsCLAUDE.mdand.claude/settings.json) -
plan.md -
reflection.mdwith your live URL at the top
How larger systems do this¶
At large companies the equivalent of your CLAUDE.md is spread across onboarding docs,
architecture decision records, coding standards, and code owners, and the permission rule is a
branch protection setting that no one, including senior engineers, can bypass. Read What This
Looks Like at Full Scale for how
one company runs hundreds of agents with the same three controls you used today: what the agent
knows, what it may do, and how its work is checked.