Building Applications · Single Page Apps · Part 2 of 2

Building your SPA: from blueprint to running app

Last time you designed the intent. Today Claude Code builds it, and you stay the architect.

Today

A single page application loads one HTML page once, then updates parts of it as you click

Traditional website

Every click asks the server for a brand-new page. The screen flashes, scroll resets, anything you typed is gone.

Single page app

The app loads once. Clicking swaps only the part that changed. Instant, smooth, and state survives.

Activity: SPA Detective

  1. Warm-up: the same radio site, built both ways. Watch the music timer.
  2. I visit real sites and click around
  3. In chat, on "go": SPA or TRAD?
  4. Then we check the evidence in DevTools

Page: activity-spa-detective/index.html

Tech stack: Node engine, npm parts store, Vite workshop, React lego bricks, React Router receptionist
diagrams/L2-01-tech-stack.tldr

React builds the screen out of components

A component is a reusable piece of UI: a button, a workout card, a navbar.

Build a <WorkoutCard> once, use it on Home and History.

When data changes, React updates only that part of the page.

Not automatically "the best," but popular, flexible, huge ecosystem, and it pairs well with Vite and Router.

// a component is a function that returns UI
function WorkoutCard({ name, date }) {
  return (
    <div className="card">
      <h3>{name}</h3>
      <p>{date}</p>
    </div>
  )
}
React Router reads the URL and swaps one component into the outlet while the navbar and footer stay
diagrams/L2-02-router-shell.tldr

Start the project: Vite does the scaffolding

npm create vite@latest
# Project name:    liftlog
# Framework:       React
# Variant:         JavaScript
# Linter:          Oxlint (either is fine)
# Install + start: No

cd liftlog
npm install
npm install react-router-dom
npm run dev
# → http://localhost:5173

Or just ask Claude

"Create a React + Vite project with react-router-dom using npm, named liftlog, and run it on the dev server."

Either way you get the same files. We won't deep-dive into them.

Claude Code receives context from app_outline, rules from skills, abilities from MCP servers, and can be packaged as a sub-agent
diagrams/L2-03-toolbelt.tldr

MCP servers give Claude abilities

Context7

Pulls the latest docs for our stack, so no deprecated functions.

Playwright

Drives a real browser: clicks, types, screenshots. It checks pages against your wireframes.

Chrome DevTools

Reads the console, network, and performance. Debugging beyond what's visible.

claude mcp add --scope user playwright      -- npx -y @playwright/mcp@latest
claude mcp add --scope user context7        -- npx -y @upstash/context7-mcp
claude mcp add --scope user chrome-devtools -- npx -y chrome-devtools-mcp@latest
# check:  claude mcp list

Skills are rulebooks that push Claude past generic AI design

  • frontend-design: Anthropic's official skill. Distinctive type, palette, layout.
  • ui-ux-pro-max: UI/UX rules, component patterns, responsive layout
  • taste: dials for variance and density, bans the "AI slop" defaults
  • design-motion-principles: easing, timing, micro-interactions

Install: the one-liner on the class site. Check: /skills

your-project/
├── .claude/
│   └── skills/
│       ├── frontend-design/
│       │   └── SKILL.md
│       ├── ui-ux-pro-max/
│       │   ├── SKILL.md
│       │   ├── data/      ← 70+ files!
│       │   └── scripts/
│       ├── taste-skill/
│       └── design-motion-principles/
│           ├── SKILL.md
│           └── references/
└── ...
app_outline folder structure mapped to its purpose
diagrams/L2-05-app-outline.tldr

The prompt: every part has a job

Stack

React + Vite, React Router with BrowserRouter

Skills

Name all four, so Claude uses them

Constraint

No API. Data lives in the browser and refresh resets it.

Context

Read user_journey → app.png → each page's wireframe + story → style guide

Docs

Use Context7 for current conventions

Verify

Playwright screenshot of each page, compared to its wireframe

Phases

Claude proposes phases + pass conditions. You approve each one.

Confirm first

Summarize the journey and list pages before any code

Full text: demo-kit/prompt.md. Paste it now and let Claude start.

Build loop: plan, build one phase, screenshot, compare with wireframe, you approve, git commit, next phase
diagrams/L2-04-build-loop.tldr

Activity: Who's responsible? (while Claude builds)

  1. I show a problem you'll actually hit this week
  2. Type which tool is responsible: Node, npm, Vite, React, Router, an MCP, a skill, app_outline, git…
  3. Hit enter on "go." Then we reveal.

Page: activity-whos-responsible/index.html

Back to Claude · unmute or chat
Does phase 1 match the wireframe? What feedback would you give Claude before approving?
Compare the Playwright screenshot to home.png. Look at layout, missing elements, empty state.

Version control: every approved phase is a save point

# in Claude: save what it learned
/init                # writes CLAUDE.md

git init
git add -A
git commit -m "Phase 1: app shell + Home"

# create the GitHub repo and push
gh repo create liftlog --public --source=. --push

Why it matters

  • Phase 3 broke everything? Go back to phase 2.
  • Share your code with teammates and instructors
  • Your Claude sessions come and go. The repo stays.
  • CLAUDE.md is the first thing Claude reads next session

Package it as a front-end sub-agent

# .claude/agents/front-end-agent.md
---
name: front-end-agent
description: Builds, maintains, and tests React
  SPAs with responsive, accessible UI/UX.
model: sonnet
mcpServers:
  - context7
  - playwright
  - chrome-devtools
skills:
  - frontend-design
  - ui-ux-pro-max
  - design-taste-frontend
  - design-motion-principles
---
You are a Senior Front-End Engineer…

Set it up once, reuse it everywhere

A specialist teammate that already knows its skills, MCPs, and workflow: analyze → plan → implement → test → document.

skills: uses each skill's name. Taste's name is design-taste-frontend.

Homework, Part II

  1. Priority 1, build your app: turn your Part I planning into an app_outline/ and build the front-end SPA
  2. Priority 2, FreeCodeCamp: 100 steps of the JavaScript certification
  3. Priority 3, Netflix clone: use Claude Code, skills, context, and MCPs to build your SPA

Checklist: skills folder ✓ · MCPs connected ✓ · app_outline ✓ · phases approved ✓ · pushed to GitHub ✓

Exit ticket · in chat
Name one thing you'll put in your app_outline that Claude couldn't have guessed.
That's the part only you can do.