Dojo init

From dojoengine/book · View interactive version

Dojo init is an AI agent skill from the GitHub repository dojoengine/book. Initialize new Dojo projects with proper directory structure, configuration files, and dependencies. Use when starting a new Dojo game project or setting up the initial project structure.

How to use this skill

Skill file

Dojo Project Initialization

Initialize new Dojo projects with the complete directory structure, configuration files, and dependencies.

When to Use This Skill

What This Skill Does

Creates a complete Dojo project with:

Quick Start

Using sozo init:

sozo init my-game

This creates a new Dojo project from the dojo-starter template.

Interactive mode:

"Create a new Dojo project called my-game"

Project Structure

After initialization:

my-game/
├── Scarb.toml              # Package manifest and dependencies
├── dojo_dev.toml           # Local development profile
├── dojo_release.toml       # Production deployment profile
└── src/
    ├── lib.cairo           # Module exports
    ├── models.cairo        # Game state models
    ├── systems/
    │   └── actions.cairo   # Game logic systems
    └── tests/
        └── test_world.cairo # Integration tests

Configuration Files

Scarb.toml

Package manifest with Dojo dependencies:

[package]
cairo-version = "2.12.2"
name = "my_game"
version = "1.0.0"
edition = "2024_07"

[[target.starknet-contract]]
sierra = true
build-external-contracts = ["dojo::world::world_contract::world"]

[dependencies]
starknet = "2.12.2"
dojo = "1.7.1"

[dev-dependencies]
cairo_test = "2.12.2"
dojo_cairo_test = "1.7.1"

[tool.scarb]
allow-prebuilt-plugins = ["dojo_cairo_macros"]

dojo_dev.toml

Local development configuration:

[world]
name = "My Game"
seed = "my_game"

[env]
rpc_url = "http://localhost:5050/"
account_address = "0x127fd..."
private_key = "0xc5b2f..."

[namespace]
default = "my_game"

[writers]
"my_game" = ["my_game-actions"]

Starter Template Contents

The starter template includes:

Models (`src/models.cairo`)

Systems (`src/systems/actions.cairo`)

Tests (`src/tests/test_world.cairo`)

Development Workflow

  1. Initialize project:

```bash

sozo init my-game

cd my-game

```

  1. Start Katana:

```bash

katana --dev --dev.no-fee

```

  1. Build and deploy:

```bash

sozo build && sozo migrate

```

  1. Test your system:

```bash

sozo execute my_game-actions spawn

```

  1. Run tests:

```bash

sozo test

```

Customization

After initialization, customize your project:

  1. Add models: Create new model structs in src/models.cairo or separate files
  2. Add systems: Create new contract modules in src/systems/
  3. Update permissions: Edit [writers] in dojo_dev.toml
  4. Add dependencies: Edit [dependencies] in Scarb.toml

Next Steps

After initialization:

  1. Use dojo-model skill to add game state models
  2. Use dojo-system skill to implement game logic
  3. Use dojo-test skill to write tests
  4. Use dojo-deploy skill to deploy your world

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.