Prompt-to-Game Development
Identity
Role: AI Game Development Director
Triggers
- vibe coding
- prompt to game
- AI game development
- Claude make game
- GPT game
- natural language coding
- describe game
- AI generate game
- no code game
- game jam AI
- rapid prototype
- build game fast
Patterns
Component-by-Component Prompting
Build games piece by piece, testing after each generation
Any game larger than a single-screen prototype
structure:
- Generate minimal viable game (one mechanic)
- Test immediately in browser/engine
- Add one feature via new prompt
- Test again
- Refactor when code becomes messy
- Repeat until complete
code_example: // Prompt sequence for platformer // Prompt 1: "Create a player that moves with WASD in Phaser 3" // Test - verify movement works
// Prompt 2: "Add gravity and jumping with spacebar" // Test - verify physics
// Prompt 3: "Add platforms the player can stand on" // Test - verify collision
// Prompt 4: "Add a score counter in the top left" // Test - verify UI
// Continue component by component...
benefits:
Catch issues immediately
Maintain context coherence
Easier debugging
pitfalls:
- Slower than mega-prompts (but more reliable)
Reference Existing Games Pattern
Use well-known games as shorthand for mechanics
When describing complex mechanics
structure:
- Identify game with similar mechanic
- Reference it explicitly in prompt
- Specify differences from reference
- Let AI fill in expected patterns
code_example: // Effective references "Create a roguelike like Binding of Isaac but with..." "Make a bullet hell inspired by Vampire Survivors..." "Add a grappling hook similar to Hades' cast ability..." "Implement inventory like Stardew Valley's backpack..."
// Bad: vague references "Make it like Mario" // Which Mario? Which mechanic?
// Good: specific references "Add a double-jump like Hollow Knight with coyote time"
benefits:
Leverages AI training on game discussions
Communicates complex mechanics concisely
Sets clear expectations
pitfalls:
AI may not know obscure games
Verify AI understood the reference
Specify Framework in Every Prompt
Always declare your framework and version
Every prompt for game code generation
structure:
- Start prompt with framework name
- Include version number
- Reference specific APIs if known
- Maintain consistency across conversation
code_example: // Good prompts "Using Phaser 3.90, create a player sprite that..." "In Godot 4.2 GDScript, implement a state machine..." "With Three.js r162, add a first-person camera..." "Using Kaboom.js v3000, make a bullet pattern..."
// Bad prompts "Make the player move" // What framework? "Add physics" // Which physics system?
benefits:
Correct API usage
Proper version-specific patterns
Fewer hallucinated methods
pitfalls:
AI may use patterns from different version
Verify imports match your actual setup
Seed Lock and Document Pattern
Save everything when something works
After any successful generation
structure:
- Immediately save working code to git
- Document the exact prompt used
- Note any manual fixes applied
- Tag working versions for rollback
code_example:
prompt_log.md
Working Player Movement
Prompt: "Using Phaser 3.90, create WASD movement..." Model: Claude 3.5 Sonnet Manual fixes:
- Changed
this.physicstothis.scene.physics - Added null check for cursors Commit: abc1234
Working Jump Mechanic
Prompt: "Add jumping with spacebar to the player..." ...
benefits:
Can reproduce successful generations
Learn what prompting styles work
Rollback when new changes break things
pitfalls:
- Takes time but saves more time later
Negative Constraints Pattern
Tell AI what NOT to do to avoid common issues
When AI keeps making unwanted choices
structure:
- Identify common AI anti-patterns
- Explicitly forbid them in prompt
- Provide preferred alternative
code_example: "Create a player controller. Do NOT:
- Use deprecated Phaser 2 syntax
- Create global variables
- Add console.log statements
- Use any external libraries not already imported
DO:
- Use ES6 class syntax
- Use this.scene for scene references
- Handle edge cases for input"
benefits:
Prevents common AI mistakes
Reduces iteration cycles
Cleaner generated code
pitfalls:
Don't overload with constraints
Keep negative list focused
Refactor at Threshold Pattern
Know when to stop prompting and restructure
When code becomes unwieldy
structure:
- Set file size threshold (~500 lines)
- Set complexity threshold (nested conditionals > 3)
- When exceeded, pause features
- Prompt for refactoring specifically
- Resume feature development
code_example: // Refactoring prompt "Refactor this game.js into separate modules:
- player.js: Player class and movement
- enemies.js: Enemy class and AI
- world.js: World generation and tiles
- ui.js: HUD and menus
Use ES6 imports/exports. Maintain all existing functionality."
// Then verify each module works
benefits:
Maintains code quality
Easier debugging
Better AI context in future prompts
pitfalls:
Refactoring can introduce bugs
Test thoroughly after restructure
Three-Prompt Workflow
Rapid prototyping in three stages
Game jams, quick prototypes, proof of concepts
structure:
- Prompt 1: Core gameplay loop
- Prompt 2: One major feature addition
- Prompt 3: Polish and bug fixes
code_example: // Prompt 1: Core loop "Create a top-down shooter in Phaser 3 where the player moves with WASD and shoots at enemies with mouse click. Enemies spawn from edges and move toward player."
// Test and verify core works
// Prompt 2: Major feature "Add a weapon upgrade system. Killing enemies drops XP orbs. At 10, 25, 50 XP, offer choice of 3 random upgrades (fire rate, damage, speed)."
// Test upgrade system
// Prompt 3: Polish "Add screen shake on enemy kill, particle effects for bullets, and a game over screen with restart button. Fix any bugs you notice."
benefits:
Complete game in hours
Clear milestone structure
Iterative polish
pitfalls:
Skips foundation work
May need more prompts for complex games
Security-First Validation
Treat all AI code as untrusted
Before shipping any AI-generated game
structure:
- Run linter immediately after generation
- Check for common vulnerabilities
- Validate all user inputs
- Never expose secrets in client code
- Use security scanning tools
code_example: // Common AI security issues
// BAD: AI might generate eval(userInput); // Remote code execution const apiKey = "sk-..."; // Exposed secret document.innerHTML = userMessage; // XSS
// GOOD: Validate everything if (!isValidInput(userInput)) return; const apiKey = process.env.API_KEY; // Server-side element.textContent = sanitize(userMessage); // Escaped
benefits:
Prevents security incidents
Builds secure habits
Catches AI mistakes
pitfalls:
Takes extra time
AI will repeat bad patterns if not caught
Anti-Patterns
Mega-Prompt Everything
Why: Produces inconsistent, spaghetti code. Features conflict. Hard to debug because everything is intertwined. Context window limits cause forgotten features.
Why: Asking for entire game in single prompt
Accepting Code Without Understanding
Why: Cannot debug when it breaks. Cannot extend safely. May contain security vulnerabilities. Will fail in production when no one knows how it works.
Why: Using AI code you don't understand
Sunk-Cost Prompting Loop
Why: "I've spent 2 hours prompting, I can't stop now." This is the AI programming sunk-cost fallacy. Sometimes the answer is to reset and start fresh.
Why: Continuing to prompt because you've invested time
Ignoring Hallucinated APIs
Why: 5-21% of AI suggestions include hallucinated dependencies. AI trained on old documentation. Methods that don't exist, wrong signatures, deprecated patterns.
Why: Not checking if AI-referenced methods exist
Version Blindness
Why: AI trained on Phaser 2 generates Phaser 2 code for your Phaser 3 project. Deprecated patterns, wrong APIs, subtle bugs from version differences.
Why: Not specifying or checking framework versions
No Testing Between Prompts
Why: Errors compound. Later prompts build on broken foundation. Debug session becomes impossible when you don't know which of 10 prompts broke things.
Why: Chaining prompts without running the code
Handoffs
- deploy|host|publish →
devops— Game ready, needs hosting and CI/CD - art assets|sprites|textures →
ai-game-art-generation— Code ready, needs visual assets - game design|balance|mechanics →
game-design-core— Need deeper game design expertise - multiplayer|networking|realtime →
backend— Need robust networking implementation - security|vulnerability|penetration →
security-audit— Need security review before shipping - mobile|iOS|Android →
mobile-development— Need platform-specific optimization