What You'll Build

You're going to make a real, playable game that runs in your browser. No game engine, no framework, just you and Claude building something from nothing.

By the end of this guide, you'll have a Snake game with keyboard controls, score tracking, and a restart button. The whole thing lives in a single HTML file you can share with anyone.

Before You Start

Make sure you've completed the Claude Code Setup guide. You should be able to open your terminal and type claude to start a conversation.

Step 1: Create Your Project Folder

Open your terminal and create a new folder for your game:

mkdir ~/my-snake-game
cd ~/my-snake-game

This gives you a clean space to work in.

Step 2: Launch Claude

Start Claude Code inside your new folder:

claude

Claude will start up and wait for your instructions.

Step 3: Describe Your Game

Now tell Claude exactly what you want. Type this prompt (or something like it):

Build me a Snake game in a single index.html file. Use an HTML canvas element with a dark background. The snake should be green, the food should be red, and there should be a score counter at the top. Use arrow keys for controls. Add a "Game Over" screen with the final score and a "Play Again" button. Make it look polished with a clean font and centered layout.

Claude will write the entire game for you. It generates the HTML, CSS, and JavaScript all in one file.

Step 4: Open Your Game

Once Claude finishes writing the code, open the file in your browser.

On Mac:

open index.html

On Windows (WSL):

explorer.exe index.html

Your game should appear in the browser. Try it out. Use the arrow keys to move the snake around and eat the red food.

Step 5: Make It Your Own

The game works, but now comes the fun part. Ask Claude to change anything you want. Here are some ideas:

Make the snake move faster each time it eats food.
Add a high score that persists between games using localStorage.
Change the colors to a neon theme with a purple background and cyan snake.
Add walls around the edges instead of wrapping to the other side.

Each time you ask Claude for a change, it updates the file. Just refresh your browser to see the result.

Step 6: Try a Different Game

Snake is just the starting point. You can ask Claude to build any browser game. Some ideas to try next:

Use the same approach: describe what you want, let Claude build it, then refine it with follow-up prompts.

What You Learned

You just built a real game from scratch using only natural language prompts. You didn't need to know JavaScript or HTML canvas. You gave Claude a clear description, and it wrote the code.

That's the pattern: describe what you want, review what you get, refine until it's right.

Ready for the next challenge? Ship something to the internet.

Previous Lesson
Unlock icon
Skip Permissions Unlock Full Autonomy
Next Lesson
Website icon
Build a Website Ship to the Web