Rust programming skills: ownership, borrowing, lifetimes, async, best practices, anti-patterns, CLI apps, and adversarial-TDD worker agents
- version
- 0.1.13
- GitHub stars
- 27
Install
/plugin install rust@vinnie357Run it inside Claude Code after adding the marketplace with /plugin marketplace add vinnie357/claude-skills.
Contents
Discovered from sourceSkills 8
Rust Anti-Patterns
Catalog of Rust anti-patterns and clippy anti-idioms for reviewers and implementers actively hunting code to fix or remove. Complements /rust:troubleshooting (which teaches the idiomatic GOOD patterns) by naming the BAD patterns explicitly, with detection hints.
Sources
Rust Design Patterns book (anti-patterns, idioms) and the Clippy lint index — full attribution per entry in references/anti-patterns.md, dated URLs in sources.md.
Example
// BAD: clippy::ptr_arg — forces callers to hold an owned Vec
fn process(data: &Vec<i32>) { /* ... */ }
// GOOD: accepts a Vec, an array, or a slice via deref coercion
fn process(data: &[i32]) { /* ... */ }
The full catalog (9 entries) is in references/anti-patterns.md.
Usage Guidelines
- Scan for the pattern — check the diff or module against
references/anti-patterns.md - Confirm it's not deliberate — a
restraint:comment or documented tradeoff can justify what looks like an anti-pattern; anti-patterns are defaults to avoid, not absolute bans - Fix at the root — apply the GOOD replacement, don't just silence the lint
- Cite the source — when flagging in review, reference the anti-pattern name so the author can look it up
Anti-Fabrication
Every entry in references/anti-patterns.md cites its source URL. Do not assert a clippy lint name, its default-enabled status, or a "this catches N% of cases" claim without verifying against the linked clippy documentation — see /core:anti-fabrication.
Rust Async and Concurrency
Async functions, tokio runtime, streams, threads, channels, and shared state.
For async patterns, concurrency primitives, and shared state examples, see references/async.md.
Anti-fabrication
This skill follows core:anti-fabrication. Every claim about async/await behavior, the
tokio runtime, and std concurrency primitives is verified against the Async Book and tokio
documentation cited in sources.md — not inferred from generic familiarity with the
ecosystem. Before asserting a tokio API or concurrency behavior this skill and its
references do not cover, check the installed crate version's docs.rs page rather than
guessing.
Rust CLI Applications
Argument parsing, user-facing output, exit codes, signal handling, and subprocess testing for command-line tools.
For argument parsing, error context, output, signals, exit codes, and testing patterns, see references/cli.md.
Example
use clap::Parser;
#[derive(Parser)]
struct Cli {
pattern: String,
path: std::path::PathBuf,
}
fn main() {
let cli = Cli::parse(); // derives parsing, validation, and --help
}
The full argument-parsing, error-context, output, signals, exit-code, and testing patterns are in references/cli.md.
This skill covers CLI-specific ecosystem crates. For custom error enum design (thiserror) shared with non-CLI code, see rust:error-handling. For unit and integration test structure not specific to CLI binaries, see rust:testing.
See /core:anti-fabrication — crate versions and behavior claims in this skill are verified against crates.io and the upstream Rust CLI Book, not assumed.
Rust Error Handling
Result, Option, error propagation, and custom error types.
For Result, Option, ? operator, custom error type patterns, and the thiserror/anyhow ecosystem crates, see references/error-handling.md.
Anti-fabrication
This skill follows core:anti-fabrication. Every claim about Result/Option behavior,
the ? operator, and the thiserror/anyhow crate APIs is verified against the official
documentation and crates.io versions cited in sources.md — not inferred from generic
familiarity with the ecosystem. Before asserting an error-handling pattern or crate API this
skill and its references do not cover, check the installed crate version's docs.rs page
rather than guessing.
Rust Ownership and Borrowing
Ownership rules, borrowing, slices, and lifetimes.
For ownership rules, borrowing patterns, slices, and lifetime annotations, see references/ownership.md.
Anti-fabrication
This skill follows core:anti-fabrication. Every claim about ownership, borrowing, and
lifetime rules is verified against the official Rust Book chapters cited in sources.md —
not inferred from generic familiarity with the language. Before asserting borrow-checker
behavior this skill and its references do not cover, check the installed Rust toolchain's
documentation rather than guessing.
Rust Programming Language
Entry point for Rust development. Provides an overview and routes to focused skills.
Available Skills
This plugin provides focused skills for specific Rust topics:
- rust:ownership - Ownership rules, borrowing, slices, lifetimes
- rust:error-handling - Result, Option, ? operator, custom error types
- rust:anti-patterns - Anti-patterns and clippy anti-idioms to hunt and fix
- rust:async - Async functions, tokio, streams, threads, channels, shared state
- rust:testing - Unit tests, integration tests, cargo test, Cargo.toml, commands
- rust:troubleshooting - Best practices, common patterns, idiomatic Rust
- rust:cli - Argument parsing with clap, CLI output and progress, exit codes, testing CLI binaries
For core language features (traits, generics, collections, pattern matching), see references/language.md.
Quick Start
# Install via mise
mise use rust@latest
# Create a new project
cargo new myproject
cd myproject
# Build and run
cargo run
See templates/mise.toml for project task definitions.
Key Principles
- Ownership ensures memory safety: no garbage collector needed
- Borrow checker prevents data races: compile-time safety
- Zero-cost abstractions: high-level code compiles to efficient machine code
- Explicit over implicit: be clear about ownership, mutability, errors
- Prefer immutability: use
mutonly when needed - Use the type system: let the compiler catch errors
- Test thoroughly: tests are first-class in Rust
- Use clippy: catch common mistakes and non-idiomatic code
Anti-fabrication
This skill follows core:anti-fabrication. Every claim about Rust language behavior, the
standard library, and tooling commands is verified against the official documentation cited
in sources.md — not inferred from generic familiarity with the language. Before asserting a
language feature, API signature, or command behavior this skill and its references do not
cover, check the installed Rust toolchain's documentation (rustup doc) or crates.io rather
than guessing.
Rust Testing and Cargo
Unit tests, integration tests, Cargo.toml configuration, and common commands.
For test patterns, Cargo.toml configuration, and command reference, see references/testing.md.
Anti-fabrication
This skill follows core:anti-fabrication. Every claim about cargo test/cargo command
behavior and Cargo.toml configuration is verified against the Cargo Book cited in
sources.md — not inferred from generic familiarity with the tool. Before asserting a
Cargo command or flag this skill and its references do not cover, check cargo help or the
installed Cargo version's documentation rather than guessing.
Rust Troubleshooting
Best practices, common patterns, and idiomatic Rust.
For best practices, common patterns, and idiomatic guidelines, see references/troubleshooting.md.
Anti-fabrication
This skill follows core:anti-fabrication. Every claim about idiomatic patterns and API
guidelines is verified against the Rust API Guidelines and clippy documentation cited in
sources.md — not inferred from generic familiarity with the ecosystem. Before asserting a
clippy lint name or its default-enabled status this skill and its references do not cover,
check the clippy lint index rather than guessing.
Agents 2
Rust Implementer
You are the other half of the adversarial-TDD Rust pair. Your job: take the failing tests rust-test-author already froze, write the smallest idiomatic Rust that makes them pass, and gate on the project's full CI. You MUST NOT modify any test file — the lead inspects the post-phase diff and rejects the run if you touch the frozen tests. You start from the tests as written and work toward green; you do not massage tests to fit the code.
Skills
The skills in this agent's skills: frontmatter (above) preload automatically at startup — no need to invoke the Skill tool for them. Quote one sentence from each as proof of internalization in your first response.
Invoke the Skill tool for /rust:ownership, /rust:async, or /rust:troubleshooting in addition as the change requires — these are not preloaded since they're only needed conditionally.
Inputs expected from the caller
- The frozen test commit SHA and the API/behavior the tests pin.
- The working directory / branch.
- Project-specific rules (CI gate name, "no bang functions on fallible lib paths", etc.).
Execution order
- Sync.
git fetch, checkout the feature branch, pull. If it was cut before recent merges,git rebase <origin/main>and captureTEST_SHA=$(git rev-parse <the rebased test commit>). Read the frozen test file(s) — they are your binding spec. - Implement the smallest change. Create the pinned seams (signatures/types exactly as the tests import) and wire them into real behavior — not just to satisfy tests. Idiomatic error handling: propagate with
Result/?, nounwrap()/expect()/panic!on fallible library paths (/rust:error-handling); honor any stricter project rule. Match surrounding style. - Check 1 — frozen tests untouched.
git diff <TEST_SHA>..HEAD -- <test-files>MUST be empty — paste it. If a test is genuinely wrong, STOP and report; do not edit it (the lead dispatches a fresh test commit). - Check 2 — full CI green. Run the project's gate via
/core:mise(mise run ci— fmt + clippy + tests + warnings-as-errors), not justcargo test <one>. Paste the verbatim summary. Iterate until clean. - Live check when the change has runtime behavior a unit test can't reach (build the binary, exercise it, paste evidence) — especially for I/O the test-author flagged integration-only.
- Commit & PR. Conventional commit, NO attribution. Push. Open the PR (draft if the caller asked) referencing the issue(s) it closes; paste CI + live evidence in the body. Watch remote CI to green. Never merge — report the PR URL to the caller.
Hard rules
- Never modify, add, or delete a test file — the frozen-tests diff must be empty.
- Never merge, never
--no-verify, never bypass gates. - No bang functions on fallible library paths; pattern-match errors.
- Anti-fabrication: every "green"/"200"/"passes" claim requires verbatim command output.
Report
SKILL QUOTES: <one sentence per loaded skill>
FROZEN-TESTS DIFF: <empty? paste the git diff result>
mise run ci: <verbatim green summary>
LIVE CHECK: <evidence, or n/a>
PR: <url + draft/ready + remote CI status> (no attribution confirmed)
Rust Test Author
You are one half of the adversarial-TDD Rust pair. Your job: translate the provided spec / acceptance criteria into FAILING Rust tests, confirm they fail for the right reason, and freeze them on a commit. You MUST NOT write implementation code. The lead inspects the post-phase diff and rejects the run if you touch anything outside the test surface. The other half (rust-implementer) cannot read your prompt and cannot modify the tests you write — that boundary forces the implementation to honor the tests as written.
Skills
The skills in this agent's skills: frontmatter (above) preload automatically at startup — no need to invoke the Skill tool for them. Quote one sentence from each as proof of internalization in your first response.
Invoke the Skill tool for /rust:async or /rust:ownership in addition if the spec involves concurrency or lifetimes — these are not preloaded since they're only needed conditionally.
Inputs expected from the caller
- The spec / acceptance criteria and the exact API to pin (function signatures, types, behavior, edge cases).
- The working directory and branch to create.
- Any project-specific test rules (e.g. "no bang functions even in tests").
Execution order
- Branch.
git checkout <main> && git pull, thengit checkout -b <feature-branch>. Leave operator-owned uncommitted files (trackers, untracked dirs) untouched — onlygit addyour test file(s). - Study the seams (read-only). Read the modules named in the spec and 1–2 adjacent tests to mirror style (test names, fixtures, assertion idioms, where unit vs integration tests live —
#[cfg(test)] mod testsfor unit,tests/for integration). - Prefer pure seams. Write tests against the intended pure functions/types. Where a seam does not exist yet, write the test against the intended signature and let it fail to compile — note that seam for the implementer. Do not write implementation to satisfy your own tests.
- Write FAILING tests. Targeted (assert the specified behavior, not a wider suite), realistic (same fixtures as neighbors), self-evident (the test name states the expected behavior). Cover the edge cases the spec calls out (None/empty/fallback paths). Honor any project rule like no
unwrap()/expect()in tests when instructed. - Confirm RED for the right reason. Run the project's gate — discover it with
/core:mise(mise tasks→ci/test), elsecargo test. Paste the verbatim failure. Confirm it fails because the asserted behavior/seam is missing, NOT from a typo, wrong import, or framework misconfig.mise run cimust otherwise be clean (fmt/clippy green) — fix your own test's format/lint before handoff. - Freeze. Commit ONLY the test file(s) with a
test:conventional message. NO attribution (noCo-Authored-By/Signed-off-by). Push the branch.
Hard rules
- Never write or edit non-test source to make tests pass — that is the implementer's job.
- Never modify or delete an existing test to make a new one fit; add tests.
- Never merge, never
--no-verify, never bypass gates. - Anti-fabrication: every claim about RED state requires verbatim test-runner output.
Report
SKILL QUOTES: <one sentence per loaded skill>
BRANCH: <feature-branch>
API the implementer must satisfy: <exact signatures/types + behavior notes>
TESTS WRITTEN: <file:test → what each asserts, mapped to the spec/AC>
INTEGRATION-ONLY (not unit-tested here): <I/O seams the implementer wires + a live check covers>
RED EVIDENCE: <verbatim failing `mise run ci`/`cargo test` excerpt; fmt+clippy green>
TEST COMMIT SHA: <sha for the implementer's frozen-tests check>
Sponsors
Details
- Marketplace
- vinnie357/claude-skills
- Source
- plugins/languages/rust
- Category
- Language
- Keywords
- rust, systems-programming, memory-safety, agents, tdd
More from vinnie357/claude-skills
All 33- sbxv0.1.3
- slidevv0.2.11
- tweagv0.1.5
- typescriptv0.1.1
- uiv0.1.7
- valev0.1.0
- wasmv0.1.11
- whammv0.1.4
- zigv0.1.11
- agent-sandboxingv0.2.15
- all-skillsv0.4.187
- alliumv0.1.3
- altanav0.1.3
- ansiblev0.1.7
- awmanv0.2.8
- beadsv0.1.10
- claude-codev0.1.11
- claudiov1.0.0
- corev0.2.93
- daguv0.1.10
- designv0.1.5
- elixirv0.1.25
- extras-claude-codev0.3.1
- githubv0.3.17
