dojo-model

Generate Dojo models in Cairo for Starknet game state with ECS patterns.

Updated Mar 7, 2026
One-click install
npx skills add https://github.com/Await-0x/stark-tycoon --skill dojo-model-await-0x
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dojo-model
Source: https://github.com/Await-0x/stark-tycoon/tree/main/.agents/skills/dojo-model
Command: npx skills add https://github.com/Await-0x/stark-tycoon --skill dojo-model-await-0x

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the creation of robust and efficient data structures for Starknet games using the Dojo engine, ensuring proper Entity-Component-System (ECS) patterns are followed.

Core Features & Use Cases

  • Model Generation: Creates Cairo structs annotated with #[dojo::model] for game state.
  • Key Definition: Automatically handles #[key] field configuration for unique entity identification.
  • Trait Derivations: Includes necessary traits like Drop and Serde for on-chain compatibility.
  • Use Case: When developing a new feature for your Starknet game, use this skill to quickly define a model for player inventory, including unique keys and relevant data fields.

Quick Start

Use the dojo-model skill to create a Position model with player as the key and x, y coordinates as data fields.

Frequently Asked Questions about dojo-model

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

FAQPage Schema
How do I define game state models in Cairo for a Starknet game using Dojo?

To define Starknet game state with Dojo, you generate Cairo structs annotated with the #[dojo::model] attribute, configuring specific fields with #[key] for unique entity identification and deriving necessary traits like Drop and Serde for on-chain compatibility.

How does the Entity-Component-System pattern work for Starknet game models?

The ECS pattern for Starknet game models separates game state into distinct components. You define models as data structures, using key fields to identify unique entities, which the Dojo engine then manages within its global ECS framework.

How do I create a player-owned model with composite keys in Dojo?

You create player-owned models by defining Cairo structs with multiple #[key] fields to establish composite keys. This allows the Dojo engine to map specific state components, like inventory items, uniquely to individual player entities.

Do I need to manually implement Serde and Drop traits for Dojo models?

No, you do not need to manually implement Serde and Drop traits. Generating Dojo models automatically includes the necessary trait derivations to ensure your game state structures are fully compatible with the Starknet on-chain environment.

What is the best way to structure global singleton state in a Dojo game?

To structure global singleton state in a Dojo game, generate a Cairo model without entity-specific key fields. This approach ensures the Dojo engine maintains a single global instance for game-wide configurations or shared state variables.

Can I use dojo-model to define all types of game entities and components?

Yes, you can use it to generate various state structures, including standard game entities, player-owned models, and composite components. It handles the required ECS configurations and key definitions for any Starknet game data structure.