dojo-model

Generate Dojo model structs in Cairo with key annotations and trait derivations.

1|Updated Mar 7, 2026
One-click install
npx skills add https://github.com/shariqazeem/Prophecy-Roguelite --skill dojo-model-shariqazeem
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dojo-model
Source: https://github.com/shariqazeem/Prophecy-Roguelite/tree/main/.agents/skills/dojo-model
Command: npx skills add https://github.com/shariqazeem/Prophecy-Roguelite --skill dojo-model-shariqazeem

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Creating correct, consistent Dojo models for Cairo can be error-prone and time-consuming because models require precise key ordering, trait derivations, nested type introspection, and read/write patterns to work with Dojo's ECS and on-chain storage. This Skill standardizes model definitions, enforces key and trait rules, and produces model structures that integrate with world storage to prevent subtle runtime and serialization bugs.

Core Features & Use Cases

  • Model scaffolding: Generate Cairo structs annotated with #[dojo::model] and ensure at least one #[key] field is defined and placed before data fields.
  • Trait and introspection guidance: Add required trait derivations such as Drop and Serde and require Introspect for nested custom structs and enums.
  • Patterns and examples: Provide common ECS patterns (player-owned models, composite keys, global singletons) and usage notes for reading and writing via world storage and uuid generation.
  • Use case: Define Position, Health, Inventory, and GameSetting models for a Starknet game and get correct composite key read/write examples.

Quick Start

Create a Position model keyed by player address with x and y coordinates using this skill.

Frequently Asked Questions about dojo-model

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

FAQPage Schema
How do I generate Dojo models in Cairo with the correct key annotations and trait derivations?

Dojo models in Cairo require structs annotated with #[dojo::model], at least one #[key] field placed before data fields, and derived Drop and Serde traits to ensure proper ECS storage and serialization.

What is the correct way to structure composite keys and global singletons in Dojo ECS?

Composite keys and global singletons in Dojo ECS are structured by defining specific #[key] fields in your Cairo models and following world read/write conventions to manage entity state and global game settings.

Do I need to derive Introspect for nested custom structs and enums in Dojo models?

Yes, you must derive the Introspect trait for nested custom structs and enums in Dojo models to allow the Cairo framework to correctly handle on-chain storage and serialization for complex types.

How do I read and write player-owned game state using Dojo world storage?

Reading and writing player-owned game state in Dojo world storage involves using generated model definitions with proper key annotations and following established ECS patterns for uuid generation and state access.

What are common errors when creating Dojo model definitions for Starknet game state?

Common errors when creating Dojo model definitions include incorrect key ordering, missing required trait derivations like Drop and Serde, and failing to derive Introspect for nested types, which cause runtime and serialization bugs.