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.