Skip to main content
skill CX Codex

rust · oakoss — Claude Code skill: what it does, how to install

This skill guides Rust work across ownership, async services, CLIs, terminal UIs, and testing. Use it when an agent needs Rust-specific patterns.

MIT 128 installs ★ 29 updated 2026-08-17

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add oakoss/agent-skills --skill rust -a claude-code
Open on GitHub

What rust does

The skill covers ownership, borrowing, lifetimes, traits, generics, and error handling with Result, Option, thiserror, and anyhow. It also addresses Tokio async code, serde serialization, Cargo workspaces, and testing patterns.

Its references include examples for axum, ratatui, and clap, plus benchmarking with criterion. Release-related guidance covers dependency checks with cargo-deny, binary distribution through cargo-dist, and changelog updates using release-plz. Code exploration, architecture review, and code review can be handed to the listed agents.

In library code, the guidance favors returning Result over calling unwrap(), leaving error decisions to the caller. Async tests should use #[tokio::test] rather than #[test].

What it helps with

  • design ownership and borrowing for a Rust function
  • propagate errors with Result, thiserror, or anyhow
  • build an async service with Tokio and axum
  • create a CLI with clap or a TUI with ratatui
  • audit dependencies and prepare binary releases

Example prompts for the agent

  • Review ownership and lifetime usage in this Rust module, then suggest fixes.
  • Build an async HTTP service with Tokio and axum, including error handling.
  • Set up criterion benchmarks and dependency checks with cargo-deny for this project.

How to install rust

1Skills CLI (Vercel)

npx skills add oakoss/agent-skills --skill rust -a claude-code

2Manually: put the files in place

~/.claude/skills/rust/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/rust/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about rust

How do I install rust in Claude Code?

Run npx skills add oakoss/agent-skills --skill rust -a claude-code, then check ~/.claude/skills/rust/SKILL.md.

What does the rust skill do?

It gives the agent Rust patterns for ownership, lifetimes, errors, Tokio, axum, CLI tools, testing, and Cargo-based release workflows.

Which attribute should async Rust tests use?

Use #[tokio::test] instead of #[test] for async tests. The skill also covers testing patterns and criterion benchmarks.

Source text

SKILL.md · MIT
---
name: rust
description: |
  Rust language patterns and ecosystem covering ownership, borrowing, lifetimes, error handling (Result/Option, thiserror, anyhow), async with Tokio, traits, generics, serde serialization, Cargo workspaces, and testing. Includes axum web framework, ratatui terminal UI, clap CLI parsing, criterion benchmarking, cargo-deny supply chain security, cargo-dist binary distribution, and release-plz changelog automation.

  Use when writing Rust code, designing ownership models, building async services with Tokio/axum, creating terminal UIs with ratatui, setting up CLI applications with clap, configuring CI/CD pipelines for Rust, benchmarking with criterion, auditing dependencies with cargo-deny, or distributing binaries with cargo-dist.
license: MIT
metadata:
  author: oakoss
  version: '1.0'
  source: 'https://doc.rust-lang.org/book/'
user-invocable: false
---

# Rust

## Overview

Rust is a systems programming language focused on safety, concurrency, and performance. The ownership system guarantees memory safety without garbage collection, and the type system enforces thread safety at compile time.

**When to use:** Systems programming, web services (axum), CLI tools (clap), terminal UIs (ratatui), WebAssembly, performance-critical applications, anything requiring memory safety without runtime overhead.

**When NOT to use:** Rapid prototyping where compile times matter more than safety, simple scripting tasks, projects where the team has no Rust experience and deadlines are tight.

## Quick Reference

| Pattern             | API / Tool                          | Key Points                           |
| ------------------- | ----------------------------------- | ------------------------------------ |
| Ownership transfer  | `let b = a;`                        | `a` is moved, no longer usable       |
| Borrowing           | `&T` / `&mut T`                     | One mutable OR many immutable refs   |
| Lifetime annotation | `fn f<'a>(x: &'a str) -> &'a str`   | Ties output lifetime to input        |
| Error propagation   | `?` operator                        | Converts and propagates errors       |
| Custom errors       | `thiserror::Error` derive           | Structured error types with Display  |
| Ad-hoc errors       | `anyhow::Result<T>`                 | Context chaining for applications    |
| Async runtime       | `#[tokio::main]`                    | Entry point for async programs       |
| Spawn task          | `tokio::spawn(async { })`           | Concurrent async task execution      |
| HTTP router         | `axum::Router::new().route(...)`    | Composable routing with extractors   |
| Extractors          | `Json<T>`, `Path<T>`, `State<T>`    | Type-safe request parsing            |
| Serialization       | `#[derive(Serialize, Deserialize)]` | serde with format-agnostic derives   |
| CLI parsing         | `#[derive(Parser)]`                 | clap derive API for arg parsing      |
| TUI rendering       | `terminal.draw(\|f\| { })`          | Immediate-mode ratatui rendering     |
| Benchmarking        | `criterion::Criterion`              | Statistical benchmarking framework   |
| Dep auditing        | `cargo deny check`                  | License, vulnerability, source audit |
| Binary release      | `cargo dist init`                   | Cross-platform binary distribution   |
| Changelog           | `release-plz update`                | Auto semver bump and changelog       |

## Common Mistakes

| Mistake                                 | Correct Pattern                               |
| --------------------------------------- | --------------------------------------------- |
| Returning reference to local variable   | Return owned type or use lifetime parameter   |
| Using `unwrap()` in library code        | Return `Result` and let caller decide         |
| `clone()` to satisfy borrow checker     | Restructure code to avoid the borrow conflict |
| Blocking in async context               | Use `tokio::task::spawn_blocking`             |
| Shared mutable state without sync       | Use `Arc<Mutex<T>>` or channels               |
| `String` where `&str` suffices          | Accept `&str` in function parameters          |
| Ignoring `must_use` warnings            | Handle or explicitly discard with `let _ =`   |
| Large enum variants                     | Box the large variant to reduce overall size  |
| `async fn` in traits without bounds     | Add `Send` bound or use `async-trait` crate   |
| Missing `#[tokio::test]` on async tests | Use `#[tokio::test]` instead of `#[test]`     |

## Delegation

- **Code exploration**: Use `Explore` agent
- **Architecture review**: Use `Task` agent
- **Code review**: Delegate to `code-reviewer` agent

> If the `docker` skill is available, delegate multi-stage container build patterns to it.
> If the `github-actions` skill is available, delegate CI pipeline configuration to it.
> If the `openapi` skill is available, delegate API specification and code generation to it.

## References

- [Ownership, borrowing, lifetimes, and type system patterns](references/ownership-and-types.md)
- [Error handling with Result, Option, thiserror, and anyhow](references/error-handling.md)
- [Async programming with Tokio runtime and concurrency](references/async-tokio.md)
- [Web APIs and backends with axum, tower, and sqlx](references/axum-web.md)
- [Terminal user interfaces with ratatui and crossterm](references/ratatui-tui.md)
- [CLI applications with clap, config, and signal handling](references/cli-applications.md)
- [Testing patterns and criterion benchmarking](references/testing-and-benchmarks.md)
- [Release pipeline with cargo-deny, cargo-dist, and release-plz](references/release-pipeline.md)

© oakoss · MIT · oakoss/agent-skills

Similar skills

All skills for Programming languages →

rust by other authors comes first.

rust Mindrally Tells the agent how to write Rust: ownership for memory safety, async on tokio, errors via Result and Option. CX Codex +1 832installs rust Fandhe-AI This skill hands your agent a local copy of the official Rust docs: the language, Cargo, rustc, unsafe and async. Useful when you are editing a crate or fighting the borrow checker. CX Codex +1 1,300installs rust martinholovsky rust is a Claude Code skill for writing Rust backends for Tauri desktop apps with attention to memory safety and performance. It covers systems programming tasks, including async code and Tauri commands. CX Codex +1 268installs rust ulpi-io Guides agents through systems-level Rust conventions for storage engines, tokio, and binary data. Keeps changes aligned with workspace rules. CX Codex +1 133installs rust finom Generates a typed Rust client crate from a Vovk API schema. It helps set up async reqwest calls and consume JSON Lines streams. CX Codex +1 ★ 57repo stars rust_development vuralserhat86 Guides Rust development with conventions for Tokio runtimes, Axum web services, and strict error handling. CX Codex +1 1installs rust-stinger Legion Code Inc. rust-stinger guides bounded Rust development across Cargo workspaces, Tokio runtimes, SQLx persistence, and test validation before release. CX Codex +1 ★ 96repo stars rust-pro Seth Hobson The rust-pro subagent for Claude Code, Codex, and Cursor handles async Tokio services, complex lifetimes, lock-free concurrency, and systems programming in Rust 1.75+. CX Codex 1,148installs rust-engineer VoltAgent Community rust-engineer guides Rust 2021 development focusing on memory safety, zero-cost abstractions, and Miri validation. Handy for systems programming, embedded devices, and async services. CX Codex 262installs rust-project Seth Hobson A slash command that lays out a Rust project skeleton: binary, library, workspace or Axum web API. Useful when you want module layout and tooling without doing it by hand. CX Codex +1 ★ 42,780repo stars rust-best-practices Pedro Nauck rust-best-practices — a skill for writing, refactoring, and optimizing Rust code with ownership, error handling, Tokio, traits, and testing. Use it for systems programming or async workloads where correctness matters. CX Codex +1 298installs

From the same set106

The whole set →
data-visualizer data-visualizer guides chart and dashboard development using Recharts, Chart.js, or D3.js with built-in accessibility rules. CX Codex +1 133installs knowledge-base-manager knowledge-base-manager is a Claude Code skill for choosing a document, graph, or hybrid knowledge-base design and planning its maintenance. It covers content curation, quality checks, and versioning. CX Codex +1 131installs secure-ai secure-ai — a skill that hardens the LLM layer of an app: injection defense, output validation, and zero-trust rules for agents that call tools. CX Codex +1 130installs python-uv python-uv teaches coding agents to manage Python projects with uv: initialization, dependencies, lockfiles, workspaces, and packaging. Useful when migrating from pip and poetry workflows. CX Codex +1 129installs github-cli github-cli equips AI coding assistants with gh CLI workflows for pull requests, issues, Actions runs, releases, and API calls. CX Codex +1 128installs resend Guides AI agents in integrating the Resend email API, handling React Email templates, domain verification, and Svix webhooks. CX Codex +1 127installs tanstack-pacer Hands your agent a map of TanStack Pacer: debouncing, throttling, rate limits and async queues, with the matching React hooks. Useful when a handler fires too often. CX Codex +1 126installs tanstack-devtools tanstack-devtools guides AI coding agents in configuring Query cache, Router, and Form debugging panels across React applications. CX Codex +1 125installs

Project sponsors

Companies that keep this analytics open