Agent skill

Rust

by mikotoIO in mikotoIO/mikoto

Contains knowledge on Mikoto usage of Rust. An agent skill from mikotoIO/mikoto.

MITAuto-check passedBackend & APIs

Install Rust

skills CLI
$ npx skills add mikotoIO/mikoto --skill rust -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install mikotoIO/mikoto rust --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/mikotoIO/mikoto.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/rust .claude/skills/rust && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
rust
GitHub stars
132
Token cost
~2.7k tokens
SKILL.md length
589 words
Files
1
Skills in repo
6
Repo updated
First seen
Licence
MIT

At a glance

Contains knowledge on Mikoto usage of Rust. An agent skill from mikotoIO/mikoto.

  • Backend & APIs work in your project
  • SKILL.md covers Project Structure, Creating Entities, Extended Entities (with… and Creating Routes, plus 11 more sections
  • Calls cargo, just and pnpm; reaches docs.rs

What it does

Rust is an agent skill from mikotoIO/mikoto. Contains knowledge on Mikoto usage of Rust. ALWAYS activate before interacting with the backend, or any part of the codebase written in Rust.

Its SKILL.md is about 2.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs. It works with Rust. The licence is MIT.

When your agent uses it

  • Backend & APIs work in your project

Example prompts

  • “Use the rust skill to contain knowledge on Mikoto usage of Rust. An agent skill from mikotoIO/mikoto”
  • “/rust”

What it can do on your machine

Read from SKILL.md and the folder at commit 88f7ff0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • cargo
    • just
    • pnpm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • docs.rs

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Rust loads about 2.7k tokens when it runs. Until then it costs about 37 tokens; SKILL.md has 589 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~37
When it runs · the whole SKILL.md, loaded when a task matches
~2.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from mikotoIO/mikoto at commit 88f7ff0, republished under its MIT licence (© mikotoIO). 589 words, ~2,688 tokens.

Download SKILL.mdSave it as .claude/skills/rust/SKILL.md (or your agent's skills folder).
name
rust
description
Contains knowledge on Mikoto usage of Rust. ALWAYS activate before interacting with the backend, or any part of the codebase written in Rust.

Rust Development in Mikoto

Project Structure

The Rust backend lives in apps/superego/ (main API) and apps/content-proxy/ (media proxy).

apps/superego/src/
├── entities/            # Database models
├── routes/              # API handlers
├── middlewares/         # Auth, extractors
└── functions/           # Utilities (JWT, permissions, pubsub)

Creating Entities

Use the macros in src/entities/macros.rs:

rust
// Database-backed entity
entity!(
    pub struct Message {
        pub id: Uuid,
        pub channel_id: Uuid,
        pub author_id: Option<Uuid>,
        pub content: String,
        pub timestamp: DateTime<Utc>,
    }
);

// Non-database model (DTOs, payloads)
model!(
    pub struct MessageSendPayload {
        pub content: String,
    }
);

// Database enum
db_enum!(
    #[sqlx(type_name = "\"ChannelType\"")]
    pub enum ChannelType {
        Text,
        Voice,
        Document,
    }
);

Use helper macros for common queries:

rust
impl Message {
    db_find_by_id!("Message");
    db_entity_delete!("Message");
    db_list_where!(Message, list_by_channel, channel_id, channel_id, Uuid);
}

Extended Entities (with Relations)

For entities that need related data:

rust
pub struct MessageExt {
    #[serde(flatten)]
    pub base: Message,
    pub author: Option<User>,
    pub attachments: Vec<Attachment>,
}

impl MessageExt {
    pub async fn dataload(messages: Vec<Message>, db: &PgPool) -> Result<Vec<Self>> {
        // Batch load relations to avoid N+1 queries
        let author_ids: Vec<Uuid> = messages.iter().filter_map(|m| m.author_id).collect();
        let authors = User::find_by_ids(&author_ids, db).await?;
        // ... map and return
    }

    pub async fn dataload_one(message: Message, db: &PgPool) -> Result<Self> {
        Ok(Self::dataload(vec![message], db).await?.pop().unwrap())
    }
}

Creating Routes

Routes use Axum with aide for OpenAPI documentation.

Basic Route Handler
rust
use crate::error::{Error, Result};
use crate::middlewares::auth::Claims;
use axum::extract::{Path, Json};

async fn get_message(
    Path((space_id, channel_id, message_id)): Path<(Uuid, Uuid, Uuid)>,
    claim: Claims,  // Requires authentication
) -> Result<Json<MessageExt>> {
    let message = Message::find_by_id(message_id, db()).await?;
    let message = MessageExt::dataload_one(message, db()).await?;
    Ok(message.into())
}
Registering Routes

In the route module's router function:

rust
use aide::axum::routing::{get_with, post_with, patch_with, delete_with};

pub fn router() -> AppRouter {
    AppRouter::new()
        .api_route("/", get_with(list, api_docs))
        .api_route("/", post_with(create, api_docs))
        .api_route("/:messageId", get_with(get, api_docs))
        .api_route("/:messageId", patch_with(update, api_docs))
        .api_route("/:messageId", delete_with(delete, api_docs))
}
Using the Load Extractor

For automatic entity loading from path params:

rust
use crate::middlewares::load::Load;

async fn get_space(Load(space): Load<SpaceExt>) -> Result<Json<SpaceExt>> {
    Ok(space.into())
}

Error Handling

Use the custom Error type from src/error.rs:

rust
use crate::error::{Error, Result};

async fn example() -> Result<Json<Data>> {
    // Use ? to propagate errors
    let data = fetch_data().await?;

    // Create specific errors
    if !authorized {
        return Err(Error::forbidden("You cannot access this resource"));
    }

    // Not found
    let item = Item::find_by_id(id, db()).await?
        .ok_or_else(|| Error::not_found("Item not found"))?;

    Ok(data.into())
}

Database Operations

Always use db() for the connection pool:

rust
use crate::db::db;

// Insert
sqlx::query("INSERT INTO \"Message\" (id, content) VALUES ($1, $2)")
    .bind(id)
    .bind(content)
    .execute(db())
    .await?;

// Query
let messages: Vec<Message> = sqlx::query_as(
    "SELECT * FROM \"Message\" WHERE channel_id = $1 ORDER BY timestamp DESC"
)
    .bind(channel_id)
    .fetch_all(db())
    .await?;

Creating Migrations

bash
just new-migration <migration_name>

This creates a file in apps/superego/migrations/. Write SQL directly:

sql
-- Create new table
CREATE TABLE "Attachment" (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    message_id UUID NOT NULL REFERENCES "Message"(id) ON DELETE CASCADE,
    filename TEXT NOT NULL,
    url TEXT NOT NULL,
    content_type TEXT NOT NULL,
    size INTEGER NOT NULL
);

-- Add column
ALTER TABLE "Message" ADD COLUMN edited_at TIMESTAMPTZ;

-- Create enum
CREATE TYPE "AttachmentType" AS ENUM ('Image', 'Video', 'File');

After creating migrations, read schema.sql for the current full schema.

Real-time Events

Emit events via Redis pub/sub:

rust
use crate::functions::pubsub::emit_event;

// After creating a message
emit_event("messages.onCreate", &message_ext, &format!("space:{}", space_id)).await?;

// After updating
emit_event("messages.onUpdate", &message_ext, &format!("space:{}", space_id)).await?;

// After deleting
emit_event("messages.onDelete", &MessageKey { channel_id, message_id }, &format!("space:{}", space_id)).await?;

WebSocket Handlers

Register WebSocket commands and events in the router:

rust
.ws_command("typing.start", |data: TypingPayload, state| async move {
    // Handle client command
    Ok(())
})
.ws_event("messages.onCreate", |data: MessageExt, state| async move {
    // Filter/transform for this connection
    Some(data)
})

Permissions

Use the permission functions in src/functions/permissions.rs:

rust
use crate::functions::permissions::{permissions, Permissions};

async fn admin_action(claim: Claims, Load(space): Load<SpaceExt>) -> Result<Json<()>> {
    permissions(&claim, &space, Permissions::ADMIN)?;
    // ... admin-only logic
}

Testing

Write unit tests inline with #[cfg(test)]:

rust
#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_something() {
        // ...
    }

    #[tokio::test]
    async fn test_async_thing() {
        // ...
    }
}

Key Conventions

  • Table names: PascalCase with quotes ("Message", "User")
  • JSON fields: camelCase (handled by serde)
  • Rust fields: snake_case
  • IDs: Always UUID
  • Timestamps: DateTime<Utc> with chrono
  • Optionals: Option<T> for nullable fields

Best Practices

Safety
  • Never use unsafe Rust - This codebase has no need for unsafe code. All functionality can be achieved with safe Rust.
  • Never use .unwrap() or .expect() in production code - Always use ? operator or handle errors explicitly. The only exception is in tests or when the value is guaranteed to exist (with a comment explaining why).
  • Avoid .clone() unless necessary - Prefer borrowing. If cloning is needed, consider if the data structure should use Arc instead.
Researching Crates
  • Use WebFetch on docs.rs to explore crate APIs before using them. Example: https://docs.rs/axum/latest/axum/
  • Check crate versions before adding - Search docs.rs or crates.io to find the latest version before adding to Cargo.toml.
  • Prefer crates already in use - Check apps/superego/Cargo.toml before adding new dependencies. The codebase already includes many utilities.
Code Quality
  • Run moon :typecheck after changes - This checks both Rust and TypeScript. Always run before committing.
  • Follow clippy suggestions - Run moon :lint and address all warnings. Clippy catches common mistakes and suggests idiomatic Rust.
  • Use existing patterns - Look at similar code in the codebase before implementing. Follow established patterns for entities, routes, and error handling.
Show full SKILL.md (234 more words)Show less
Database
  • Read schema.sql for current schema - Don't read individual migrations. The schema dump is always up-to-date and easier to understand.
  • Use parameterized queries - Never interpolate user input into SQL strings. Always use .bind().
  • Batch load relations - Use the dataload pattern to avoid N+1 query problems.
Error Handling
  • Use the custom Error type - Don't create new error types. Use Error::new(), Error::internal(), Error::forbidden(), etc.
  • Propagate with ? - Let errors bubble up. The error type automatically converts to HTTP responses.
  • Provide helpful messages - Error messages should help the API consumer understand what went wrong.
Performance
  • Use db() singleton - Never create new database connections. The pool is managed globally.
  • Avoid blocking in async code - Use tokio::task::spawn_blocking for CPU-intensive work.
  • Batch database operations - Use dataload patterns and batch inserts/updates when possible.

OpenAPI Schema Generation

The backend uses aide to automatically generate OpenAPI documentation from route definitions. When you add or modify routes, entities, or API payloads, you need to regenerate the schema and frontend types.

Regenerating the API Schema
bash
moon :generate  # Generates apps/superego/api.json and regenerates client bindings

This runs the dump_api binary (src/bin/dump_api.rs) which builds the router and extracts the OpenAPI schema without starting the server.

Regenerating Frontend Types

After updating api.json, regenerate the TypeScript types:

bash
cd packages/mikoto.js && pnpm run generate

This uses openapi-zod-client to generate Zod schemas and API client types in packages/mikoto.js/src/api.gen.ts.

When to Regenerate

Regenerate after any changes to:

  • Route handlers (new endpoints, changed paths)
  • Request/response types (entities, payloads)
  • API documentation annotations
  • WebSocket events or commands
Full Workflow
bash
# 1. Make backend changes
# 2. Verify Rust compiles
moon superego:typecheck

# 3. Regenerate API schema and frontend types
moon :generate

# 5. Verify everything compiles
moon :typecheck

Common Commands

bash
moon :typecheck          # Type-check Rust and TypeScript
moon :lint               # Run clippy and eslint
moon :lint.fix           # Auto-fix linting issues
moon :format             # Format all code
moon :test               # Run all tests
cargo run -p superego    # Run just the Rust server
cargo test -p superego   # Run Rust tests only
cargo check -p superego  # Quick compilation check
just new-migration name  # Create new migration
moon :generate           # Regenerate OpenAPI schema and client bindings

© mikotoIO, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/rust of mikotoIO/mikoto.

Open the folder on GitHubat commit 88f7ff0

Compare with similar skills

Rust next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Rust compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Rust this skillmikotoIO/mikoto132—~2.7kAutomated safety check: PassMIT
Performancestatic-web-server/static-web-server2.4k—~3.1kAutomated safety check: PassApache-2.0
Dev Rulesrust-dd/tako162—~810Automated safety check: PassMIT
Nxvutensils/nxv136—~7.9kAutomated safety check: NotesMIT
Release WorkflowGoldziher/spikard123—~909Automated safety check: PassMIT
Rust ConventionsGoldziher/ai-rulez158—~746Automated safety check: PassMIT

Similar skills

  • Performance

    static-web-server/static-web-server

    Optimize or review performance for the Static Web Server (SWS) project — profiling, bottlenecks, resource usage, compression, and caching

    2.4k GitHub stars~3.1k tokensUpdated today
    Backend & APIsAuto-check passed
  • Dev Rules

    rust-dd/tako

    General coding-style rules to apply to every project. An agent skill from rust-dd/tako.

    162 GitHub stars~810 tokensUpdated 6 days ago
    Backend & APIsAuto-check passed
  • Nxv

    utensils/nxv

    Find any version of any Nix package across nixpkgs git history using the nxv CLI or HTTP API.

    136 GitHub stars~7.9k tokensUpdated 1 mo ago
    Backend & APIsAuto-check: notes
  • Release Workflow

    Goldziher/spikard

    Release/publish the spikard Rust core crate and CLI end-to-end.

    123 GitHub stars~909 tokensUpdated 4 days ago
    Backend & APIsAuto-check passed
  • Rust Conventions

    Goldziher/ai-rulez

    Rust code conventions covering edition 2024, cargo fmt/clippy, Result-based error handling, unsafe discipline, async with tokio, API-guideline naming, trait implementations, benchmarking, and…

    158 GitHub stars~746 tokensUpdated today
    Backend & APIsAuto-check passed
  • Debugging Local Replay

    PostHog/posthog

    Official

    Debugs why session recordings aren't appearing in the local dev environment.

    40k GitHub stars~1.9k tokensUpdated today
    Backend & APIsAuto-check passed

More from mikotoIO/mikoto

  • Chakra UI

    mikotoIO/mikoto

    Contains Chakra UI v3 documentation for styling, theming, and components.

    132 GitHub stars~824 tokensUpdated 2 mo ago
    Auto-check passed
  • Learn

    mikotoIO/mikoto

    Creates a new skill or updates an existing skill to capture new knowledge.

    132 GitHub stars~517 tokensUpdated 2 mo ago
    Auto-check passed
  • Typescript React

    mikotoIO/mikoto

    Contains TypeScript/React patterns and conventions for the Mikoto frontend.

    132 GitHub stars~2.5k tokensUpdated 2 mo ago
    Auto-check passed
  • Rebase

    mikotoIO/mikoto

    Rebases the current branch onto the latest main branch. An agent skill from mikotoIO/mikoto.

    132 GitHub stars~290 tokensUpdated 2 mo ago
    Auto-check passed
  • Create PR

    mikotoIO/mikoto

    Creates a pull request using the GitHub CLI. An agent skill from mikotoIO/mikoto.

    132 GitHub stars~138 tokensUpdated 2 mo ago
    Auto-check passed

Works with

Questions about Rust

What does Rust do?

Contains knowledge on Mikoto usage of Rust. An agent skill from mikotoIO/mikoto. Rust is an agent skill from mikotoIO/mikoto. Contains knowledge on Mikoto usage of Rust.

When should I use Rust?

Rust fits situations like: backend & APIs work in your project.

How do I install Rust in Claude Code?

Run `npx skills add mikotoIO/mikoto --skill rust -a claude-code`. Or copy the skill folder (.claude/skills/rust in mikotoIO/mikoto) into .claude/skills/rust in your project. Claude Code loads it when a task matches its description.

How do I install Rust in Codex?

Run `npx skills add mikotoIO/mikoto --skill rust -a codex`. Or copy the skill folder (.claude/skills/rust in mikotoIO/mikoto) into .agents/skills/rust in your project. Codex loads it when a task matches its description.

Can I use Rust in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add mikotoIO/mikoto --skill rust -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/rust, .gemini/skills/rust, .github/skills/rust and .opencode/skills/rust in your project.

What does Rust need to run?

Going by SKILL.md and its folder, Rust needs the command-line tools its instructions call (cargo, just and pnpm).

Does Rust access the network?

SKILL.md names 1 domain. In commands or code: docs.rs; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Rust safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Rust use?

Rust is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Rust use?

About 2.7k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Rust?

Skills that share tags, products or a category with Rust: Performance (static-web-server/static-web-server, 2.4k stars), Dev Rules (rust-dd/tako, 162 stars), Nxv (utensils/nxv, 136 stars) and Release Workflow (Goldziher/spikard, 123 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Rust?

mikotoIO (a GitHub organization) maintains it in mikotoIO/mikoto, which has 132 GitHub stars. The repository holds 6 skills in this directory. The repository was last updated on August 5, 2026.

Source: mikotoIO/mikoto on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.