mcpField
R
remix-shop-items

remix-shop-items

github.com/farworld-labsDevelopment61 installs
Repository

About remix-shop-items

remix-shop-items is a workflow skill for developers managing in-game shop items on the Remix platform. It covers item lifecycle operations and integration with RemixSDK, including purchase-state handling.

Key features

  1. 01Finds and reuses the game ID
  2. 02Lists items before changes
  3. 03Creates, updates, and deletes items
  4. 04Guides RemixSDK shop integration
  5. 05Handles purchase callbacks and inventory

Use cases

  1. 01Adding consumable purchases to a game
  2. 02Updating item prices or names
  3. 03Checking item status before creating items

MCP support

The skill recommends using the official CLI or MCP toolchain where possible. Through MCP, `createShopItem` can generate an icon when an eligible item's `iconUrl` is omitted.

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/farworld-labs/remix-skills --skill remix-shop-items

After installing, type/remix-shop-itemsin Claude Code to confirm it loaded.

Details

From the project README

Manage Shop Items Workflow

Overview

This skill guides you through creating, managing, and integrating shop items for games on the Remix platform.

Prerequisites

  • A game must already exist.
  • Reuse gameId from task context first, then .remix-cli.json, then legacy .remix-mcp.json when available.
  • Use the official CLI or MCP toolchain when possible instead of handwritten HTTP.

Steps

1. Check for Existing Game ID

Read task context or prior tool results first. Otherwise, read .remix-cli.json or legacy .remix-mcp.json in the current directory. If either exists and contains a gameId, use that value.

Only if neither file exists or neither has a gameId should you follow the upload-game workflow to create one.

2. Manage Shop Items
List All Items

Always list current items first so you reuse the right itemId, avoid duplicate slugs, and see whether an item is already PENDING, ACTIVE, or INACTIVE.

Create an Item
POST https://api.remix.gg/v1/games/{gameId}/items
Authorization: Bearer $REMIX_API_KEY
Content-Type: application/json

{
  "name": "Extra Life",
  "slug": "extra-life",
  "itemType": "CONSUMABLE",
  "bitsCost": 50,
  "description": "Spend one to restore a life after game over.",
  "iconUrl": "https://asset-url.png"
}
  • itemType is one of CONSUMABLE, ONE_TIME, or TIER_UNLOCK
  • bitsCost is required for CONSUMABLE and ONE_TIME
  • tier is required for TIER_UNLOCK
  • new items start as PENDING
  • when using MCP, createShopItem can auto-generate an icon if iconUrl is omitted for CONSUMABLE or ONE_TIME
Update an Item
POST https://api.remix.gg/v1/games/{gameId}/items/{itemId}
Authorization: Bearer $REMIX_API_KEY
Content-Type: application/json

{ "bitsCost": 75, "name": "Extra Life Pack" }

Accepts a partial body -- only include fields you want to change.

Delete an Item
DELETE https://api.remix.gg/v1/games/{gameId}/items/{itemId}
Authorization: Bearer $REMIX_API_KEY
3. Integrate Shop Items in Game Code

Add the RemixSDK shop integration to your game:

const sdk = window.RemixSDK
await sdk.ready()

function getConsumableBalance(slug, spentKey) {
  const purchased = sdk.getItemPurchaseCount(slug)
  const spent = Number(sdk.gameState?.[spentKey] || 0)
  return Math.max(0, purchased - spent)
}

async function buyExtraLife() {
  const result = await sdk.purchase({ item: 'extra-life' })
  if (!result.success) showPurchaseError()
}

sdk.onPurchaseComplete(({ success, item }) => {
  if (!success || item !== 'extra-life') return

  const currentState = sdk.gameState || {}
  const spent = Number(currentState.extraLivesSpent || 0)
  sdk.singlePlayer.actions.saveGameState({
    gameState: {
      ...currentState,
      extraLivesSpent: Math.max(0, spent - 1),
    },
  })
})

Wrong Patterns

Do NOT do any of the following:

  • Granting items without listening to onPurchaseComplete. Always wait for the callback before giving the player anything. The purchase may fail or be cancelled.

  • Using singlePlayer.actions.purchase(...) in new code. Call sdk.purchase({ item: 'slug' }).

  • Using localStorage to track purchases. The platform handles purchase state. Use hasItem(), getItemPurchaseCount(), inventory, and shopItems.

  • Hardcoding prices or item metadata in game state. Read item metadata from the platform and only persist usage counters in gameState.

Tips

  • Use CONSUMABLE for repeatable purchases, ONE_TIME for permanent unlocks, and TIER_UNLOCK for progression-style items.
  • Run sdk.onPurchaseComplete(...) even if you also await sdk.purchase(...).
  • Use sdk.getShopItem(slug) or sdk.shopItems when the game needs current price or icon metadata.

Comments

Markdown supported