agent-instructions
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what does not, structure, and…
Use when writing Rust or resolving borrow-checker, lifetime, and trait errors. Covers ownership models, error handling with thiserror and anyhow, async with Tokio, and safe abstractions over unsafe code.
$ npx -y skills add nimadorostkar/Claude-Skills-collection --skill rust --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/rustContext preview
The summary Claude sees to decide when to auto-load this skill.
Use when writing Rust or resolving borrow-checker, lifetime, and trait errors. Covers ownership models, error handling with thiserror and anyhow, async with Tokio, and safe abstractions over unsafe code.
name: rust description: Use when writing Rust or resolving borrow-checker, lifetime, and trait errors. Covers ownership models, error handling with thiserror and anyhow, async with Tokio, and safe abstractions over unsafe code. metadata: category: languages version: 1.0.0 tags: [rust, ownership, lifetimes, tokio, error-handling]
Write Rust that satisfies the borrow checker by design rather than by fighting it. Ownership is a modeling decision made before the code is written, not a compiler obstacle discovered afterward.
1. **Model ownership first** — Decide who owns each value and how long it lives before writing the signature. 2. **Design the error type** — A library's error enum is public API. Enumerate failure modes explicitly. 3. **Implement** — Start with owned values and clones. Optimize to borrows only where profiling or ergonomics justify it. 4. **Constrain generics late** — Write it concrete, then generalize if a second caller appears. 5. **Gate** — `cargo clippy -- -D warnings`, `cargo fmt --check`, `cargo test`, `cargo deny check`.
**Library error type:**
use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum StoreError {
#[error("key not found: {0}")]
NotFound(String),
#[error("storage backend unavailable")]
Unavailable(#[source] std::io::Error),
#[error("value for {key} exceeds {limit} bytes")]
TooLarge { key: String, limit: usize },
}
pub fn get(key: &str) -> Result<Vec<u8>, StoreError> {
std::fs::read(key).map_err(|e| match e.kind() {
std::io::ErrorKind::NotFound => StoreError::NotFound(key.to_owned()),
_ => StoreError::Unavailable(e),
})
}**Async with timeout and cancellation:**
use tokio::time::{timeout, Duration};
pub async fn fetch_with_deadline(url: &str) -> anyhow::Result<String> {
let body = timeout(Duration::from_secs(5), reqwest::get(url))
.await
.context("request timed out after 5s")?
.context("request failed")?
.text()
.await?;
Ok(body)
}A curated library of 137 production-grade skills for Claude and other AI coding agents. Every skill follows one structure, speaks with one voice, and earns its place by changing what the agent does.
Repo: nimadorostkar/Claude-Skills-collection
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what does not, structure, and…
Use when an agent needs state that survives a session or a context compaction. Covers what to persist, file-based memory, structuring notes for retrieval, and…
Use when automating agent behavior with lifecycle hooks. Covers hook events, deterministic enforcement of rules the model should not be trusted to remember,…
Use when packaging skills, commands, hooks, and MCP servers into a distributable plugin. Covers manifest structure, bundling, versioning, testing, and…
Use when writing a new skill for an AI agent. Covers scoping, description writing for reliable triggering, progressive disclosure, and the difference between a…
Use when reviewing or improving an existing agent skill. Covers triggering accuracy, content quality, redundancy with the base model, and measuring whether the…