Execution. Use whenever writing, editing, implementing, or refactoring Rust crates, .rs files, Cargo.toml, or cargo tests to enforce ownership, invariants, control flow, and verification.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Rust Coder?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/dankosik-rust-coder)
---
name: rust-coder
description: "Execution. Use whenever writing, editing, implementing, or refactoring Rust crates, .rs files, Cargo.toml, or cargo tests to enforce ownership, invariants, control flow, and verification."
---
# Rust Coder
**Execution.** Establish the observable result, its invariants, and distinguishable effect outcomes first, then choose representations and operations that make those facts visible. Resolve precedence up front whenever multiple rules apply to the same input or transition. Load matching domain skills before designing code: `rust-idiomatic` for types, options, ownership, and API signatures, `rust-errors` for failure contracts, `rust-tokio` for async cancellation or locks, `rust-performance` for hot paths, and `rust-structural-quality` for modules, helpers, or wrappers.
**Boundary completion.** Read the affected owner and its callers against accepted behavior, treating existing code as convention rather than proof that a current defect must stay. Locate composition, configuration, readiness, provider, and feature owners in the [repository architecture](../../../docs/repo-architecture.md), and complete the full operation through its boundary and failure path.
**Existing guarantees and delegation.** Lean on invariants the representation already enforces—ordering, uniqueness, contiguous storage, or `&mut` exclusivity—before adding manual coordination. Before writing a non-domain parser, scanner, encoder, retry/backoff loop, jitter/RNG, secret buffer, compact collection, lock/cache wrapper, `Drop` guard, or boilerplate `Default`/`Debug`/delegation/`Pin` impl, check [workspace utility crates](../rust-dependencies/references/workspace-crates.md), `std`, and resolved crate features first. Delegate generic mechanics to an owner with matching inputs, failure precedence, cancellation/drop timing, time precision, and bytes while keeping domain policy local; consult `rust-dependencies` when enabling features, adding crates, or pinning a boundary divergence with a test, and preserve fixed public APIs or `std`-only constraints.
**Control flow.** Push validation and mode branching to the owning boundary so inner functions run straight-line over already-checked inputs, and make each function body read by its domain role through flat `match` arms, `let ... else`, early returns, `let x = match/if`, and role-accurate names. List every variant explicitly when matching closed workspace or upstream enums whose additions change handling rather than absorbing future cases into a catch-all arm.
**Data flow and refactoring.** Return newly computed values by default, taking `&mut` caller storage when in-place update or buffer reuse is the contract. Iterate at the decision's natural unit—item, window, run, or batch—streaming directly where slice materialization adds only allocation, and separate pure state transitions from I/O (Sans-I/O) when that yields a cleaner, testable core. When refactoring existing code, pin observable behavior and suspicious quirks with tests before changing structure, leave unrelated formatting and untouched lines alone, and remove defects at their cause rather than rewriting around a lint (such as replacing `unwrap()` with `unwrap_or_else(|| panic!(...))`).
**Simpler alternatives and races.** Compare the central design choice against the strongest simpler representation satisfying the same contract, keeping only structure that enforces an invariant or cost bound. When an external or destructive effect depends on an earlier check, identify the lock, transaction, or conditional write that keeps the observation valid through execution, preserving failure order, ownership transfer, and completion obligations.
**Verification.** Match repository naming, lint, and comment policies: carry preconditions, effects, failures, and lifetimes in names, types, and tests rather than comments, and delete explanatory comments on touched items. Avoid runtime `.unwrap()`, `.expect()`, and `panic!` in production code—propagate typed `Result` or prove invariants in types (using `let _ = writeln!(...)` for infallible `String` formatting). Consult `rust-testing` for proving layers and Mutation Mental Tests, `rust-review` for read-only reviews, and verify edited code compiles cleanly under `cargo clippy` and passes targeted tests.