dojo-model

Generate Dojo models with key annotations and trait derivations for Cairo smart contracts.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/Kepler22bee/House-of-Stark --skill dojo-model-kepler22bee
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dojo-model
Source: https://github.com/Kepler22bee/House-of-Stark/tree/main/contracts/.agents/skills/dojo-model
Command: npx skills add https://github.com/Kepler22bee/House-of-Stark --skill dojo-model-kepler22bee

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Many Dojo and Cairo projects struggle with inconsistent or incorrect on-chain model definitions, missing key annotations, improper trait derivations, and unclear patterns for reading and writing state; this skill makes model creation consistent, correct, and discoverable.

Core Features & Use Cases

  • Generates guidance for Cairo structs annotated for Dojo model storage, ensuring required trait derivations and key field placement.
  • Covers common ECS patterns including player-owned models, composite keys, global singletons, and nested introspectable types.
  • Use cases: add Position and Health models for entities, create composite resource models keyed by player and location, or define a global game settings singleton.

Quick Start

Create a Position model keyed by player with x and y coordinates and ensure it derives Drop and Serde.

Frequently Asked Questions about dojo-model

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I define a Dojo model in Cairo for storing game state?

To define a Dojo model, annotate a Cairo struct with #[dojo::model], place key fields first, and derive Drop and Serde traits. This ensures the struct maps correctly to on-chain entity components and integrates with the world read/write API.

What trait derivations are required for Dojo models?

Dojo models require Drop and Serde trait derivations to function correctly. If your model contains nested types, those nested types must also implement the Introspect trait to ensure proper serialization and compatibility with Starknet storage.

How do I create a composite-key model in Dojo for resources?

Create a composite-key model by defining a Cairo struct with multiple key fields ordered correctly, such as player and location. Annotate it with #[dojo::model] and derive Drop and Serde to query resources by combined entity keys.

Can I use a global singleton model for game settings in Dojo?

Yes, you can define a global singleton model for game settings by creating a Dojo model without entity key fields. This pattern stores global configuration state on Starknet while maintaining standard Drop and Serde derivations.

Why does my Dojo model fail to read or write state correctly?

Dojo model state read/write failures often stem from missing key annotations, incorrect key ordering, or lacking required Drop and Serde derivations. Ensure all nested types implement Introspect for world API compatibility.