remix-save-game

Add save and load game state functionality via RemixSDK

8 stars

Best use case

remix-save-game is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Add save and load game state functionality via RemixSDK

Teams using remix-save-game should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/remix-save-game/SKILL.md --create-dirs "https://raw.githubusercontent.com/farworld-labs/remix-skills/main/skills/remix-save-game/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/remix-save-game/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How remix-save-game Compares

Feature / Agentremix-save-gameStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Add save and load game state functionality via RemixSDK

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Integrate Save Game State Workflow

## Overview

This skill guides you through integrating save game state into an HTML game on
the Remix platform. Save game state lets players persist progress across
sessions -- scores, unlocked levels, inventory, and more -- using the RemixSDK.

## Prerequisites

- The game must include the RemixSDK script tag:
  ```html
  <script src="https://cdn.jsdelivr.net/npm/@remix-gg/sdk@latest/dist/index.min.js"></script>
  ```
- The game must already be playable (follow the **game-creation** workflow first
  if starting from scratch).

## Steps

### 1. Initialize the SDK

Call `await window.RemixSDK.ready()` **before** the game loop starts. This
ensures the SDK is loaded and any existing saved state is available.

```js
await window.RemixSDK.ready();
```

### 2. Load Existing State

Read `window.RemixSDK.gameState` to get previously saved data. It returns
`Record<string, unknown> | null | undefined` -- always check for null before
using it.

```js
const savedState = window.RemixSDK.gameState;
```

Use the saved state to restore game progress, or fall back to defaults if the
player is starting fresh:

```js
const state = savedState ?? { score: 0, level: 1 };
```

### 3. Save State During Gameplay

Call `saveGameState` whenever the player reaches a meaningful checkpoint. The
`gameState` value must be a JSON-serializable object.

```js
window.RemixSDK.singlePlayer.actions.saveGameState({
  gameState: { score: player.score, level: player.level },
});
```

## Examples

### Simple Clicker Game

```html
<script>
  let clicks = 0;

  async function init() {
    await window.RemixSDK.ready();

    // Load
    const gameState = window.RemixSDK.gameState;
    if (gameState && typeof gameState.clicks === "number") {
      clicks = gameState.clicks;
    }

    document.getElementById("count").textContent = clicks;
    document.getElementById("btn").addEventListener("click", () => {
      clicks++;
      document.getElementById("count").textContent = clicks;

      // Save after every click
      window.RemixSDK.singlePlayer.actions.saveGameState({
        gameState: { clicks },
      });
    });
  }

  init();
</script>
```

### Platformer with Level Progression

```html
<script>
  let level = 1;
  let coins = 0;

  async function init() {
    await window.RemixSDK.ready();

    // Load
    const saved = window.RemixSDK.gameState;
    if (saved) {
      level = saved.level ?? 1;
      coins = saved.coins ?? 0;
    }

    startLevel(level);
  }

  function onLevelComplete() {
    level++;
    coins += 10;

    // Save at level transitions
    window.RemixSDK.singlePlayer.actions.saveGameState({
      gameState: { level, coins },
    });

    startLevel(level);
  }

  init();
</script>
```

## Tips

- **Keep state small.** Only save what's needed to restore the session -- avoid
  storing large arrays or transient UI state.
- **Save at meaningful moments** -- level completion, checkpoints, purchases --
  not every frame.
- **State must be JSON-serializable.** No functions, class instances, or
  circular references.
- **Always guard against null.** The first time a player loads the game there is
  no saved state.

Related Skills

remix-upload-game

8
from farworld-labs/remix-skills

Upload and validate HTML game code for Remix. Use when creating or updating a draft version through the CLI, MCP tools, or direct REST calls.

remix-upload-asset

8
from farworld-labs/remix-skills

Upload images, audio, or 3D models as hosted game assets

remix-submission-rules

8
from farworld-labs/remix-skills

Validation and publish constraints for Remix game submissions

remix-shop-items

8
from farworld-labs/remix-skills

Create, update, delete, and integrate Remix shop items. Use when a game needs Bits items, consumables, one-time unlocks, tier unlocks, store icons, or purchase handling in @remix-gg/sdk code.

remix-rest-snippets

8
from farworld-labs/remix-skills

REST client snippets for Remix agent publishing

remix-open-game

8
from farworld-labs/remix-skills

Open a game in the Remix Studio browser for preview and editing

remix-multiplayer

8
from farworld-labs/remix-skills

Enable multiplayer support for a Remix game

remix-game-sdk

8
from farworld-labs/remix-skills

Reference for the current @remix-gg/sdk runtime. Use when generating or repairing Remix game code, shop item integrations, save-state flows, multiplayer hooks, or host-safe mobile UI behavior.

remix-game-creation

8
from farworld-labs/remix-skills

Create a new game draft via the Remix API

remix-game-best-practices

8
from farworld-labs/remix-skills

Mobile-first game creation best practices for Remix

remix-cli

8
from farworld-labs/remix-skills

Use the official Remix CLI for authentication, config inspection, game creation, uploads, and analytics. Trigger this skill when a task involves `remix login`, `remix whoami`, `.remix-cli.json`, `REMIX_API_KEY`, or terminal-based game management on Remix.

remix-api-reference

8
from farworld-labs/remix-skills

OpenAPI-first endpoint reference for Remix game publishing REST routes