Skip to content

garethpaul/poe-games-procedural-dungeons / .claude/skills/synced-store

synced-store

Verified

Build apps that USE synced-store for real-time multiplayer state. PROACTIVELY load when: designing a new Poe tile's state/schema (even before any file exists), discussing how to hide, gate, or restrict visibility of data to specific users or to the server, writing schema.ts/mutators/*.ts/client-config.ts/backend-config.ts for a Poe tile, using createPoeTileTestHarness, calling store.subscribe/store.mutate, or wiring entry.tsx with setupStore.

references/schema-libraries.md

View on GitHub
<!-- owner: jyoung-q -->
# Schema Libraries

Synced-store uses any [Standard Schema](https://github.com/standard-schema/standard-schema)-compliant library (Zod, Valibot, ArkType) or plain JSON Schema. Schemas are used for **compile-time type inference only** — no runtime validation.

Zod is the default in most examples. When you need to avoid Zod's bundle size or prefer a different style, use one of these.

## Valibot

```typescript
import * as v from "valibot";
import { defineSchema, table } from "poe-tiles-sdk/v1/backend.js";
import { TILE_SCHEMA_VERSION } from "./tile-schema-version";

const schema = defineSchema({
  schemaVersion: TILE_SCHEMA_VERSION,
  tables: {
    todos: { schema: table(v.object({ text: v.string(), done: v.boolean() })) },
  },
  mutators: {
    setTodo: { description: "...", input: v.object({ id: v.string(), text: v.string() }) },
  },
});
```

## JSON Schema (no library needed)

Useful when you don't want to pull in a validation library, or when the schema is already expressed as JSON Schema elsewhere.

```typescript
import { jsonSchema } from "poe-tiles-sdk/v1/backend.js";
import { defineSchema, table } from "poe-tiles-sdk/v1/backend.js";
import { TILE_SCHEMA_VERSION } from "./tile-schema-version";

const schema = defineSchema({
  schemaVersion: TILE_SCHEMA_VERSION,
  tables: {
    todos: {
      schema: table(jsonSchema<{ text: string; done: boolean }>({
        type: "object",
        properties: {
          text: { type: "string" },
          done: { type: "boolean" },
        },
        required: ["text", "done"],
      })),
    },
  },
});
```

The TypeScript generic on `jsonSchema<T>()` is the source of truth for types. The JSON Schema object itself is carried through for tooling (e.g. MCP tool definitions).

## When to pick which

- **Zod** — the default; richest ecosystem and best error messages. Costs ~280KB gzipped on the client if bundled — use type-only imports in `client-config.ts` to avoid this.
- **Valibot** — tree-shakable, much smaller bundle; same mental model as Zod.
- **JSON Schema** — zero runtime dependency; use when you want the schema to be consumed by external tools (or when the schema is hand-written elsewhere).
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall