Create Dojo models for storing game state with proper key definitions, trait derivations, and ECS patterns. Use when defining game entities, components, or state structures.
Generates Dojo ECS models with proper Cairo attributes, trait derivations, and key definitions. Use when creating game entities, components, or state structures that need to be stored in the world.
/plugin marketplace add dojoengine/book/plugin install book@dojoengineThis skill is limited to using the following tools:
Create Dojo models that define your game's state using Entity Component System (ECS) patterns.
Generates Cairo model structs with:
#[dojo::model] attributeInteractive mode:
"Add a model for player positions"
I'll ask about:
Direct mode:
"Create a Position model with player as key and x, y coordinates"
Small, focused models for specific aspects:
#[derive(Copy, Drop, Serde)]
#[dojo::model]
pub struct Position {
#[key]
pub entity_id: u32,
pub x: u32,
pub y: u32,
}
Models keyed by player address:
#[derive(Copy, Drop, Serde)]
#[dojo::model]
pub struct Inventory {
#[key]
pub player: ContractAddress,
pub gold: u32,
pub items: u8,
}
Multiple keys for relationships:
#[derive(Copy, Drop, Serde)]
#[dojo::model]
pub struct Tile {
#[key]
pub x: u32,
#[key]
pub y: u32,
pub terrain_type: u8,
}
Constant key for global state:
const GAME_CONFIG: u128 = 999999;
#[derive(Copy, Drop, Serde)]
#[dojo::model]
pub struct Config {
#[key]
pub config_id: u128,
pub max_players: u8,
}
#[key] Attribute:
Required Traits:
Drop - Cairo ownershipSerde - SerializationCopy - For copyable types (optional)Field Types:
u8, u32, u128 - Unsigned integersfelt252 - Field elementsbool - BooleansContractAddress - Addressesworld.write_model(@Position { entity_id: 1, x: 10, y: 20 });
let position: Position = world.read_model(entity_id);
let mut position: Position = world.read_model(entity_id);
position.x += 1;
world.write_model(@position);
After creating models:
dojo-system skill to create systems that use your modelsdojo-test skill to test model read/write operationsdojo-config skill to ensure models are registeredThis skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.