- Home
- Skills
- Dojoengine
- Book
- Dojo System
dojo-system_skill
- TypeScript
51
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill dojoengine/book --skill dojo-system- SKILL.md6.9 KB
Overview
This skill generates Dojo systems (Cairo contracts) that implement game logic, handle player actions, and modify model state. It creates interface traits, contract modules, world access helpers, event definitions, and complete system functions ready for integration into your Dojo world. Use it to quickly scaffold movement, combat, spawning, inventory, or any game mechanic with correct model reads/writes and event emissions.
How this skill works
Given a description of the desired system and its functions, the skill produces a Cairo contract annotated with #[dojo::contract] and an interface trait with #[starknet::interface]. It adds world access helpers, model read/write calls, input validation, and event definitions that follow Dojo conventions. The output includes sample implementations for actions (spawn, move, attack), helper functions (next_position, uuid usage), and permissions notes for dojo_dev.toml.
When to use it
- Implement game mechanics such as movement, combat, or spawning
- Create player command handlers that read and update models
- Scaffold a system that emits events for client updates
- Generate systems that enforce input validation and permissions
- Rapidly prototype automated logic or AI-controlled behaviors
Best practices
- Design each system with single responsibility (one clear purpose per contract)
- Keep systems stateless: read models from world, compute, then write updated models
- Create a world_default helper to centralize namespace access and avoid repetition
- Validate inputs and guard model updates with assertions before writing
- Emit events for important state changes so clients can react and indexers can track activity
Example use cases
- MovementSystem: update Position and Moves models, emit PlayerMoved events
- CombatSystem: read attacker/target Combat models, apply damage, write updates
- SpawnSystem: initialize Position, Moves, inventory for new players using world.uuid()
- InventorySystem: add/remove items with model writes and permission checks
- AutomatedAI: periodic system that updates NPC models and emits behavior events
FAQ
Systems need writer permission for the target namespace or model. Configure writers in dojo_dev.toml per namespace or per model (e.g., "my_namespace-Position" = ["my_namespace-actions"]).
How do I make the system use a consistent namespace?
Create a world_default helper via #[generate_trait] that returns self.world(@"my_namespace"). Use that helper in every function to avoid repeating the namespace.