npx skills add https://github.com/chongdashu/phaserjs-tinyswords --skill phaser-gamedev使用 CLI 安装这个技能,并在你的工作区中直接复用对应的 SKILL.md 工作流。
A vibe-coded 2D strategy game prototype showcasing rapid game development with AI agent skills
This is a prototype 2D tactical strategy game built through vibe coding - a rapid development workflow powered by specialized AI agent skills. The game was created by combining a well-structured PRD (from TinyPRD) with three specialized Claude Code skills, demonstrating how AI-assisted development can go from concept to playable prototype.
The Result: A turn-based strategy game prototype with warriors, archers, particle effects, dynamic UI, and test coverage - all in ~580KB of carefully curated assets.
Note: This is a prototype demonstrating the vibe coding workflow. It's not production-ready or highly polished - the focus is on showcasing rapid AI-assisted development rather than delivering a finished product.
Or run locally by opening public/index.html in a modern web browser. No build process or dependencies required!
Game Features:
This project demonstrates the complete vibe coding workflow:
Started with a clear, concise Product Requirements Document that defined:
📄 See the full PRD: docs/prd.md
Why TinyPRD? A well-structured PRD helps with vibe coding. TinyPRD helps you write clear, actionable requirements that AI agents can work with more effectively.
Translated the PRD into detailed technical specifications:
📄 See the full TDD: docs/tdd.md
assets.json)Created a comprehensive metadata file documenting the Tiny Swords asset pack structure:
📄 See the asset metadata: public/assets/tinyswords/assets.json
Why this matters: AI agents can reference this metadata to make informed decisions about asset loading, frame extraction, and spritesheet handling without manual trial-and-error. It serves as a "contract" between the asset pack and the code.
With the PRD, TDD, and asset metadata in place, the game was built using three specialized Claude Code skills that handle complex, domain-specific tasks:
Advanced 2D game development with the Phaser 3 framework:
Key Challenge Solved: Nine-slice panel rendering with the Tiny Swords asset pack. The sprites have heavy transparent padding, which creates visual artifacts when scaled naively. The solution involved custom texture stitching with calculated overlap to hide edges.
See implementation: test.html:282-315 (createStitchedTexture method)
Professional tilemap rendering optimized for the Tiny Swords asset pack:
Asset Optimization: The skill knew exactly which Tiny Swords assets to use and how to combine them, eliminating guesswork and trial-and-error.
Basic UI testing infrastructure:
test.html) for visual regression testingTest Coverage: UI components have side-by-side comparisons of raw vs. stitched textures for visual verification.
Traditional Development:
Vibe Coding with Skills:
Result: Faster prototyping by leveraging domain-specific knowledge from specialized skills.
vibe-tiny-swords/
├── docs/
│ ├── prd.md # Product requirements (from TinyPRD)
│ └── tdd.md # Technical design document
├── public/
│ ├── index.html # Main game (~149KB)
│ ├── test.html # UI test harness (~27KB)
│ └── assets/
│ └── tinyswords/ # Curated game assets (580KB)
│ ├── assets.json # Asset metadata and structure reference
│ ├── Buildings/ # Blue & Red castles
│ ├── Units/ # Warrior & Archer sprites
│ ├── Terrain/ # Tileset, trees, rocks, bushes
│ ├── Particle FX/# Dust and explosion effects
│ └── UI Elements/# Buttons, bars, panels, ribbons
└── README.md
This game uses the beautiful Tiny Swords asset pack by Pixel Frog. The assets have been carefully curated to include only what's used in the game, reducing the repository from ~15MB to just 580KB.
Included Assets:
Why Tiny Swords? Pixel Frog's asset packs are perfectly suited for vibe coding - they're comprehensive, well-organized, and visually cohesive. The TinySwords Tilemap skill has deep knowledge of these assets, enabling rapid implementation without asset hunting.
Clone the repository
git clone <repository-url>
cd vibe-tiny-swords
Play the game
open public/index.html
Explore the test harness
open public/test.html
# Press 1-6 to cycle through different UI tests
Study the workflow
docs/prd.md to see the original requirementsdocs/tdd.md to see the technical designindex.html and test.htmlUse TinyPRD to write clear, detailed requirements. A well-structured PRD helps guide the development process. Include:
Don't reinvent the wheel. Specialized skills like Phaser GameDev, TinySwords Tilemap, and Frontend Testing bring deep domain knowledge and best practices, saving you from common pitfalls.
The test harness (test.html) was built alongside the game, not as an afterthought. This caught rendering bugs early and provided confidence for rapid iteration.
The repository contains exactly what the game needs - no unused assets, no bloat. This makes the codebase easy to understand and fast to download.
Asset Metadata: The project includes an assets.json file that documents frame dimensions, color variants, and path templates for the Tiny Swords asset pack. This metadata file serves as a reference guide for understanding the asset structure and can be used by AI agents to make informed decisions about asset loading.
The test harness provides basic visual regression testing:
Visual Regression Tests:
Automated Test Hooks:
window.__TEST__ = {
ready: true,
sceneKey: 'UITestScene',
state: () => ({ currentTest, testLabels, currentLabel }),
commands: {
showTest: (n) => scene.showTest(n),
reset: () => scene.showTest(0)
}
};
This enables Playwright or other testing frameworks to:
By exploring this project, you'll find:
✅ Vibe Coding Workflow - From PRD to playable prototype
✅ Agent Skill Integration - How specialized skills work together
✅ Phaser 3 Patterns - Scene management, sprite animation, UI architecture
✅ Asset Management - Curating and organizing game assets
✅ Nine-Slice Rendering - Addressing UI scaling challenges
✅ Test Infrastructure - Building test harnesses alongside features
✅ Single-File Architecture - Keeping everything simple and portable
The Tiny Swords UI panels have ~45% transparent padding in each frame. Direct scaling creates thick "bars" at panel edges. The solution:
createStitchedTexture(sourceKey, targetKey, frameSize, overlap = 0) {
// Calculate overlap to hide transparent edges
const effectiveOverlap = overlap || Math.floor(frameSize * 0.45);
const cellSize = frameSize - effectiveOverlap;
// Stitch 9 frames with overlap into a seamless texture
// Each frame overlaps the previous one to hide padding
// ...
}
Result: Panels scale from 100px to 500px with reduced visual artifacts.
Health bars use horizontal three-slice scaling (left cap, stretchable center, right cap):
getBigBarBaseTexture(width) {
const spec = {
left: { x: 40, w: 24 }, // Left cap
center: { x: 128, w: 64 }, // Stretchable fill
right: { x: 256, w: 24 } // Right cap
};
// Generate texture at exact width with proper proportions
}
Result: Health bars scale while maintaining cap proportions.
Performance:
Want to vibe code your own game?
Built with ❤️ using Claude Code
This project demonstrates vibe coding: combining clear requirements (TinyPRD), game assets (Pixel Frog), and specialized AI skills for rapid prototyping.