How to Build a Game with Claude
How to build a game with Claude, using free Artifacts for a quick prototype and Claude Code for a real project, with prompts, setup steps and honest limits.
Claude is the AI behind some of the most talked-about browser games built this year, from a city builder to a port of Quake. There are two ways to build a game with it. In the Claude chat app, you can make a small game as an "artifact" and play it straight away, for free. With Claude Code, a paid coding agent, Claude works on a real project folder and can build something much larger.
This guide covers both routes, with the setup steps, prompts that work and the limits to expect. Plans, commands and features were checked against Anthropic's documentation on November 14, 2026.
What people have built with Claude
A few public examples show the range. In each case the claim comes from the creator's own project page.
- Capriccio, a city builder by Ethan Mollick. Its notes say "Built with Claude Code," using Three.js with "no art assets — every stone, citizen, and sound is procedural."
- three-quake, a browser port of Quake's shareware episode by the creator of Three.js, credited "with @claude."
- Barrowfall, a 3D arena survival game "designed and built with Claude Code as the primary development tool."
Anthropic's own developer conference also featured talks about building games this way, including one on reviving a 1999 online role-playing game.
One independent test backs up the pattern. AA-3D from Artificial Analysis asks AI models to build interactive 3D web pages with Three.js and ranks the results by blind votes. When we checked, the top three places were all held by Claude models. Some newer rival models had not been rated yet, so read it as a snapshot.
Which route should you take?
| Artifacts in the Claude app | Claude Code | |
|---|---|---|
| Cost | Included on the free plan | Needs a paid plan, from $20 a month |
| Setup | None | Install a program, or use it in the browser |
| Where the game lives | Inside Claude, shareable with others | In a folder of files you own |
| Best for | One-screen games, quick experiments | Games with many files, art and sound |
| Testing | You play it in the chat | Claude can run it and check its own work |
| Limits | One self-contained page | Usage limits on your plan |
Start with an artifact to test the idea. Move to Claude Code when the game outgrows one page.
Route 1: Build a game as an artifact
An artifact is a small interactive app that Claude creates and displays next to the conversation. Anthropic's help page says "Claude can make an artifact out of almost anything," including "single-page websites" and "small interactive tools," and they are available on every plan including Free.
Check one setting first
The same page notes that artifacts require a capability to be switched on: "Cloud code execution and file creation," under Settings and then Capabilities. If Claude replies with plain code and no playable panel, look there.
Ask for the game
Build a small game as an interactive artifact.
The game: a one-screen arcade game where the player is a firefly dodging raindrops.
Controls: move with the mouse or by dragging a finger.
Rules:
- Raindrops fall from the top at random positions.
- Touching a raindrop ends the run.
- The score is the number of seconds survived, shown at the top.
- Every ten seconds the rain gets a little heavier.
- After a loss, show the score and a "Play again" button.
Looks: dark night-sky background, a small glowing yellow dot for the firefly, pale blue streaks for rain. Simple shapes only.
Keep it to one self-contained page. Do not add menus, sound or levels yet.Claude writes the game and opens it in a panel where you can play it at once.
Improve it in small steps
Play it, then ask for one change at a time. Be specific about what you saw.
Three changes, one at a time. Update the artifact after each and wait for me to test:
1. The firefly is too easy to lose against the background. Give it a soft glow that pulses.
2. Add a rare golden raindrop that is safe to touch and adds 5 to the score.
3. Keep the best score and show it under the current score.Share it
Artifacts can be shared. Anthropic describes them as a way "to instantly create shareable apps, tools, and games." Two things to know before you send yours around:
- Shared storage, the kind that makes "a game leaderboard" where "everyone sees the same scores," is available on Pro and above.
- You can export an artifact as an HTML file to host elsewhere. Anthropic's tutorial warns that in the exported copy "the parts that save entries, use Claude, or use connected tools stop working." A plain game with no saved data exports cleanly.
Where artifacts run out
An artifact is one page. Once you want separate image files, sound, several levels or a growing codebase, you need a project folder. That is what Claude Code is for.
Route 2: Build a game with Claude Code
Claude Code is, in Anthropic's words, "an agentic coding tool that reads your codebase, edits files, runs commands, and integrates with your development tools." It is available "in your terminal, IDE, desktop app, and browser." You do not have to use a terminal, though this tutorial does, because the steps are the same for everyone.
What it costs
Claude Code is included in all paid plans and not in the free one.
| Plan | Price | Notes |
|---|---|---|
| Pro | $20 a month, or $17 a month billed annually | Enough to build a small game |
| Max | $100 a month | Five times the Pro usage |
| Ultra | $200 a month | No five-hour limit |
Usage is metered. Anthropic's pricing page explains that most accounts have a limit that resets on a rolling five-hour window, with weekly limits on top for paid plans. On Pro you may hit the limit during a long session and need to wait.
Step 1: Install it
On macOS or Linux, open the Terminal app and run:
curl -fsSL https://claude.ai/install.sh | bashOn Windows, open PowerShell and run:
irm https://claude.ai/install.ps1 | iexThen make a folder for your game, go into it and start Claude:
mkdir my-game
cd my-game
claudeSign in with your Claude account when asked.
Step 2: Have Claude interview you
Do not start by asking for a game. Start by agreeing what the game is. Anthropic's best practices guide recommends brainstorming first and suggests this kind of request: "Interview me until you could write the spec, then write it to SPEC.md."
I want to build a small 3D browser game with Three.js and Vite. Before writing any code, interview me until you could write the spec. Ask about the core loop, controls, win and lose conditions, the look, and what is out of scope for version one. Ask one question at a time.
When you have enough, write the spec to SPEC.md, including a "Done when" checklist that can be tested by playing. Then stop.Answer the questions. Read the spec Claude writes and correct anything that is off. If you already have a design, our game design document template includes a spec layout you can paste in.
Once the spec is right, the guide advises starting a fresh session to build from it, "so the build begins with a clean context and a written definition of done."
Step 3: Add a short rules file
Claude Code reads a file of standing instructions at the start of each session. It is called CLAUDE.md, and Claude can also read the shared AGENTS.md format. Anthropic's memory guide covers how these files work, and the best practices guide is blunt about length: "Keep CLAUDE.md short." It suggests staying under 200 lines.
A starting point for a game:
# Project rules
- This is a browser game built with Three.js and Vite. Read SPEC.md before making changes.
- Run the game with: npm run dev
- Keep all tunable numbers (speed, gravity, spawn rates) in src/config.js.
- Use placeholder shapes until I say the gameplay is right. Do not add art or sound unless asked.
- Make one change at a time. After each change, run the build and confirm there are no errors.
- Do not add features that are not in SPEC.md. Ask first.
- When you finish a task, tell me exactly what to try in the game to check it.The command that runs the game sits near the top for a reason. Anthropic's guide calls it "the single most useful line" in the file.
Step 4: Build the core loop
Start a new session and ask for the smallest playable version.
Read SPEC.md and CLAUDE.md. Set up the project, then build only the core loop with placeholder shapes.
Work in small steps. After each step, run the build to check for errors. When the core loop is playable, stop and tell me how to start it and what to try.Claude will create the files, install what it needs and tell you how to run the game. Claude Code has several permission modes, from asking before each change to working more freely, so choose the one you are comfortable with. Open the address it gives you in your web browser and play.
Our Three.js game tutorial explains what the generated code is doing, which helps a lot when you want to steer it.
Step 5: Iterate, and let Claude check its own work
The best practices guide is frank about a common failure: "Claude said it was done and it wasn't quite, usually because it had no way to check its own work." The fix is to "give Claude something it can run that comes back pass or fail."
For a game, that can mean:
- A build command that fails on errors.
- A few automated tests for the rules: scoring, collisions, win and lose conditions.
- Looking at the running game. Claude Code can connect to the Claude in Chrome extension to "test web apps, debug with console logs." This needs a paid Claude plan and does not work when you sign in with an API key.
Then continue in small steps, playing between each:
The core loop feels good. Next, in this order, one at a time:
1. Add a start screen and a game-over screen with restart.
2. Add three enemy types described in SPEC.md, each with different movement.
3. Add a difficulty curve: spawn rate rises every 30 seconds.
4. Write tests for scoring and for the win and lose conditions, and run them.
After each one, run the build and tests, then tell me what to try.Step 6: Undo mistakes
Things will go wrong. Claude Code keeps checkpoints: "Before Claude edits a file, it snapshots" it, and you can "press Esc twice to rewind" (how Claude Code works). The best practices guide adds a useful habit: "Watch the first minute, press Esc the moment Claude drifts."
It is also worth asking Claude to set up Git, a tool that saves versions of your project, and to save a version each time the game is in a good state.
What Claude is good at, and what it is not
Strong:
- Game logic and systems. Rules, scoring, enemy behaviour, saving progress.
- 3D scenes written in code. Three.js worlds, procedural shapes and effects.
- Working through a plan. Given a spec, it keeps going step by step.
- Explaining. Ask how any part works and it will tell you in plain language.
Weak, or not offered:
- Images. Anthropic's help page says Claude "doesn't generate photos or illustrations the way image-generation tools do." For sprites and concept art you need another tool. This is why several Claude-built games use shapes generated by code.
- Music and sound. There is no music or sound-effect generation. Claude can write code that synthesises simple sounds.
- Game feel. It will set a jump height, but it cannot tell you the jump feels floaty. You have to play and say so.
- Multiplayer. It can write the code, but online play adds servers and many edge cases. Leave it for a later project.
For how Claude compares with the alternatives, see Gemini vs Claude vs ChatGPT for game building.
Claude Code or Cursor?
Claude Code is one of several coding agents. Cursor is the best-known alternative, and it can also use Claude models. The short version: Claude Code is made by Anthropic and uses only Claude models, while Cursor is an editor that lets you switch between models from different companies.
Our comparison, Cursor vs Claude Code for game building, covers price, features and which suits a first game. For a wider view of the tools, including browser-based ones with nothing to install, see the best vibe coding tools.
Common problems
Claude adds things you did not ask for. Put "do not add features that are not in the spec" in your rules file, and say it again in the prompt.
The game breaks after a change. Rewind to the last checkpoint and ask for the change again in smaller pieces.
You hit the usage limit. Keep prompts focused, start new sessions for new tasks, and save heavy work for when your limit has reset.
It says it is finished and it is not. Give it a check it can run, and always play the game yourself.
The project is getting messy. Ask Claude to explain the file layout and suggest a tidy-up, then approve the plan before it changes anything.
Next: make it a project
A playable build is the hard part. The next step is letting people find it. Give the game a public page with the pitch, some art and a link to play, and start gathering people who want to follow it.
For the full process, including story, characters and branding, read our guide on how to build a game with AI.