Claude Code Plugin
Install the sub.games Claude Code plugin to integrate the SDK into any game with a single command.
The sub.games Claude Code plugin gives you a /subgames skill that walks you through integrating the @subgames/sdk into any browser game. It handles SDK installation, tier-gating setup, pause/unpause wiring, and game registration — all interactively.
Installation
Install the plugin from the plugin directory:
claude --plugin-dir ./sdks/claude-pluginOr if you're working in a separate game project, point to the plugin in the monorepo:
claude --plugin-dir /path/to/subgames-monorepo/sdks/claude-pluginOnce installed, the /subgames skill is available in any Claude Code session.
Usage
Run the skill from within your game project:
/subgamesOr with an explicit path:
/subgames ./path/to/my-gameThe skill will:
- Detect your game — identifies the entry point, build system, and game framework (Phaser, Three.js, Pixi.js, vanilla Canvas)
- Ask about tier-gating — walks you through deciding which features go behind Free, Supporter, and Founder tiers
- Install the SDK — adds
@subgames/sdkvia npm or CDN script tag - Initialize the SDK — sets up
SubGamesSDK.init()with your game key and overlay - Add tier gates — inserts
requireTier()calls at the right points in your game code - Wire pause/unpause — connects the SDK's pause events to your game loop
- Add sparkle markers — adds tier indicator emojis to gated UI elements
- Register the game — helps you register on sub.games (optional)
What It Produces
After running /subgames, your game will have:
- Subscribe prompts that auto-trigger after 30 seconds for non-subscribers
- Feature gates at the points you specified, with automatic subscribe modals
- Pause/unpause handling so the game freezes when modals are open
- Sparkle emoji markers on gated UI elements (the sub.games convention)
- Social overlay with like, comment, share, and subscribe buttons
Supported Frameworks
The plugin detects and adapts to your game's framework:
| Framework | Pause Mechanism |
|---|---|
| Phaser | scene.pause() / scene.resume() |
| Three.js | Sets a paused flag in the animation loop |
| Pixi.js | app.ticker.stop() / app.ticker.start() |
| Vanilla Canvas | cancelAnimationFrame() / requestAnimationFrame() |
| Custom | Reuses existing pause menu logic if found |
Tier-Gating Convention
The skill uses the sparkle emoji convention from sub.games:
| Marker | Tier | Cost |
|---|---|---|
| (none) | Public | Free, no account |
| One sparkle | Free | Email signup |
| Two sparkles | Supporter | $3-8/month |
| Three sparkles | Founder | $150/year |
Plugin Structure
The plugin follows the Claude Code plugin specification:
sdks/claude-plugin/
.claude-plugin/
plugin.json # Plugin manifest
skills/
subgames/
SKILL.md # The /subgames skillExample
Here's what a typical integration session looks like:
> /subgames
# Claude detects a Phaser game, asks about tiers:
# "Let's set up your subscription tiers..."
# You say: "Free gets the first 3 levels, Supporter gets all levels
# and skins, Founder gets early access to everything"
# Claude then:
# 1. Runs: npm install @subgames/sdk
# 2. Adds SubGamesSDK.init() to your main scene
# 3. Adds requireTier('supporter') to level 4+ and skin equip
# 4. Adds requireTier('founder') to early access content
# 5. Wires scene.pause()/resume() to SDK pause events
# 6. Adds sparkle emojis to level select and shop UIManual Integration
If you prefer to integrate manually without the plugin, see:
- Browser SDK — full API reference
- Server SDK — server-side verification
- Events Reference — event system details