Build Spell Sprint with Claude Code
Build a 3D game with replay bots, spelling challenges, and safe local chat.
Introduction
30 Second Summary
A solo obstacle course can feel empty once you know every jump. Racing against your earlier attempts turns practice into a challenge you can see.
In this project, you will use Claude Code to build Spell Sprint, a browser-based 3D obstacle game powered by Three.js. The finished loop is a race against three saved ghost bots through a CAT-locked door into a local phrase-only chat.
What You'll Build
On your final demo run, three labeled ghosts race beside you as CAT opens the Level 2 door to a parent-written phrase chat.
By the end of this project, you'll have:
- A playable 3D obstacle course with keyboard controls. Each fall triggers an instant respawn at the most recent safe section.
- A local replay system that saves three runs as downloadable JSON files. Each run returns as BOT 1: TALL, BOT 2: WIDE, or BOT 3: SMALL.
- A recorded final demo that shows the CAT challenge opening Level 2. The recording also captures one approved local chat exchange.
- Secret Mission: Replace the scripted Bot Coach response with logged Claude replies behind the same phrase allowlist. Keep the API key on the server. Filter every reply before adding it to a parent-readable log.
Are there any prerequisites?
No prior coding or game development experience is required. The guide includes complete setup paths for both macOS and Windows.
Before We Start
Before any setup begins, this is your moment to commit to building Spell Sprint. A clear finish line keeps every later decision focused: your final recording must show three ghost bots, the word CAT, and the Level 2 door opening.
Set Up Your Tools and Claude Code
Spell Sprint starts as an empty folder. Your computer needs Node.js before the game can run locally.
This step prepares every tool required for the build. You will finish with Claude Code ready inside the empty spell-sprint folder.
In this step, get ready to:
- Install the free development tools for building the game.
- Create a Claude Pro account and install Claude Code.
- Open an empty spell-sprint folder in a verified Claude Code session.
Install the free development tools
What powers the build?
Node.js runs the JavaScript tools used to build Spell Sprint. Its installer also provides the npm package manager.
Visual Studio Code gives you an editor for the project files. Its code command lets the terminal open a folder in the editor.
Google Chrome runs the finished browser game. It provides the screen where you test movement later.
- Check whether Node.js is already available by running this command:
node --version
What does this command do?
The node --version command prints the installed Node.js version. Spell Sprint uses Node.js 26.13.1 LTS.
✔️ I see version 26.13.1
Good start. Node.js v26.13.1 is installed and ready for the project.
ⓧ I see an older version
Your computer has Node.js installed. This project needs 26.13.1 LTS for a consistent setup.
macOS
- Visit the Node.js download page.
- Download the macOS installer for Node.js 26.13.1 LTS.
- Open the downloaded installer.
- Follow the installer instructions.
- Close the current Terminal window after the installation finishes.
- Press Cmd+Space to open Spotlight.
- Type Terminal and press Enter to reopen it.
Windows
- Visit the Node.js download page.
- Download the Windows .msi installer for Node.js 26.13.1 LTS.
- Open the downloaded installer.
- Follow the installer instructions.
- Close the current PowerShell or Terminal window after the installation finishes.
- Press Win+X.
- Select Windows PowerShell or Terminal to reopen it.
ⓧ Command not found
Node.js is not installed yet. Install 26.13.1 LTS using the instructions for your computer.
macOS
- Visit the Node.js download page.
- Download the macOS installer for Node.js 26.13.1 LTS.
- Open the downloaded installer.
- Follow the installer instructions.
- Close the current Terminal window after the installation finishes.
- Press Cmd+Space to open Spotlight.
- Type Terminal and press Enter to reopen it.
Windows
- Visit the Node.js download page.
- Download the Windows .msi installer for Node.js 26.13.1 LTS.
- Open the downloaded installer.
- Follow the installer instructions.
- Close the current PowerShell or Terminal window after the installation finishes.
- Press Win+X.
- Select Windows PowerShell or Terminal to reopen it.
The editor installation differs between macOS and Windows. Choose the tab for your computer.
macOS
- Download Visual Studio Code from the official Visual Studio Code website.
- Open the downloaded .dmg file.
- Drag Visual Studio Code.app into the Applications folder.
- Press Cmd+Space to open Spotlight.
- Type Visual Studio Code and press Enter to open it.
- Press Cmd+Shift+P to open the Command Palette.
- Run Shell Command: Install 'code' and optionally 'copilot' commands in PATH.
- Choose No for Copilot.
Why add the code command?
The shell command makes Visual Studio Code available from Terminal. Later, the code command can open a project folder without extra navigation.
- Download Chrome from the official Chrome website.
- Open the downloaded Chrome installer.
- Follow the installer instructions.
Windows
- Download the User setup from the official Visual Studio Code website.
- Open the downloaded Visual Studio Code installer.
- Keep Add to PATH selected.
- Complete the Visual Studio Code installation.
- Close the current PowerShell or Terminal window.
- Press Win+X.
- Select Windows PowerShell or Terminal to reopen it.
- Download Chrome from the official Chrome website.
Why reopen the terminal?
Visual Studio Code adds its command to the terminal path during installation. A new PowerShell or Terminal window loads that updated path.
- Open the downloaded Chrome installer.
- Follow the installer instructions.
- Verify Node.js, npm, and the Visual Studio Code command by running:
node --version
npm --version
code --version
What do these checks prove?
- The node --version command confirms the JavaScript runtime is available.
- The npm --version command confirms the package manager was installed with Node.js.
- The code --version command confirms Visual Studio Code is available from the terminal.
You should see v26.13.1 for Node.js. You should also see version information for npm and Visual Studio Code.
- Press Cmd+Space (macOS) or the Windows key (Windows) to open your search bar.
- Type Google Chrome and press Enter to open it.
You should see a Chrome window with an address bar. Your free development tools are now available.
Missing a version number?
- Close the terminal after installing a tool.
- Reopen the terminal before repeating the version checks.
- On macOS, run the Visual Studio Code shell command again if only the code check fails.
Ask for help with a missing tool command:
Set up Claude Pro and install Claude Code
Claude Code needs an eligible account before it can start an interactive coding session. A monthly Claude Pro subscription provides access for the core project.
Plan the Claude Pro month
A paid subscription can feel like a big commitment, so set the boundary before checkout. Claude Pro costs $20 when billed monthly.
The $17 monthly equivalent requires $200 paid up front for a year. Claude Code is not included in the free plan.
Web subscriptions can be canceled from Settings. The cancellation option is under Billing.
- Visit the Anthropic pricing page.
- Choose Claude Pro billed monthly.
- Complete the account checkout.
- Set a reminder at least 24 hours before renewal if you only need one month.
Claude Code uses a different installation command on each operating system. Choose your platform below.
macOS
- Switch back to the Terminal window from earlier.
- Install Claude Code by running this command:
curl -fsSL https://claude.ai/install.sh | bash
What does this command do?
This command downloads Anthropic's native macOS installer. The installer adds Claude Code to your computer.
Windows
- Switch back to the PowerShell window from earlier.
- Confirm that the prompt begins with PS.
- Install Claude Code by running this command:
irm https://claude.ai/install.ps1 | iex
What does this command do?
This command downloads Anthropic's native Windows installer through PowerShell. The installer adds Claude Code to your computer.
- Verify the Claude Code installation by running:
claude --version
What does this check prove?
The claude --version command asks the installed Claude Code application to print its version. A version number confirms the terminal can find it.
You should see a Claude Code version number. That confirms the paid coding tool is ready to launch.
Claude command not found?
- Close the current terminal window.
- Reopen Terminal on macOS or PowerShell on Windows.
- Repeat the Claude Code installation command for your platform if the check still fails.
Ask for help with the Claude Code installation:
Create the project folder and start Claude Code
Claude Code uses the current terminal folder as the boundary for its work. Starting from an empty folder keeps the first build focused on Spell Sprint.
- Switch back to the terminal from earlier.
- Move to your home directory by running this command:
cd ~
What does this command do?
The cd ~ command moves the terminal to your home directory. The project folder will live directly inside this location.
- Create the empty project folder by running these commands:
mkdir spell-sprint
cd spell-sprint
What do these commands do?
The first command creates the spell-sprint folder. The second command moves the terminal into it.
The folder stays empty at this point. Claude Code receives the first build instructions in the next step.
- Start Claude Code from the empty folder by running:
claude
What happens when Claude Code starts?
The claude command starts an interactive session inside the current folder. Claude Code may open a browser so you can sign in.
- Complete the browser sign-in with your Claude Pro account.
- Return to the terminal after the sign-in completes.
Before you submit the setup prompt, do you think Claude Code will create files or only confirm the empty folder?
- Paste this setup prompt into the Claude Code session:
You are helping a complete beginner build a local browser game called Spell Sprint. The learner may be on macOS or Windows. Do not create or change files yet. Confirm that the current working directory is the empty spell-sprint project folder, explain that you will ask before running commands or editing files, and reply with exactly: Ready for the first build prompt.
Why start with this prompt?
The prompt checks that Claude Code is working inside the correct empty folder. It also establishes that Claude Code asks before running commands or editing files.
You should see Ready for the first build prompt. as the final reply. Your Claude Code session now has a clean starting point for the game.
✔️ Awesome, I've got everything!
Your terminal is inside the empty spell-sprint folder. Claude Code is open there after returning the exact readiness message.
ⓧ I'd like to double check the full code
There is no code to compare yet. Your local spell-sprint folder should be empty.
Claude Code should be open from that folder. Its final reply should be exactly Ready for the first build prompt.
Your tools are verified. Next, you will give Claude Code the first build prompt and play the opening version of Spell Sprint.
Build the Playable Obstacle Course
Your development tools are ready inside the empty spell-sprint folder. The next proof is a game you can control in Chrome.
In this step, you will ask Claude Code to build the first playable course with Vite. Three.js will render the player, platforms, gaps, barriers, camera, and finish area.
In this step, get ready to:
- Generate the first Spell Sprint project files from a detailed Claude Code prompt.
- Install the dependencies and pass a production build.
- Run the game in Chrome and test movement, jumping, falling, and respawning.
Generate the first game version
A detailed build prompt acts as the specification for your coding agent. It fixes the project structure before later features add more moving parts.
- Return to the Claude Code terminal session from the previous step.
- Paste the complete build prompt below into Claude Code:
Create the first working version of Spell Sprint in this empty folder. Use plain JavaScript, Vite 8.3.8, and Three.js 0.187.0. Create package.json with type module, scripts named dev and build, three pinned to 0.187.0, and vite pinned to 8.3.8. Create index.html, src/style.css, src/main.js, and src/game.js. Do not use React, external assets, CDNs, TypeScript, or a scaffold command.
Build a colorful 3D obstacle course using import * as THREE from 'three' and only simple box geometry. The player must move with WASD or arrow keys, jump with Space, cross four floor sections separated by gaps, avoid three low box barriers, and respawn at the most recent safe section after falling below the course. Use a fixed trailing camera, a visible Start run button, a status message, and a timer. The first version should end at a visible finish point before any locked door. Keep functions small and add beginner-readable comments only where the logic is not obvious.
After writing the files, run npm install and npm run build. Fix any build errors. Then tell me the exact command to start the development server and the URL to open. Do not add recording, ghost playback, collectible letters, chat, a server, or an API key yet.
What This Prompt Controls
- The version pins keep Three.js at 0.187.0 and Vite at 8.3.8.
- The file list gives each part of the game a clear home.
- The gameplay requirements give you a complete movement loop with an observable respawn.
- The exclusions keep recording, ghost playback, spelling, and chat outside this first version.
- Press Enter to submit the build prompt.
Claude Code will inspect the empty folder before proposing its files. You will see permission requests before it edits the project or runs commands.
Approve the files and production build
Claude Code keeps you in control by pausing before file edits and terminal commands. These checkpoints let you confirm that every action matches the prompt.
- Review the proposed file edits when Claude Code asks for permission.
- Approve the proposed file edits.
- Approve the dependency installation command when requested.
You will see the requested files appear in the spell-sprint folder. The terminal will print package installation output.
- Approve the production build command when requested.
- Wait for Claude Code to report that the build succeeded.
That is the first hard checkpoint done. Your generated project now passes its production build.
Did the build report an error?
A build error means one of the generated files needs a correction. Keep the requested versions and project structure unchanged.
- Paste this repair prompt into the same Claude Code session:
Fix the build error without changing the requested versions or adding a framework, then run npm run build again.
This prompt limits the repair to the failed build. It also asks Claude Code to rerun the check after making the correction.
help me understand and fix the build failure
✔️ Awesome, I've got everything!
Great. Your dependencies are installed and Claude Code has confirmed a successful production build.
ⓧ I'd like to double check the full code
Compare the generated project against this required artifact checklist. Every item should be present before you start the game.
- The package.json file defines an ES module project named spell-sprint. It includes the dev and build scripts. It pins Three.js to 0.187.0 and Vite to 8.3.8.
- The index.html file contains the Spell Sprint page shell. It includes the status text, timer, game container, Start run button, controls text, and module entry.
- The src/style.css file styles the page, buttons, header, footer, game container, and canvas. It also includes a responsive layout.
- The src/main.js file imports the stylesheet. It imports createGame from ./game.js. It connects the Start run button, status text, and timer to the game.
- The src/game.js file imports Three.js. It exports createGame. It creates the scene, camera, renderer, floor sections, rails, barriers, player, and finish area. It handles keyboard controls, jumping, collisions, checkpoints, the trailing camera, and fall respawning.
Run and test the course
The production build proves that the project compiles. The development server gives you the live version that responds to keyboard input.
Before you run this, make a quick prediction about what the movement keys will change in the game.
- Start the Vite development server by running:
npm run dev
What Does This Command Do?
The development script starts Vite and prints a local address. It normally serves this project at http://localhost:5173.
The terminal remains attached to the server while the game is running. Keep that terminal session active during the play-test.
- Open http://localhost:5173 in Chrome.
- Click Start run.
You will see the status update when the run starts. The timer will begin counting.
- Move the block character with WASD or the arrow keys.
- Press Space to jump over one low barrier.
You will see the player cross the floor while the camera follows from behind. A successful jump carries the player over the barrier.
- Steer the player into one of the gaps.
The player will fall below the course. You will then see the character return to the most recent safe section with the status You fell. Respawned at the last safe section..
- Continue along the four floor sections until you reach the visible finish point.
You have the first playable Spell Sprint loop working. Movement, jumping, collision checks, the camera, and checkpoint respawning now work together.
Game not responding?
If the page does not load, confirm that the development server is still running in the terminal. Use the local address printed by that terminal.
If the timer stays still, click Start run before using the movement keys. If the player does not respawn, make sure it falls fully below a gap.
help me debug the playable Spell Sprint course
Your first playable course is live. Next, you will turn completed attempts into saved run data and downloadable JSON files.
Record Three Local Runs
Your obstacle course now responds to movement, jumping, falling, and finishing. You can complete a full attempt from the starting point to the finish.
A completed path currently disappears when the run ends. That makes every attempt temporary.
This step captures each attempt as local JSON data. After three runs, you will test whether those stored paths appear as visible competitors.
In this step, get ready to:
- Ask Claude Code to add local run recording.
- Save three completed attempts in the browser.
- Compare the stored paths with what appears on the course.
Add local run recording
A recorded run is a timeline of player positions. Each frame stores elapsed time plus the player's coordinates.
The recording manager keeps the three newest attempts in the browser. It also downloads each completed attempt as a readable file.
- Switch back to the Claude Code session in the spell-sprint folder.
- Paste this complete recording prompt into the session:
Extend the working Spell Sprint project with recording only. Keep the game playable and keep the current package versions. Create src/recordings.js and update index.html, src/style.css, and src/main.js.
When Start run is clicked, record the player's x, y, and z position with elapsed milliseconds at a reasonable interval. When the player crosses the finish point, stop recording, keep at most the three newest runs in window.localStorage under the key spell-sprint-recordings-v1, update an on-screen Saved runs counter, and automatically download that run as formatted JSON named spell-sprint-run-1.json, spell-sprint-run-2.json, or spell-sprint-run-3.json. Add a Clear recordings button that clears both the counter and that localStorage key. A refresh must restore the saved-run count.
This is an intentional intermediate version. Do not draw or replay ghosts yet. Run npm run build, fix any errors, and summarize exactly what I should observe after finishing three runs.
What does this prompt add?
- The new src/recordings.js module captures the player's position at approximately 80-millisecond intervals.
- The spell-sprint-recordings-v1 key identifies the saved data in localStorage.
- The Saved runs counter shows how many attempts are available.
- Each downloaded file provides a separate copy of one recorded path.
- Submit the prompt to Claude Code.
- Review the proposed changes to index.html, src/style.css, src/main.js, and src/recordings.js.
- Approve the proposed file edits.
- Approve the requested build command.
Claude Code should report that the build succeeds. Its summary should mention browser storage, the Saved runs counter, and automatic JSON downloads.
Build did not succeed?
A failed build usually means an import or generated edit does not match the existing project. Keep the requested package versions unchanged during the repair.
- Ask Claude Code to repair the build by pasting:
Fix the build error without changing the requested versions or adding a framework, then run npm run build again.
This repair prompt keeps the current project structure. It also asks Claude Code to prove the repair with another build.
Get targeted help by asking why the recording build is failing.
✔️ Awesome, I've got everything!
Great. Your project now builds with local recording connected to the existing game.
ⓧ I'd like to double check the full code
The complete src/recordings.js file should contain only the recording manager at this stage:
const STORAGE_KEY = 'spell-sprint-recordings-v1';
export function createRecordingManager(onChange) {
let runs = loadRuns();
let activeRun = null;
let lastCapturedAt = 0;
function loadRuns() {
try {
const saved = JSON.parse(window.localStorage.getItem(STORAGE_KEY) ?? '[]');
return Array.isArray(saved) ? saved.slice(-3) : [];
} catch {
return [];
}
}
function saveRuns() {
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(runs));
onChange(runs.length);
}
function start() {
activeRun = {
recordedAt: new Date().toISOString(),
startedAt: performance.now(),
frames: []
};
lastCapturedAt = 0;
}
function capture({ x, y, z, now }) {
if (!activeRun || now - lastCapturedAt < 80) return;
lastCapturedAt = now;
activeRun.frames.push({
t: Math.round(now - activeRun.startedAt),
x: Number(x.toFixed(3)),
y: Number(y.toFixed(3)),
z: Number(z.toFixed(3))
});
}
function finish() {
if (!activeRun || activeRun.frames.length < 2) return null;
const savedRun = {
recordedAt: activeRun.recordedAt,
frames: activeRun.frames
};
runs = [...runs, savedRun].slice(-3);
activeRun = null;
saveRuns();
const link = document.createElement('a');
link.hidden = true;
link.download = `spell-sprint-run-${runs.length}.json`;
link.href =
'data:application/json;charset=utf-8,' +
encodeURIComponent(JSON.stringify(savedRun, null, 2));
document.body.appendChild(link);
link.click();
return savedRun;
}
function clear() {
runs = [];
activeRun = null;
window.localStorage.removeItem(STORAGE_KEY);
onChange(0);
}
return {
start,
capture,
finish,
clear,
list: () => runs,
count: () => runs.length,
isActive: () => activeRun !== null
};
}
This module owns capture, storage, restoration, clearing, and JSON downloading. It does not contain ghost meshes or replay logic.
- Confirm that index.html contains #run-count for the Saved runs counter.
- Confirm that index.html contains #clear-button for the Clear recordings control.
- Confirm that src/main.js imports createRecordingManager from ./recordings.js.
- Confirm that the Start run handler calls recorder.start().
- Confirm that the frame callback calls recorder.capture(frame).
- Confirm that the finish callback calls recorder.finish().
- Confirm that the Clear recordings handler calls recorder.clear().
Save three local runs
The recorder starts when you begin a run. Crossing the finish point stores the captured frames before triggering the download.
- Return to the terminal panel from earlier if the Vite development server has stopped.
- Restart the development server when needed by running:
npm run dev
The terminal prints the local development URL. The usual address is http://localhost:5173.
- Leave the development server running in this terminal.
Development server did not start?
Confirm that the terminal path ends in spell-sprint. A different folder does not contain this project's scripts.
Ask why the Spell Sprint development server will not start.
- Switch back to the Chrome tab showing the local game.
- Refresh the game page.
- Click Start run.
- Move through the course with WASD or the arrow keys.
- Complete one successful jump with Space.
- Cross the visible finish point.
You should see Saved runs: 1 / 3. Chrome should also download spell-sprint-run-1.json.
That first saved path proves the game can preserve a complete attempt.
First run was not saved?
Make sure you crossed the finish point after clicking Start run. An unfinished attempt remains active.
If the counter stays at zero, confirm that src/main.js passes each frame to recorder.capture(frame). Confirm that the finish callback calls recorder.finish().
Ask why the completed run did not save.
- Click Start another run.
- Finish the course for the second time.
- Confirm that spell-sprint-run-2.json downloads.
- Click Start another run.
- Finish the course for the third time.
- Confirm that spell-sprint-run-3.json downloads.
You should now see Saved runs: 3 / 3 beside the game.
You have captured the full set of paths needed for the next part of Spell Sprint.
Expose the missing players
A refresh tests whether the browser can restore the saved runs. The Downloads folder proves that each attempt also exists outside the game.
- Refresh the Chrome game page.
You should still see Saved runs: 3 / 3. This confirms that the browser restored all three attempts.
- Press Cmd+Space on macOS or the Windows key on Windows to open system search.
- Type Finder on macOS or File Explorer on Windows.
- Press Enter.
- Select the Downloads folder.
- Confirm that the three spell-sprint-run-*.json files are listed.
Before you start another run, do you think the three saved paths will appear as moving competitors?
- Return to the Chrome game.
- Click Start another run.
- Move toward the first gap.
- Watch the course for other moving players.
You will see only your current player. The three saved paths do not appear in the course.
Why is the course still empty?
The recording manager stores coordinates over time. The game does not yet turn those coordinates into moving shapes.
This is the intended shortfall. Saved movement becomes a competitor only after replay logic connects it to a visible player.
Your game now preserves three runs across a browser refresh. Next, you will turn those paths into visible competitors.
Replay Ghost Bots and Open Level 2
Your three recorded runs now persist after a refresh. However, the course still feels empty because those saved paths never return as competitors.
In this step, Claude Code will turn each recording into a visible replay. Three.js will render three distinct ghost shapes that follow the stored positions.
You will also add geometric letters to the route. Collecting the exact word CAT will remove a locked door and reveal Level 2.
In this step, get ready to:
- Turn three saved paths into distinct ghost competitors.
- Add geometric C, A, and T collectibles to the course.
- Open the Level 2 door by completing the word CAT.
Ask Claude Code to add the missing systems
A replay needs positions for moments that fall between recorded frames. Interpolation estimates those positions so each ghost moves smoothly along its saved path.
- Switch back to the Claude Code session from earlier.
- Paste this complete build prompt:
Turn the three saved Spell Sprint recordings into visible ghost bots and add the spelling-locked Level 2. Keep Three.js 0.187.0 and Vite 8.3.8.
Extend src/recordings.js with a ghost manager that pre-creates three Mesh objects in the scene. Make BOT 1 a tall box, BOT 2 a wide box, and BOT 3 a small cube. Add a persistent on-screen legend with those exact labels. When a new run starts, start all available ghosts at elapsed time zero, interpolate between their recorded frames, move them along their saved x, y, and z paths, and move each ghost below the world after its recording ends. Ghosts are visual replays only and must not affect collision.
Extend src/game.js with geometric box-built letters C, A, and T placed in that order along the main route. Collect each letter when the player reaches it, show progress in the HUD, and keep a full-width door closed near the end until the collected word is exactly CAT. When CAT is complete, move the door below the world and expose a bright Level 2 platform beyond it. Keep the recording finish point just before the door so the three existing recordings remain useful. Reset letters and the door on each new run.
Update src/main.js, index.html, and src/style.css as needed. Run npm run build, fix all errors, and preserve the existing JSON downloads, localStorage key, movement, jumping, respawn behavior, timer, saved-run counter, and Clear recordings button.
What does this prompt add?
- The new createGhostManager(scene, initialRuns) function pre-creates one mesh for each saved run.
- The replay manager interpolates between timestamped frames to keep each ghost moving smoothly.
- The game builds the letters from simple box geometry that matches the existing course.
- The collectedWord value tracks the letters reached during the current run.
- The door moves below the world after the collected word becomes CAT.
The ghost meshes are visual replays. They cannot push the player or block the course.
- Review Claude Code's proposed changes to the existing project files.
- Approve the proposed file edits.
- Approve the build command when Claude Code asks for permission.
You should see Claude Code report that the build succeeds. That confirms the replay system and Level 2 course compile together.
Build did not succeed?
- Check that Claude Code preserved the pinned package versions from the existing project.
- Ask Claude Code to fix the reported build problem without removing the recording features.
Get targeted help by asking Claude Code to help me fix the Spell Sprint build while preserving the ghost replay and CAT door features.
Test the ghost replay
Each ghost starts from elapsed time zero when a new run begins. Its shape identifies the recording even when several paths overlap.
Before you click Start run, do you think the saved paths appear immediately or wait for another recording to finish?
- Return to the Chrome tab from earlier.
- Refresh http://localhost:5173.
- Click Start run.
- Watch the course while the three saved runs replay.
You should see a tall box, a wide box, and a small cube moving along the recorded paths. Your saved movement now has three visible competitors.
The persistent legend should show BOT 1: TALL, BOT 2: WIDE, and BOT 3: SMALL.
Ghosts are not moving?
- Confirm the Saved runs counter still shows 3 / 3.
- Click the start button again to restart every available replay from elapsed time zero.
- Check that the browser page finished refreshing after Claude Code completed the build.
Get targeted help by asking Claude Code to trace why my three saved Spell Sprint runs are not appearing as ghost meshes.
Spell CAT and enter Level 2
The door reads the current collectedWord value. Starting a new run resets the letters and restores the locked door.
Before you begin this final check, do you expect the door to move after the first letter or only after the complete word?
- Click Start run to reset the course.
- Read the ghost legend above the course.
- Watch all available ghost shapes begin their replays.
- Guide the player through the geometric C.
- Collect the geometric A.
- Collect the geometric T.
- Cross the cleared doorway into the bright Level 2 platform.
You should see C A T in the letters display. The full-width door should drop below the course.
You should then reach the bright Level 2 platform beyond the doorway. The spelling-locked route now works from start to finish.
Why keep the finish point before the door?
The existing recordings end before the new door. Keeping the finish point there lets all three saved paths remain useful without recording them again.
Your recorded runs now race beside you. Next, you will add a local phrase-only chat to the completed Level 2 area.
Add Safe Chat and Record Your Demo
Your three saved runs now race beside you as visible ghost bots. Collecting CAT opens the path into Level 2.
The final local feature adds child-conscious communication without accounts or network traffic. You will use Claude Code to create parent-written phrases before recording the complete game loop.
In this step, get ready to:
- Add four approved phrases with deterministic Bot Coach replies.
- Play-test ghost playback, CAT collection, the Level 2 door, and local chat.
- Save a screen recording of the completed game loop.
Add the local phrase chat
An approved-phrase chat limits the player to messages already written by a parent. Deterministic replies keep every local response predictable.
How does the local chat stay controlled?
The chat offers four buttons instead of a free-text field. Each button maps to a scripted reply in src/chat.js.
The browser handles the entire exchange locally. The privacy note makes that boundary visible during the demo.
- Switch back to the Claude Code session in the spell-sprint folder.
- Add the local chat by pasting this complete prompt:
Finish the local-only Spell Sprint demo with a parent-written phrase chat. Create src/chat.js and update index.html, src/style.css, and src/main.js. Keep all existing game features and package versions.
The chat panel must stay hidden until the player enters Level 2. It must offer only these four buttons: Great jumping!, Nice spelling!, Meet you at Level 2!, and Good game! Do not add a free-text box. Store the approved phrases and deterministic scripted replies in src/chat.js so a parent can read and edit them. Label the local response as Bot Coach and add a visible note that says Local scripted chat: nothing is sent online. Do not create accounts, sockets, analytics, external links, a backend, or an API call.
Polish the layout so the game, HUD, ghost legend, controls, saved-run counter, and chat are readable in a screen recording. Run npm run build, fix all errors, and give me a four-item play-test checklist covering movement and respawn, three ghost labels, CAT and the door, and local chat.
What does this prompt add?
- The prompt creates src/chat.js with readable phrase and reply constants.
- The prompt adds a hidden chat panel that appears after the player enters Level 2.
- The prompt preserves the existing game while checking the production build.
- Approve the proposed file edits when Claude Code requests permission.
- Approve the npm run build command when Claude Code requests permission.
You should see a successful build followed by a four-item play-test checklist. Your local chat now compiles with the existing game.
Build did not succeed?
Ask Claude Code to inspect the build output without changing the pinned package versions. Confirm that its fixes stay inside the files named in the prompt.
Help me fix the Spell Sprint build while preserving every existing game feature and package version.
✔️ Awesome, I've got everything!
Your local chat files are ready for the browser test. Double check that Claude Code saved every edit.
ⓧ I'd like to double check the full code
Compare your completed local project with these final files. The unchanged game and recording modules are included so you can verify the whole project.
{
"name": "spell-sprint",
"private": true,
"version": "1.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"dependencies": {
"three": "0.187.0"
},
"devDependencies": {
"vite": "8.3.8"
}
}
What does this file control?
This file preserves the local development scripts. It also keeps the pinned Three.js and Vite versions used by the game.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Spell Sprint</title>
</head>
<body>
<div id="app">
<header>
<div>
<h1>Spell Sprint</h1>
<p id="status">Press Start run when you are ready.</p>
</div>
<div class="stats">
<span>Time: <strong id="timer">0.0s</strong></span>
<span>Letters: <strong id="letters">_ _ _</strong></span>
<span>Saved runs: <strong id="run-count">0 / 3</strong></span>
</div>
</header>
<div id="ghost-legend" aria-label="Ghost bot legend">
<span>BOT 1: TALL</span>
<span>BOT 2: WIDE</span>
<span>BOT 3: SMALL</span>
</div>
<main id="game-shell">
<div id="game" aria-label="Spell Sprint game"></div>
<aside id="chat-panel" hidden>
<h2>Level 2 Team Chat</h2>
<p class="privacy-note">Local scripted chat: nothing is sent online.</p>
<div id="messages" aria-live="polite"></div>
<div id="phrase-buttons"></div>
</aside>
</main>
<footer>
<button id="start-button" type="button">Start run</button>
<button id="clear-button" type="button">Clear recordings</button>
<p>Move: WASD or arrow keys. Jump: Space.</p>
</footer>
</div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
What does this page contain?
The page keeps the game HUD and exact ghost legend. It adds a hidden chat panel with the local privacy note.
:root {
font-family: Inter, system-ui, sans-serif;
color: #13213c;
background: #e9f7ff;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
min-width: 320px;
}
button {
border: 0;
border-radius: 999px;
padding: 0.7rem 1rem;
color: white;
background: #5b4bdb;
font-weight: 800;
cursor: pointer;
}
button:hover,
button:focus-visible {
background: #4032b8;
}
[hidden] {
display: none !important;
}
#app {
width: min(1180px, 100%);
margin: 0 auto;
padding: 1rem;
}
header,
footer,
#ghost-legend {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
flex-wrap: wrap;
}
h1,
h2,
p {
margin: 0.25rem 0;
}
.stats,
#ghost-legend {
display: flex;
gap: 0.75rem;
flex-wrap: wrap;
}
.stats span,
#ghost-legend span {
border-radius: 0.8rem;
padding: 0.5rem 0.75rem;
background: white;
box-shadow: 0 4px 14px rgb(19 33 60 / 12%);
}
#ghost-legend {
margin: 0.8rem 0;
justify-content: flex-start;
font-weight: 900;
}
#game-shell {
display: grid;
grid-template-columns: minmax(0, 1fr) 280px;
gap: 1rem;
}
#game {
width: 100%;
height: 620px;
overflow: hidden;
border-radius: 1rem;
background: linear-gradient(#85d8ff, #fff2a8);
box-shadow: 0 12px 30px rgb(19 33 60 / 20%);
}
#game canvas {
display: block;
}
#chat-panel {
min-height: 300px;
padding: 1rem;
border-radius: 1rem;
background: white;
box-shadow: 0 12px 30px rgb(19 33 60 / 14%);
}
.privacy-note {
margin-bottom: 1rem;
color: #4e5e79;
font-size: 0.9rem;
}
#messages {
min-height: 160px;
max-height: 280px;
overflow: auto;
padding: 0.6rem;
border-radius: 0.8rem;
background: #f3f5ff;
}
.message {
margin: 0.5rem 0;
padding: 0.55rem;
border-radius: 0.6rem;
background: white;
}
#phrase-buttons {
display: grid;
gap: 0.5rem;
margin-top: 0.75rem;
}
footer {
margin-top: 1rem;
justify-content: flex-start;
}
@media (max-width: 850px) {
#game-shell {
grid-template-columns: 1fr;
}
#game {
height: 520px;
}
}
What does this styling change?
The layout places the game beside the chat on wide screens. It stacks both areas on narrow screens for a readable recording.
import * as THREE from 'three';
const FLOOR_RANGES = [
[-1, 10],
[-9, -4],
[-18, -13],
[-40, -22]
];
export function createGame({
container,
onFrame,
onFinish,
onCollect,
onDoorUnlock,
onLevelTwo,
onStatus
}) {
const width = container.clientWidth;
const height = container.clientHeight;
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(60, width / height, 0.1, 100);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(width, height);
container.appendChild(renderer.domElement);
const material = new THREE.MeshNormalMaterial();
function createBox(boxWidth, boxHeight, boxDepth, x, y, z) {
const geometry = new THREE.BoxGeometry(boxWidth, boxHeight, boxDepth);
const mesh = new THREE.Mesh(geometry, material);
mesh.position.x = x;
mesh.position.y = y;
mesh.position.z = z;
scene.add(mesh);
return mesh;
}
for (const [minimum, maximum] of FLOOR_RANGES) {
const depth = maximum - minimum;
createBox(9, 0.6, depth, 0, -0.3, (minimum + maximum) / 2);
}
createBox(0.35, 1.2, 50, -4.7, 0.3, -15);
createBox(0.35, 1.2, 50, 4.7, 0.3, -15);
const obstacles = [
{ x: 0, z: -6.3, width: 2.6, height: 1.2, depth: 0.9 },
{ x: -1.7, z: -15.4, width: 2.2, height: 1.3, depth: 0.9 },
{ x: 1.7, z: -24.5, width: 2.2, height: 1.3, depth: 0.9 }
];
for (const obstacle of obstacles) {
createBox(
obstacle.width,
obstacle.height,
obstacle.depth,
obstacle.x,
obstacle.height / 2,
obstacle.z
);
}
const player = createBox(0.8, 1, 0.8, 0, 0.5, 8);
const door = createBox(9, 4, 0.5, 0, 2, -28.5);
createBox(9, 0.7, 8, 0, 0.15, -35);
createBox(0.6, 4, 0.6, -4, 2, -32);
createBox(0.6, 4, 0.6, 4, 2, -32);
createBox(8.6, 0.6, 0.6, 0, 4, -32);
function createLetter(letter, z, pattern) {
const parts = pattern.map(([partWidth, partHeight, offsetX, offsetY]) => {
const part = createBox(partWidth, partHeight, 0.28, offsetX, 1.5 + offsetY, z);
return { mesh: part, homeY: part.position.y };
});
return { letter, z, parts, collected: false };
}
const letters = [
createLetter('C', 5, [
[0.25, 1.5, -0.35, 0],
[0.9, 0.25, 0, 0.62],
[0.9, 0.25, 0, -0.62]
]),
createLetter('A', -15, [
[0.25, 1.5, -0.35, 0],
[0.25, 1.5, 0.35, 0],
[0.9, 0.25, 0, 0.62],
[0.75, 0.2, 0, 0]
]),
createLetter('T', -24, [
[0.95, 0.25, 0, 0.62],
[0.25, 1.5, 0, 0]
])
];
const keys = new Set();
let running = false;
let playerX = 0;
let playerY = 0.5;
let playerZ = 8;
let verticalSpeed = 0;
let grounded = true;
let collectedWord = '';
let doorLocked = true;
let finishSent = false;
let levelTwoSent = false;
let previousTime = performance.now();
function isGroundAt(z) {
return FLOOR_RANGES.some(([minimum, maximum]) => z >= minimum && z <= maximum);
}
function isBlocked(x, y, z) {
return obstacles.some((obstacle) => {
const hitsX = Math.abs(x - obstacle.x) < obstacle.width / 2 + 0.35;
const hitsZ = Math.abs(z - obstacle.z) < obstacle.depth / 2 + 0.35;
const isTooLow = y < obstacle.height + 0.45;
return hitsX && hitsZ && isTooLow;
});
}
function checkpointFor(z) {
if (z > -4) return 8;
if (z > -13) return -5;
if (z > -22) return -14;
return -23;
}
function respawn() {
playerX = 0;
playerZ = checkpointFor(playerZ);
playerY = 0.5;
verticalSpeed = 0;
grounded = true;
onStatus('You fell. Respawned at the last safe section.');
}
function resetLettersAndDoor() {
collectedWord = '';
doorLocked = true;
door.position.y = 2;
for (const letter of letters) {
letter.collected = false;
for (const part of letter.parts) {
part.mesh.position.y = part.homeY;
}
}
onCollect(collectedWord);
}
function reset() {
playerX = 0;
playerY = 0.5;
playerZ = 8;
verticalSpeed = 0;
grounded = true;
finishSent = false;
levelTwoSent = false;
resetLettersAndDoor();
}
function start() {
reset();
running = true;
}
window.addEventListener('keydown', (event) => {
keys.add(event.code);
if (event.code === 'Space') {
event.preventDefault();
if (running && grounded) {
verticalSpeed = 7.8;
grounded = false;
}
}
});
window.addEventListener('keyup', (event) => {
keys.delete(event.code);
});
function collectLetters() {
for (const letter of letters) {
if (!letter.collected && Math.abs(playerZ - letter.z) < 0.8) {
letter.collected = true;
collectedWord += letter.letter;
for (const part of letter.parts) {
part.mesh.position.y = -100;
}
onCollect(collectedWord);
}
}
if (doorLocked && collectedWord === 'CAT') {
doorLocked = false;
door.position.y = -100;
onDoorUnlock();
}
}
function update(delta) {
let horizontal = 0;
let forward = 0;
if (keys.has('KeyA') || keys.has('ArrowLeft')) horizontal -= 1;
if (keys.has('KeyD') || keys.has('ArrowRight')) horizontal += 1;
if (keys.has('KeyW') || keys.has('ArrowUp')) forward -= 1;
if (keys.has('KeyS') || keys.has('ArrowDown')) forward += 1;
const length = Math.hypot(horizontal, forward) || 1;
const speed = 6;
let nextX = playerX + (horizontal / length) * speed * delta;
let nextZ = playerZ + (forward / length) * speed * delta;
nextX = Math.max(-4.2, Math.min(4.2, nextX));
if (isBlocked(nextX, playerY, nextZ)) {
nextX = playerX;
nextZ = playerZ;
}
if (doorLocked && playerZ > -28.2 && nextZ < -28.0) {
nextZ = -28.0;
onStatus('The Level 2 door needs the word CAT.');
}
playerX = nextX;
playerZ = nextZ;
verticalSpeed -= 18 * delta;
playerY += verticalSpeed * delta;
if (isGroundAt(playerZ) && playerY <= 0.5 && verticalSpeed <= 0) {
playerY = 0.5;
verticalSpeed = 0;
grounded = true;
} else if (!isGroundAt(playerZ)) {
grounded = false;
}
if (playerY < -8) respawn();
collectLetters();
if (!finishSent && playerZ < -26.2) {
finishSent = true;
onFinish();
}
if (!levelTwoSent && playerZ < -31.5) {
levelTwoSent = true;
onLevelTwo();
}
}
function animate(now) {
const delta = Math.min((now - previousTime) / 1000, 0.033);
previousTime = now;
if (running) update(delta);
player.position.x = playerX;
player.position.y = playerY;
player.position.z = playerZ;
camera.position.x = playerX;
camera.position.y = 7;
camera.position.z = playerZ + 10;
camera.rotation.x = -0.55;
onFrame({ x: playerX, y: playerY, z: playerZ, now });
renderer.render(scene, camera);
}
renderer.setAnimationLoop(animate);
return { scene, start };
}
What does the game module handle?
This module controls movement, jumping, barriers, checkpoints, and respawning. It also collects CAT before opening the Level 2 door.
import * as THREE from 'three';
const STORAGE_KEY = 'spell-sprint-recordings-v1';
export function createRecordingManager(onChange) {
let runs = loadRuns();
let activeRun = null;
let lastCapturedAt = 0;
function loadRuns() {
try {
const saved = JSON.parse(window.localStorage.getItem(STORAGE_KEY) ?? '[]');
return Array.isArray(saved) ? saved.slice(-3) : [];
} catch {
return [];
}
}
function saveRuns() {
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(runs));
onChange(runs.length);
}
function start() {
activeRun = {
recordedAt: new Date().toISOString(),
startedAt: performance.now(),
frames: []
};
lastCapturedAt = 0;
}
function capture({ x, y, z, now }) {
if (!activeRun || now - lastCapturedAt < 80) return;
lastCapturedAt = now;
activeRun.frames.push({
t: Math.round(now - activeRun.startedAt),
x: Number(x.toFixed(3)),
y: Number(y.toFixed(3)),
z: Number(z.toFixed(3))
});
}
function finish() {
if (!activeRun || activeRun.frames.length < 2) return null;
const savedRun = {
recordedAt: activeRun.recordedAt,
frames: activeRun.frames
};
runs = [...runs, savedRun].slice(-3);
activeRun = null;
saveRuns();
const link = document.createElement('a');
link.hidden = true;
link.download = `spell-sprint-run-${runs.length}.json`;
link.href =
'data:application/json;charset=utf-8,' +
encodeURIComponent(JSON.stringify(savedRun, null, 2));
document.body.appendChild(link);
link.click();
return savedRun;
}
function clear() {
runs = [];
activeRun = null;
window.localStorage.removeItem(STORAGE_KEY);
onChange(0);
}
return {
start,
capture,
finish,
clear,
list: () => runs,
count: () => runs.length,
isActive: () => activeRun !== null
};
}
export function createGhostManager(scene, initialRuns) {
const material = new THREE.MeshNormalMaterial();
const shapes = [
new THREE.BoxGeometry(0.7, 1.6, 0.7),
new THREE.BoxGeometry(1.3, 0.8, 0.8),
new THREE.BoxGeometry(0.8, 0.8, 0.8)
];
const ghosts = shapes.map((geometry) => {
const mesh = new THREE.Mesh(geometry, material);
mesh.position.y = -100;
scene.add(mesh);
return { mesh, frameIndex: 0 };
});
let runs = initialRuns.slice(-3);
let startedAt = 0;
function setRuns(nextRuns) {
runs = nextRuns.slice(-3);
for (const ghost of ghosts) ghost.mesh.position.y = -100;
}
function start() {
startedAt = performance.now();
for (const ghost of ghosts) ghost.frameIndex = 0;
}
function update(now) {
const elapsed = now - startedAt;
ghosts.forEach((ghost, ghostIndex) => {
const run = runs[ghostIndex];
if (!run || run.frames.length < 2) {
ghost.mesh.position.y = -100;
return;
}
const frames = run.frames;
if (elapsed > frames[frames.length - 1].t) {
ghost.mesh.position.y = -100;
return;
}
while (
ghost.frameIndex < frames.length - 2 &&
frames[ghost.frameIndex + 1].t < elapsed
) {
ghost.frameIndex += 1;
}
const first = frames[ghost.frameIndex];
const second = frames[ghost.frameIndex + 1];
const span = Math.max(1, second.t - first.t);
const amount = Math.max(0, Math.min(1, (elapsed - first.t) / span));
ghost.mesh.position.x = first.x + (second.x - first.x) * amount;
ghost.mesh.position.y = first.y + (second.y - first.y) * amount;
ghost.mesh.position.z = first.z + (second.z - first.z) * amount;
});
}
return { setRuns, start, update };
}
What does the recording module handle?
This module stores the three newest movement recordings. It also downloads JSON files and replays saved frames through three distinct ghost shapes.
const APPROVED_PHRASES = [
'Great jumping!',
'Nice spelling!',
'Meet you at Level 2!',
'Good game!'
];
const SCRIPTED_REPLIES = {
'Great jumping!': 'Bot Coach: That gap jump was awesome!',
'Nice spelling!': 'Bot Coach: CAT opened the door!',
'Meet you at Level 2!': 'Bot Coach: I will race you there!',
'Good game!': 'Bot Coach: Good game, teammate!'
};
export function setupLocalChat({ panel, messages, buttons, onStatus }) {
function addMessage(label, text) {
const message = document.createElement('p');
message.className = 'message';
message.textContent = `${label}: ${text}`;
messages.appendChild(message);
messages.scrollTop = messages.scrollHeight;
}
addMessage('Bot Coach', 'Choose a parent-approved phrase when you reach Level 2.');
for (const phrase of APPROVED_PHRASES) {
const button = document.createElement('button');
button.type = 'button';
button.textContent = phrase;
button.addEventListener('click', () => {
addMessage('You', phrase);
addMessage('Bot Coach', SCRIPTED_REPLIES[phrase].replace('Bot Coach: ', ''));
onStatus('Local phrase delivered. Nothing was sent online.');
});
buttons.appendChild(button);
}
return {
show: () => {
panel.hidden = false;
},
hide: () => {
panel.hidden = true;
}
};
}
What does the chat module handle?
The APPROVED_PHRASES list defines every message the player can choose. The SCRIPTED_REPLIES object maps each choice to a predictable response.
The setupLocalChat function creates the buttons. It also exposes the controls that show or hide the panel.
import './style.css';
import { createGame } from './game.js';
import { createGhostManager, createRecordingManager } from './recordings.js';
import { setupLocalChat } from './chat.js';
const status = document.querySelector('#status');
const timer = document.querySelector('#timer');
const letters = document.querySelector('#letters');
const runCount = document.querySelector('#run-count');
const startButton = document.querySelector('#start-button');
const clearButton = document.querySelector('#clear-button');
const chatPanel = document.querySelector('#chat-panel');
const messages = document.querySelector('#messages');
const phraseButtons = document.querySelector('#phrase-buttons');
const gameContainer = document.querySelector('#game');
function setStatus(message) {
status.textContent = message;
}
function updateRunCount(count) {
runCount.textContent = `${count} / 3`;
startButton.textContent = count > 0 ? 'Start another run' : 'Start run';
}
const recorder = createRecordingManager(updateRunCount);
let ghostManager;
let runStartedAt = 0;
const game = createGame({
container: gameContainer,
onFrame: (frame) => {
recorder.capture(frame);
ghostManager?.update(frame.now);
if (recorder.isActive()) {
timer.textContent = `${((frame.now - runStartedAt) / 1000).toFixed(1)}s`;
}
},
onFinish: () => {
const saved = recorder.finish();
if (saved) {
ghostManager.setRuns(recorder.list());
setStatus('Run saved locally and downloaded as JSON. Finish CAT to open Level 2.');
}
},
onCollect: (word) => {
const slots = ['_', '_', '_'];
word.split('').forEach((letter, index) => {
slots[index] = letter;
});
letters.textContent = slots.join(' ');
if (word) setStatus(`Collected ${word}. Keep going!`);
},
onDoorUnlock: () => {
setStatus('CAT is complete. The Level 2 door is open!');
},
onLevelTwo: () => {
chat.show();
setStatus('Level 2 reached. Try one approved team phrase.');
},
onStatus: setStatus
});
ghostManager = createGhostManager(game.scene, recorder.list());
const chat = setupLocalChat({
panel: chatPanel,
messages,
buttons: phraseButtons,
onStatus: setStatus
});
startButton.addEventListener('click', () => {
chat.hide();
ghostManager.setRuns(recorder.list());
ghostManager.start();
recorder.start();
runStartedAt = performance.now();
timer.textContent = '0.0s';
game.start();
setStatus('Run started. Race the recorded bots and collect C, A, T.');
});
clearButton.addEventListener('click', () => {
recorder.clear();
ghostManager.setRuns([]);
setStatus('Local recordings cleared. Make three new runs.');
});
updateRunCount(recorder.count());
What does the entry module connect?
This module connects the game, recorder, ghost manager, HUD, and chat. Entering Level 2 shows the panel while starting a new run hides it.
Play-test the complete local loop
The successful build proves the files compile. A browser test proves the player can reach every visible result in one session.
- Return to the terminal you used for the spell-sprint project.
- Restart the development server if it stopped by running this command:
npm run dev
What does this command do?
The command starts the Vite development server. The terminal prints the local browser address when the game is ready.
- Return to http://localhost:5173 in Google Chrome.
- Confirm the HUD shows Saved runs: 3 / 3.
The page should load with the game and ghost legend visible. The chat panel should still be hidden.
Missing the three saved runs?
Use the in-game Clear recordings button if the stored runs behave unexpectedly. Complete three fresh runs until the counter returns to Saved runs: 3 / 3.
Help me restore three local Spell Sprint recordings without changing the recording key or JSON download behavior.
Before you start the play-test, do you expect the chat panel to appear before or after you cross into Level 2?
- Click Start another run.
- Move with WASD or the arrow keys.
- Jump with Space.
- Fall into one gap on purpose.
- Confirm your character returns to the most recent safe section.
- Confirm three replay shapes move through the course.
- Confirm the legend shows BOT 1: TALL, BOT 2: WIDE, and BOT 3: SMALL.
The chat panel remains hidden during the obstacle course. This confirms that Level 2 controls access to it.
- Collect C.
- Collect A.
- Collect T.
- Confirm the letters HUD shows C A T.
- Cross the opened door into Level 2.
- Confirm the panel displays Local scripted chat: nothing is sent online..
- Click Great jumping!.
- Confirm the message panel displays the matching Bot Coach reply.
You should see Bot Coach: That gap jump was awesome! in the message panel. No free-text field should appear.
Chat panel still hidden?
Make sure the HUD shows C A T before crossing the door. The panel appears only after your character reaches the Level 2 platform.
Compare the onLevelTwo callback in src/main.js with the full code above if the platform loads without the panel.
Help me debug why the Spell Sprint chat panel stays hidden after I reach Level 2.
Record the final demo
The final recording turns your working game into a shareable demonstration. A complete take proves that storage, replay, spelling, and local chat work together.
- Keep Chrome focused on Spell Sprint.
- Confirm the HUD still shows Saved runs: 3 / 3.
- Confirm the three BOT labels fit inside the recording area.
Before you start recording, which visible moments will prove that the complete game loop works?
macOS
- Press Shift+Command+5 to open the Screenshot toolbar.
- Choose Record Selected Portion.
- Frame Chrome inside the selected area.
- Click Record.
- Click Start another run.
- Collect CAT.
- Cross the opened door into Level 2.
- Click one approved phrase.
Your recording now contains the complete run. Stop it before leaving the game page.
- Click the menu bar Stop button.
You can also stop with Command+Control+Escape. The recording saves to your selected location with Desktop as the default.
Windows
- Focus Chrome on the Spell Sprint page.
- Press Windows+Alt+R to start Xbox Game Bar recording.
- Click Start another run.
- Collect CAT.
- Cross the opened door into Level 2.
- Click one approved phrase.
- Press Windows+Alt+R again to stop recording.
The recording saves as an MP4 under Videos in the Captures folder.
- Open the Captures folder inside Videos.
- Confirm the new MP4 recording is listed.
Your saved video should visibly include Saved runs: 3 / 3, all three labeled bots, CAT, the opened Level 2 door, and one approved local chat exchange.
You made the complete loop work. Your saved recording now proves that ghost playback, CAT, the Level 2 door, and approved local chat all work in one demo.
Secret mission
Replace Scripted Replies with Logged Claude Replies
Give Bot Coach fresh Claude replies through a local server while the API key stays outside the browser. Keep the four-phrase allowlist, filter every reply, and record successful exchanges in a parent-readable log.
Clean Up Your Resources
Clean Up Your Resources
Your local game files have no ongoing cost. Choose whether to keep them, pause the server, or delete the project.
Cost warning
A Claude Pro subscription renews at $20 monthly, excluding tax. A cancellation needs to be completed at least 24 hours before renewal.
The optional Claude API is metered separately. Its spend limit caps usage at the amount you chose.
Resources you used:
- The local production server at http://localhost:3000.
- The local spell-sprint folder, including parent-chat-log.jsonl.
- Browser replay data stored in localStorage under spell-sprint-recordings-v1.
- The downloaded spell-sprint-run-1.json, spell-sprint-run-2.json, and spell-sprint-run-3.json files.
- The saved final demonstration recording.
- Your Claude Pro subscription.
- The optional personal API key in Claude Console.
Keep everything running
No action is needed. Choose this if you want to continue playing Spell Sprint or developing its AI chat.
- Keep the production server running at http://localhost:3000.
- Keep the spell-sprint folder with its source files and parent-readable log.
- Keep the three JSON recordings as replay backups.
- Keep the final screen recording for your completed demo.
- Keep your Claude Console spend limit at the amount you chose.
- Leave Claude Pro active only if you plan to keep using Claude Code.
Each successful AI chat request can add metered API usage. The four approved phrase buttons remain the only request path in this game.
Pause - I'll come back to this later
Stop the local server to free its port. Your game files and saved recordings remain ready for another session.
- Switch back to the terminal that runs the local production server.
- Press Ctrl+C to stop the server.
- Close that terminal window to remove ANTHROPIC_API_KEY from the current session.
The local game cannot make another API request while its server is stopped. The personal key remains available in Claude Console.
Your local files remain untouched during subscription cancellation. Cancel Claude Pro if you do not need Claude Code for another month.
- Open Settings in Claude.
- Select Billing.
- Select Cancel at least 24 hours before renewal.
Your project remains on the computer after you stop the server or cancel the subscription.
Delete - I don't want to use this again
Deletion becomes permanent when you empty Trash or Recycle Bin. Until then, you can restore anything selected by mistake.
- Switch back to the running game in Google Chrome at http://localhost:3000.
- Click Clear recordings to remove spell-sprint-recordings-v1 from browser storage.
You should see Saved runs: 0 / 3. Your three browser-persisted replays are now cleared.
- Open the Claude Console API keys page.
- Select the personal key used for Spell Sprint.
- Use the page's option to disable or delete the personal key.
Good. The project key can no longer authorize a Claude request.
- Open Settings in Claude.
- Select Billing.
- Select Cancel if you do not want Claude Pro to renew.
You should see confirmation that the subscription cancellation is recorded.
- Switch back to the terminal that runs the local production server.
- Press Ctrl+C to stop the server.
- Close every terminal window connected to spell-sprint.
- Close Visual Studio Code if it still has the project folder open.
The server is now stopped. Closing the terminal also clears the session-only API key value.
macOS
- Press Cmd+Space to open the macOS search bar.
- Type Finder into the search field.
- Press Enter to open Finder.
- Navigate to your home folder in Finder.
- Move the spell-sprint folder to Trash.
- Select Downloads in the Finder sidebar.
- Move spell-sprint-run-1.json, spell-sprint-run-2.json, and spell-sprint-run-3.json to Trash.
Your source folder and replay exports are now queued for deletion.
- Move the saved final demonstration recording from its saved location to Trash.
- Empty Trash to remove the selected files permanently.
Windows
- Press the Windows key to open the Windows search bar.
- Type File Explorer into the search field.
- Press Enter to open File Explorer.
- Navigate to your user folder in File Explorer.
- Move the spell-sprint folder to Recycle Bin.
- Select Downloads in the File Explorer sidebar.
- Move spell-sprint-run-1.json, spell-sprint-run-2.json, and spell-sprint-run-3.json to Recycle Bin.
Your source folder and replay exports are now queued for deletion.
- Move the saved final demonstration recording from its saved location to Recycle Bin.
- Empty Recycle Bin to remove the selected files permanently.
- Search your home folder for spell-sprint.
- Search Downloads for spell-sprint-run-.
- Return to the location where you saved the final demonstration recording.
You should see no project folder, JSON run files, or final recording. The local server should also remain stopped.
Nice Work!
Nice Work!
You did it! You built a complete 3D Spell Sprint game through Claude Code. Your saved demo shows recorded runs becoming competitors before spelling opens the path to Level 2.
You've learned how to:
- Build a playable Three.js obstacle course whose movement, jumps, obstacles, gaps, checkpoints, and respawns form a complete game loop.
- Turn three saved JSON movement recordings into distinct ghost competitors with visible BOT labels and different shapes.
- Capture a complete demonstration video that shows the CAT challenge opening Level 2 before a parent-approved phrase triggers a local Bot Coach reply.
- Secret Mission: Upgrade Bot Coach with server-side Claude replies while keeping the API key out of browser code. Apply an approved-phrase allowlist. Filter risky output. Cap spending. Append every successful exchange to a parent-readable log.
Ready to quiz yourself?