sub.games

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-plugin

Or 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-plugin

Once installed, the /subgames skill is available in any Claude Code session.

Usage

Run the skill from within your game project:

/subgames

Or with an explicit path:

/subgames ./path/to/my-game

The skill will:

  1. Detect your game — identifies the entry point, build system, and game framework (Phaser, Three.js, Pixi.js, vanilla Canvas)
  2. Ask about tier-gating — walks you through deciding which features go behind Free, Supporter, and Founder tiers
  3. Install the SDK — adds @subgames/sdk via npm or CDN script tag
  4. Initialize the SDK — sets up SubGamesSDK.init() with your game key and overlay
  5. Add tier gates — inserts requireTier() calls at the right points in your game code
  6. Wire pause/unpause — connects the SDK's pause events to your game loop
  7. Add sparkle markers — adds tier indicator emojis to gated UI elements
  8. 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:

FrameworkPause Mechanism
Phaserscene.pause() / scene.resume()
Three.jsSets a paused flag in the animation loop
Pixi.jsapp.ticker.stop() / app.ticker.start()
Vanilla CanvascancelAnimationFrame() / requestAnimationFrame()
CustomReuses existing pause menu logic if found

Tier-Gating Convention

The skill uses the sparkle emoji convention from sub.games:

MarkerTierCost
(none)PublicFree, no account
One sparkleFreeEmail signup
Two sparklesSupporter$3-8/month
Three sparklesFounder$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 skill

Example

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 UI

Manual Integration

If you prefer to integrate manually without the plugin, see:

On this page