Skip to content
Back to skills

Rust Crates

ASecurity

Write and change Rust code: ownership-friendly APIs, error handling, async, clippy and tests

  • 7 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 30, 2026
ai-agentsrustgobashapi

Works with

  • cli
  • api

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add ansh44233/forge --skill rust-crates --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rust Crates?

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

Security grade badge for Rust Crates
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ansh44233-rust-crates/badge)](https://www.skillsdirectory.com/skills/ansh44233-rust-crates)

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
---
description: Write and change Rust code: ownership-friendly APIs, error handling, async, clippy and tests
profile: standard
languages: rust
tags: rust
---

# Rust crates

Use in projects with `Cargo.toml`.

## Errors
- Libraries: typed errors with `thiserror`. Applications: `anyhow::Result` with `.context("what failed")`.
- Use `?` for propagation. `unwrap()` / `expect()` only where failure is a bug, and say why in the `expect` message.

## APIs
- Take borrowed inputs (`&str`, `&[T]`, `impl AsRef<Path>`) and return owned outputs. Avoid cloning to silence the borrow checker; restructure ownership instead.
- Prefer iterators over index loops. Use `Option`/`Result` combinators where they read clearly.
- Derive `Debug` on public types; implement `Display` for user-facing errors.

## Async
- Do not hold a `std::sync::Mutex` guard across `.await`; use `tokio::sync::Mutex` or restructure.
- Never block inside async code (`std::thread::sleep`, blocking I/O, heavy CPU); use `tokio::task::spawn_blocking`.
- Bound concurrency (semaphores, `buffer_unordered(n)`) instead of spawning unbounded tasks.

## Unsafe
Avoid new `unsafe`. If unavoidable, keep the block minimal and add a `// SAFETY:` comment stating the invariants.

## Verify
```bash
cargo fmt --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-features
```

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.