18 November 2026
عالم ثلاثي الأبعاد كامل في ملف HTML واحد مع Claude Code: اكتب الوصفة مش النتيجةA Whole 3D World in One HTML File with Claude Code: Write the Recipe, Not the Result
Learn why a full underwater scene fits in a file of about 97 KB, then write a prompt with the same idea for your own scene in Claude Code and grow it step by step.
Who this guide is for
Claude Code users who want to try 3D in the browser without a game engine
Key terms
- WebGPU
- A modern way for a web page to use the graphics card directly. Today it works best in Chrome and Edge on a computer.
- Procedural generation
- Instead of storing ready images and models, you write the rules that draw them. The computer builds the shapes every time the page opens.
- Recipe versus result
- An image file stores the result pixel by pixel, so it grows. Code stores only the method, so it stays small even when the scene is big.
- A single HTML file
- All the code lives in one file you open in a browser. You can send it to anyone or open it offline.
The steps
Step 1
Understand why the file is small
Abyssal Garden, shared by its creator Noniv, has a seabed, kelp, a sunken ship and manta rays, all in one HTML file of about 97 KB.
The file holds no image and no model. It holds rules that tell the browser how to build the seabed, the plants and the shapes at startup. Even the sound is generated in code.
That is what you will ask Claude Code for: the method, not the result.
Tip: Every ready image or asset adds weight. Rules do not grow at the same speed.
Step 2
Prepare the browser
Open the scene on a computer in an up to date Chrome or Edge. WebGPU does not run on every phone, and some browsers still lack full support.
If a WebGPU page shows a black screen, try another browser before you blame the code.
Step 3
Write the rules prompt
The strong prompt here is the one that spells out what is not allowed. The rules force the model to write a recipe instead of reaching for ready files.
Copy the prompt, change the scene and the controls in brackets, and paste it into Claude Code in an empty folder.
Build me a complete 3D scene in a single HTML file. The idea: [describe the scene, for example: a seabed with kelp, rocks, a sunken ship and fish] Rules: 1. One file only, all code inside it, no other files. 2. No game engine and no external libraries. 3. Render with WebGPU only. 4. No images and no model files: every shape and colour is generated in code at startup. 5. Any sound is generated in code with Web Audio. 6. Keyboard and mouse controls: [for example WASD to move and the mouse to look]. 7. If the browser has no WebGPU, show a clear message instead of a black screen. Start with a simple version that works, and tell me the file size at the end.PromptScene prompt with rulesTip: Keep the technology names exactly as written.
Step 4
Open the first version and test it
When Claude Code finishes, open the HTML file in the browser. Move around and note what works and what is missing.
Do not ask for everything at once. The first version only has to run. Details come later.
Step 5
Grow it with short prompts
Even the original project got its first version from a single prompt, then added a start menu, rock collision and quality levels through follow up prompts.
Ask for one thing at a time and test after each change.
Add [a start menu with a Start button] without adding any external file and without breaking the original rules. Tell me the file size after the change.PromptOne changeStep 6
Make it run on weaker machines
Heavy scenes can slow down on an ordinary laptop. Ask for quality levels the viewer can choose from.
Add three quality levels: low, medium and high. Low reduces the number of [plants and fish] and the render resolution. Make medium the default and show the choice in the start menu.PromptQuality levelsStep 7
Share the file
Because everything lives in one file, you can send it as it is or upload it to any static page host.
Before you share it, open it on another device and another browser and check that the no support message shows instead of a black screen.
Ready prompts to copy
The takeaway
A tiny file is not magic: when you ask for the method instead of ready files, the browser builds the scene itself.
Liked this guide?
Join Mohammad's community
72 guides like this one, and a new one every week. One subscription opens them all.
Approximate price in your currency. You pay in AED
- A permanent archive. Open any guide, any time
- 20% off private build sessions
- Cancel any time, no commitment
Or without a subscription
Most value
Start building with me now
We sit together, break down your problem, and I build the AI solution with you step by step
- A private session with you
- Real building during the session
- Results you take with you when we finish
100% free
A free consultation about your problem