rust · oakoss — скилл для Claude Code: что делает и как установить
Скилл подсказывает паттерны Rust для ownership, async-кода, веб-сервисов, CLI и тестов. Пригодится при разработке и ревью Rust-проектов.
MIT 128 установок ★ 29 обновлён 2026-08-17
npx skills add oakoss/agent-skills --skill rust -a claude-codeЧто делает rust
Скилл охватывает ownership, borrowing, lifetimes, traits, generics и обработку ошибок через Result, Option, thiserror и anyhow. Он также разбирает async-код с Tokio, сериализацию через serde, Cargo workspaces и тестирование.
В материалах есть примеры для axum, ratatui и clap, бенчмарков с criterion, аудита зависимостей через cargo-deny, сборки релизов через cargo-dist и обновления changelog с release-plz. Для исследования кода, архитектурного и code review скилл предлагает делегирование агентам.
В библиотечном коде unwrap() советуется заменять на Result, чтобы решение об ошибке принимал вызывающий код. В async-тестах нужен атрибут #[tokio::test], а не обычный #[test].
Какие задачи решает
- спроектировать ownership и borrowing для функции
- обработать ошибки через
Result,thiserrorилиanyhow - собрать async-сервис на Tokio и
axum - создать CLI с
clapили TUI наratatui - настроить аудит зависимостей и выпуск бинарников
Примеры запросов агенту
- Проверь ownership и lifetimes в этом модуле Rust и предложи исправления.
- Собери async HTTP-сервис на Tokio и
axumс обработкой ошибок. - Настрой для проекта бенчмарки через
criterionи проверку зависимостей сcargo-deny.
Как установить rust
1Через Skills CLI (Vercel)
npx skills add oakoss/agent-skills --skill rust -a claude-code2Вручную: положить файлы
~/.claude/skills/rust/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/rust/
1Через Skills CLI (Vercel)
npx skills add oakoss/agent-skills --skill rust -a codex2Вручную: положить файлы
.agents/skills/rust/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add oakoss/agent-skills --skill rust -a cursor2Вручную: положить файлы
.cursor/skills/rust/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install oakoss/agent-skills skills/rust2Вручную: положить файлы
.github/skills/rust/SKILL.md1Через Skills CLI (Vercel)
npx skills add oakoss/agent-skills --skill rust -a gemini-cli2Командой платформы
gemini skills install https://github.com/oakoss/agent-skills --path skills/rustВручную: положить файлы
.devin/skills/rust/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add oakoss/agent-skills --skill rust -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о rust
Как установить rust в Claude Code?
Выполните npx skills add oakoss/agent-skills --skill rust -a claude-code, затем проверьте файл ~/.claude/skills/rust/SKILL.md.
Что делает скилл rust?
Он помогает писать и проверять Rust-код: от ownership, lifetimes и ошибок до Tokio, axum, CLI, тестов и Cargo-инструментов для релизов.
Как правильно тестировать async-код в Rust?
Для async-тестов используйте #[tokio::test] вместо #[test]. Скилл также описывает тестирование и бенчмарки через criterion.
Исходный текст
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
Похожие скиллы
Все скиллы по теме «Языки программирования» →Сначала — rust от других авторов.