Skip to content
Back to skills

Rust Dev Core

ASecurity

Use when writing generic Rust, building a crate, running rustfmt or Clippy, handling Rust security, unsafe code discipline, or framework-agnostic Rust logic.

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 4, 2026
ai-agentsrustgobashtestingapidatabasesecurityperformance

Works with

  • cli
  • api

Security analysis

A100/100

Scanned December 4, 2026

npx -y skills add ddtcorex/maestro-skills --skill rust-dev-core --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rust Dev Core?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rust Dev Core
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ddtcorex-rust-dev-core/badge)](https://www.skillsdirectory.com/skills/ddtcorex-rust-dev-core)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: rust-dev-core
description: Use when writing generic Rust, building a crate, running rustfmt or Clippy, handling Rust security, unsafe code discipline, or framework-agnostic Rust logic.
compatibility: claude, codex, opencode, copilot, dsh
metadata:
  audience: developers
  workflow: rust
---

# Rust Developer Core

Topic-table shape borrowed from the `rust-best-practices` community skill pattern (style,
errors, ownership, async, testing, Clippy); `cargo-deny`/`cargo-audit` and `unsafe`/Miri
discipline below are this skill's own addition, no public source for either was found.

## When to use

Load this skill for Rust work outside a specific framework (an async runtime or web
framework's own conventions still get their own skill when one exists).

- "write generic Rust", "create a crate", "run rustfmt", "run Clippy"
- "Rust security", "unsafe code", "cargo-deny", "framework-agnostic Rust logic"

**Keep the project's existing edition, `rust-toolchain.toml` and MSRV.** Do not upgrade the
edition or add a crate just to follow an example below; an existing project's pins win.

## 1. Style and Formatting

```bash
cargo fmt --check           # CI gate, never just `cargo fmt` silently in CI
```

- `rustfmt.toml` lives at the workspace root if any non-default setting is needed; otherwise
  the default profile is the convention, do not hand-roll an alternative.
- Prefer `impl Trait` in argument position for a concrete-enough type; return `impl Trait`
  only when the concrete type is not nameable (a closure, an iterator chain).

## 2. Error Handling

- Library crates: a typed error enum with `thiserror` (`#[derive(thiserror::Error)]`), so
  callers can match on variants.
- Binary/application crates: `anyhow::Result` at the top level is fine; do not propagate
  `anyhow::Error` across a library's public API, that pushes the error-handling decision onto
  every downstream consumer.
- `unwrap()`/`expect()` outside `#[test]` is a defect unless the panic is the documented
  contract (and even then, prefer returning `Result` so the caller decides).

## 3. Ownership and Async

- Borrow before you clone; a `clone()` to silence the borrow checker is usually a sign the
  data should be restructured (an `Rc`/`Arc` boundary, or a smaller borrow scope), not a fix.
- `tokio` is the de facto async runtime; do not mix runtimes in one binary (a `tokio` task
  calling blocking `std` I/O without `spawn_blocking` stalls the whole worker thread).
- `Send`/`Sync` bounds on a public async trait's futures are not boilerplate, they are what
  let the type actually be used across an executor's worker threads; do not strip them to
  "simplify" a signature.

## 4. Clippy and Lints

```bash
cargo clippy --all-targets --all-features -- -D warnings
```

- Workspace-level `[lints]` in the root `Cargo.toml` (stable since Rust 1.74) centralizes lint
  configuration instead of a `#![warn(...)]` line repeated in every crate:

```toml
[workspace.lints.clippy]
all = "warn"
pedantic = "warn"

[workspace.lints.rust]
unsafe_code = "deny"   # override to "warn" only in the specific crate that needs unsafe
```

- Use `#[expect(lint_name, reason = "...")]` over `#[allow(...)]` where the toolchain supports
  it: `expect` fails the build if the lint stops firing, so a silenced warning cannot go stale
  silently; `allow` never notices.

## 5. Packaging and Publishing

```bash
cargo package --list         # review exactly what ships before publishing
cargo publish --dry-run      # verify it builds from the packaged tarball, not the workspace
cargo publish                # only after dry-run is clean and tag/release process says go
```

- `Cargo.toml` `version` follows semver; a breaking public API change is a major bump even in
  a pre-1.0 crate's own convention (0.x breaking = minor bump, by Cargo's semver-compatibility
  rule, not a true major).
- `[package] exclude`/`include` controls what `cargo package` ships; never ship test fixtures,
  `target/`, or local tooling scripts in the published crate.

## 6. Security and Unsafe Code

```bash
cargo audit                  # known vulnerabilities (RustSec advisory database)
cargo deny check             # licenses, bans, advisories and sources in one policy file
```

- `unsafe` blocks: smallest possible scope, a comment directly above stating the invariant
  that makes it sound (what the compiler cannot verify and why it holds here); a bare
  `unsafe { ... }` with no comment is a reviewer asking "why is this safe" with no answer.
- Run `cargo +nightly miri test` on any crate with real `unsafe` code; Miri catches undefined
  behavior (out-of-bounds, uninitialized reads, data races) that compiles and passes normal
  tests clean.
- Never parse untrusted input with hand-rolled byte manipulation inside an `unsafe` block;
  use a safe parsing crate (`nom`, `serde`) and keep `unsafe` strictly for FFI or genuine
  performance-critical sections with Miri coverage.

## 7. Testing

- `cargo test` runs unit, integration (`tests/`), and doc tests together; keep it that way,
  do not disable doctests to "speed up CI", they are the first thing to catch a stale example.
- Property testing (`proptest` or `quickcheck`) for any function with a clear invariant
  (a parser's round-trip, a sort's ordering) instead of hand-picking edge cases alone.

### Verification Checklist (Run Before Every Commit)

```bash
cargo fmt --check                                     # 1. Format clean
cargo clippy --all-targets --all-features -- -D warnings  # 2. Lint clean
cargo audit                                            # 3. No known vulnerabilities
cargo deny check                                       # 4. License/ban/source policy clean
cargo test                                             # 5. Tests green, including doctests
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.