# aider

Adopt this skill: https://proskills.md/skills/other/tari-project-tari-ootle-docs-skills-aider

Page: https://proskills.md/skills/other/tari-project-tari-ootle-docs-skills-aider
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: docs/skills/aider/SKILL.md
size: 8080
upstream: https://github.com/tari-project/tari-ootle/blob/development/docs/skills/aider/SKILL.md

````text
---
name: aider
description: Tari Ootle development instructions for Aider
---

These conventions guide development on the Tari Ootle platform — a decentralized application layer on Tari L2. Smart contracts ("templates") are written in Rust, compiled to WASM (`wasm32-unknown-unknown`), and deployed to the network as components with persistent on-chain state.

## Overview

Tari Ootle is a decentralized application platform built on the Tari Layer 2 network. You build **templates** (smart contracts) in Rust, compile them to WASM (`wasm32-unknown-unknown`), publish them to the network, and interact with deployed **components** (instances of templates) via transactions.

**Key concepts:**
- **Template** — A Rust module annotated with `#[template]` that defines the logic and state structure. Compiled to WASM and deployed to the network.
- **Component** — A live instance of a template on-chain. Holds state (struct fields) and exposes public methods.
- **Resource** — A native digital asset (fungible token or non-fungible NFT). Created with `ResourceBuilder`. Cannot be copied or accidentally destroyed.
- **Vault** — An on-chain container that holds exactly one type of resource. Must be stored in a component before the function returns.
- **Bucket** — A temporary container for resources during a transaction. Used to move assets between vaults or to/from method calls.
- **Transaction** — A set of instructions (CallFunction, CallMethod, etc.) that are signed, submitted, and executed atomically.

**Crate ecosystem:**

| Crate | Purpose | Used In |
|-------|---------|---------|
| `tari_template_lib` | Core template library: prelude, `ResourceBuilder`, `Vault`, `Bucket`, `ComponentManager`, `CallerContext`, `emit_event`, `rand`, macros (`args!`, `rule!`, `metadata!`) | Templates (WASM) |
| `tari_template_lib_types` | Shared types: `Amount`, `ComponentAddress`, `ResourceAddress`, `NonFungibleId`, `AccessRule`, `OwnerRule`, `Metadata` | Templates & client |
| `tari_ootle_transaction` | `TransactionBuilder` and `args!` macro for constructing transactions | Client & tests |
| `ootle-rs` | Client wallet and Indexer provider: sign, submit, watch transactions; builtin template helpers (faucet) | Client apps |
| `tari_template_test_tooling` | Local test harness (dev-dependency): compile templates to WASM and run against the engine in-process | Tests only |

**Important macro distinction:**
- `args!` (from `tari_template_lib::prelude`) — used **inside templates** for cross-template calls (alias for `invoke_args!`)
- `args!` (from `tari_ootle_transaction`) — used **in test code and client code** for `TransactionBuilder`, `TemplateTest::call_function`, and `call_method`. Produces `Vec<NamedArg>`.

---

## Getting Started Workflow

The typical development workflow for building on Tari Ootle:

1. **Generate a template project** from the official starter repo:
   ```bash
   cargo generate https://github.com/tari-project/wasm-template
   ```
   This repo contains:
   - `wasm_templates/` — Blank template starters (e.g., `wasm_templates/empty`)
   - `examples/` — Complete working examples with templates and client apps (e.g., `examples/guessing_game/template`, `examples/guessing_game/cli`)

   When prompted, select the subfolder matching your needs.

2. **Write your template** in `src/lib.rs` inside the `#[template]` module.

3. **Build to WASM:**
   ```bash
   cargo build --target wasm32-unknown-unknown --release
   ```

4. **Test locally** using `tari_template_test_tooling` (see [Testing Templates](#testing-templates)).

5. **Publish to the network** via the Wallet Web UI (see [Publishing Templates](#publishing-templates)).

6. **Interact with your component** using a client app built with `ootle-rs`, the Wallet CLI, or a pre-built example CLI from `cargo generate`.

> **Tip:** For the guessing game and other example templates, pre-published template addresses are available on the Esmeralda testnet. Check the [Tari Ootle guides](https://ootle.tari.com/guides/) for current addresses — you can skip publishing and go straight to interacting.

### CLI App Workflow Order (IMPORTANT)

When running a CLI client app (e.g., the guessing game CLI), operations MUST happen in this order:

1. **Initialize wallet** — Create keypairs, select network, connect to indexer
2. **Fund admin account** — Get tTARI from the faucet
3. **Publish the template** — Deploy the WASM to the network. **Direct the user to the Wallet Web UI** at `http://127.0.0.1:5100` to publish. Do NOT write custom publish code — the Web UI handles fee estimation, upload, and provides the template address.
4. **Create/deploy the game component** — Instantiate the template on-chain (requires the template address from step 3)
5. **Register players** — Add player accounts AFTER the game component exists
6. **Play** — Start rounds, make guesses, end games

> **CRITICAL:** Never register players or add users before the template is published and the game component is deployed. Players need a component to interact with. Do not add a publish command to an example CLI unless the user asks for one; for a one-off publish, direct them to the Wallet Web UI.

### Tooling Requirements

The only tools needed for Ootle development are:
- `rustup` with the `wasm32-unknown-unknown` target
- `cargo-generate` (for scaffolding)
- Standard Rust toolchain (`cargo build`, `cargo test`)
- `wasm-opt` — optional, for checking or shrinking the binary yourself (see [Minifying the WASM](#minifying-the-wasm))

> **Do NOT install** rust-analyzer extensions, cargo-expand, wasm-pack, wasm-bindgen, or other WASM/Rust analysis tools. They are unnecessary for Ootle development and add bloat. The `wasm32-unknown-unknown` target and standard `cargo build` are sufficient.

### Non-Interactive CLI Usage

The generated CLI examples use `dialoguer` for interactive prompts (Select, Input), which requires a real TTY. **Some agent runners execute commands in a non-interactive shell without a TTY.**

When running CLI commands that have interactive prompts:
- **Tell the user to run the command in their terminal** rather than trying to run it through the agent runner
- Do NOT try to pipe input, use `expect`, or wrap with `script` — these are fragile workarounds
- Do NOT modify the CLI to add non-interactive flags unless the user specifically asks for it
- If the CLI already supports `--flag` style arguments that bypass prompts, use those

---

## Writing a Template

### Project Setup

```bash
# Install cargo-generate if not already installed
cargo install cargo-generate

# Generate a new template project from the official starter
cargo generate https://github.com/tari-project/wasm-template
```

The [wasm-template](https://github.com/tari-project/wasm-template) repository offers multiple starting points:
- **`wasm_templates/empty`** — A minimal blank template to start from scratch
- **`examples/guessing_game/template`** — A complete guessing game template with tests
- **`examples/guessing_game/cli`** — A ready-to-use CLI client for the guessing game

When you run `cargo generate`, select the subfolder that matches your goal. For a blank slate, choose a `wasm_templates/` entry. For a working example to learn from, choose from `examples/`.

A generated template project looks like:
```
your_template/
├── Cargo.toml
├── src/
│   └── lib.rs      # Template source code
└── tests/
    └── test.rs     # Unit tests
```

The generated `Cargo.toml` must include:
```toml
[package]
name = "your_template"
version = "0.1.0"
edition = "2024"

[dependencies]
tari_template_lib = "0.31"

[lib]
crate-type = ["cdylib"]

[profile.release]
opt-level = 's'     # Optimize for size.
lto = true          # Enable Link Time Optimization.
codegen-units = 1   # Reduce number of codegen units to increase optimizations.
panic = 'abort'     # Abort on panic.
strip = true          # Strip symbols and debug info.
```

> **CRITICAL:** The `crate-type = ["cdylib"]` is required for WASM compilation. Without it, th
````

## File: README.md
upstream: https://github.com/tari-project/tari-ootle/blob/development/README.md

````text
# Tari Ootle

This is where you can find the cutting-edge development of the Tari smart contract layer.

You can read about the technical specifications of the Ootle in the [RFCs](https://rfc.tari.com).

If you're looking for the core Tari base layer code, it's in [this repository](https://github.com/tari-project/tari)

[Documentation](https://ootle.tari.com)

## Prerequisites

You will require the following tools and dependencies to successfully build the Ootle and/or run the Ootle locally via
the Localnet environment:

- **C/C++ compiler**
    - Linux: `gcc` or `clang`
    - macOS: `clang` (via Xcode CLI tools)
    - Windows: `MSVC` (via Visual Studio Build Tools)
- **Build tools**
    - `make`, `cmake`, or equivalent
    - `pkg-config` (Linux/macOS)
- **Libraries**
    - OpenSSL development libraries (`libssl-dev`)
    - SQLite development libraries (`libsqlite3-dev`)
    - Protobuf compiler (`protoc`) and headers (`libprotobuf-dev`)
- **Other**
    - `git`

- **Rust (=1.88)**: Install Rust using [rustup](https://rustup.rs), and add a WASM target:

```bash
# Install the rust version in rust-toolchain.toml
rustup install
# Add wasm target
rustup target add wasm32-unknown-unknown
```

### Web UIs

**Node.js (>=20.x) & npm**: Node.js is required for building the validator node, indexer and wallet web UIs.
NOTE: this is not required, and the binaries will still run and compile without building the web UIs.

Follow the instructions at [node.js](https://nodejs.org/en/download) for your desired operating system and
package/version managers.
We recommend installing Node.js via [`nvm`](https://github.com/nvm-sh/nvm) to easily manage versions across projects.

We use [pnpm](https://pnpm.io/installation) for package management.

## Accessing the Ootle Testnet

The Tari Ootle Wallet Daemon is available on the
project’s [releases page](https://github.com/tari-project/tari-ootle/releases).
Unzip the binaries, then run:

```shell
tari_ootle_walletd --network igor -b <yourdesiredconfigfolderpath>
```

This will start a wallet connected to the Igor Testnet. You can view the public Nodes here:

- Validator Node: [http://18.217.22.26:12006](http://18.217.22.26:12006)
- Indexer: [http://18.217.22.26:12502](http://18.217.22.26:12502)

Navigate to http://127.0.0.1:5100 to create an account, claim test tokens and start testing features.

## Running a Small Ootle Network Locally (Localnet)

NOTE: This repository is under heavy development. We'll try to keep instructions up to date, but they may become
outdated.

Confirm you have installed all the prerequisites listed in the **Prerequisites** section (Rust, Node.js, npm, linux
dependencies)

The easiest way to test out the Ootle is to use the `tari_swarm_daemon`. This will spin up all necessary MinoTari and
Ootle applications for a _localnet_ network.

Clone both the `tari` and `tari-ootle` repositories in the same folder:

```shell
mkdir <containerfolder>
cd <containerfolder>
git clone https://github.com/tari-project/tari.git
# Checkout the tag on the L1 repo that is recently tested. Check the workspace Cargo.toml in this repo for the correct tag if this one is outdated.
cd tari && git checkout v5.2.0-pre.5 && cd ..
git clone https://github.com/tari-project/tari-ootle.git ootle
```

```shell
cd tari
git checkout development
cd ../ootle
rustup target add wasm32-unknown-unknown
# Creates an initial "swarm" config in data/swarm/config.toml
cargo run --bin tari_swarm_daemon --release -- -c data/swarm/config.toml init
# Build all the necessary binaries (this may take a while) and starts the swarm
cargo run --bin tari_swarm_daemon --release -- -c data/swarm/config.toml start
```

> Note: For subsequent runs, you only need to run the third command with the `-k` argument to avoid trying to
> re-register the Validator Nodes: `cargo run --bin tari_swarm_daemon --release -- -c data/swarm/config.toml start -k`

This will get you an instance of the `tari_swarm_daemon`, starting a Minotari base node, a Minotari console wallet, an
Ootle validator node, an Ootle wallet and an Indexer.
Additionally, it will automatically submit the validator node registration and mine blocks until the validator node is
active.

Open `http://localhost:8080` where you can administer the running instances, get links to the various web UIs and
JSON-RPC endpoints, view logs and more.

NOTE: `tari_swarm_daemon` is specifically for development/debugging and runs a complete local test network. Instructions
for running a wallet, indexer, or validator node, the feature is still in development.

## Tari Validator node

See the dedicated [README](./applications/tari_validator_node/README.md) for installation and running guides.

#### Creating a smart contract template

See the [tari-cli](https://github.com/tari-project/tari-cli) tool for details.

## AI Coding Agent Skills

The [`docs/skills/`](docs/skills/) folder contains comprehensive development guides for building Tari Ootle templates and client applications. These skills are now published on the [documentation site](https://ootle.tari.com/skills/) and discoverable by AI agents via the standard Agent Skills endpoint.

### Automatic Discovery

All skills are exposed via the standard Agent Skills Discovery endpoint:

```
https://ootle.tari.com/.well-known/skills/
```

AI agents that support Agent Skills can automatically discover and load your skills using this URL. No manual setup required!

### Manual Installation (Optional)

If your tool doesn't support automatic discovery, copy the appropriate skill file to your agent's expected location:

| Agent | Source File | Copy To |
|-------|------------|---------|
| [Claude Code](https://claude.ai) | `docs/skills/claude-code/SKILL.md` | `CLAUDE.md` (project root or `.claude/`) |
| [Cursor](https://cursor.com) | `docs/skills/cursor/SKILL.md` | `.cursor/rules/tari-ootle.md` or `AGENTS.md` |
| [GitHub Copilot](https://github.com/features/copilot) | `docs/skills/github-copilot/SKILL.md` | `.github/copilot-instructions.md` |
| [Windsurf](https://windsurf.com) | `docs/skills/windsurf/SKILL.md` | `.windsurfrules` or `AGENTS.md` |
| [Aider](https://aider.chat) | `docs/skills/aider/SKILL.md` | Load via `aider --read docs/skills/aider/SKILL.md` |
| [OpenAI Codex](https://openai.com/codex) | `docs/skills/openai-codex/SKILL.md` | `AGENTS.md` (project root) |
| [Amp](https://ampcode.com) | `docs/skills/amp/SKILL.md` | `AGENTS.md` (project root) |
| [Gemini CLI](https://github.com/google-gemini/gemini-cli) | `docs/skills/google-gemini/SKILL.md` | `AGENTS.md` (project root) |
| [Antigravity](https://antigravity.dev) | `docs/skills/antigravity/SKILL.md` | Per Antigravity docs |

These guides cover template authoring, resource management, access rules, client-side interaction with `ootle-rs`, testing with `tari_template_test_tooling`, the wallet CLI, and complete working examples.

### Get airdropped base layer (Mino)Tari tokens to pay for fees

This is built into the testnet wallet, and faucet tokens can be obtained from the wallet web UI.

### Claiming L1 burn Tari on the Ootle

L1 Minotari coins are able to be burnt and claimed, the user may convert (1:1) these to Tari coins on the layer-2
network.

The easiest way to do this is in a test environment to click a button in the `tari_swarm_daemon` web UI.

After creating an account in the Ootle wallet. Provide the account name and the amount of Tari to burn to the swarm
daemon. This creates the burn transaction on the Minotari wallet and provides a "burn proof".
You can then copy and paste that burn proof into the Ootle wallet web UI using the "Claim Burn" dialog.

For other environments, the "manual" process is as follows:

> **Note:** These steps will likely be simplified in future releases.

1. **Run the Ootle wallet**  
   Start the Ootle wallet application in your environment.

2. **Generate a claim key**
    - Use the Ootle wallet web UI **or** the `tari_ootle_wallet_cli` tool.
    - If using the Ootle wallet, claim keys are d
````
