rust
Idiomatic programming style, patterns, and conventions for Rust development.
Skill by nrdxp
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/nrdxp-rust
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: testing, writing, agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/rust
What's inside
- Skill name
rust- Description
- Idiomatic programming style, patterns, and conventions for Rust development. Trigger when: - Writing, refactoring, reviewing, or debugging Rust code. - Files matching the pattern **/*.rs (including Cargo.toml, Cargo.lock) are in the workspace or referenced. - Tasks involve: cargo build, cargo clippy, cargo test, cargo check, rustc. - Prompt contains keywords: rust, cargo, clippy, borrow checker, lifetime, struct, enum, impl, Option, Result, match, unwrap, unsafe.
- License
- MIT
- Instructions
- 266 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Rust Language Idioms
Work _with_ the language, not against it. Embrace ownership, the borrow checker, and the type system.
---
## Core Values
- **Safety:** Lean on the compiler's guarantees. Avoid `unsafe` unless absolutely necessary.
- **Memory Efficiency:** Zero-cost abstractions. Avoid unnecessary allocations.
- **Ergonomics:** APIs should be intuitive and hard to misuse.
---
## API Design
### Naming Conventions
| Prefix | Semantics | Cost | Example |
| :------ | :--------------------------- | :-------- | :---------------------------- |
| `as_` | Borrowed view, no allocation | Cheap | `as_ref()`, `as_slice()` |
| `to_` | Creates new owned value | Expensive | `to_string()`, `to_vec()` |
| `into_` | Consumes self, transforms | Cheap | `into_iter()`, `into_inner()` |
### Argument Flexibility
Accept generic bounds instead of concrete types:
```rust
// ❌ Inflexible
fn read_file(path: &PathBuf) -> Result<String>
// ✅ Accepts &str, String, PathBuf, &Path
fn read_file(path: impl AsRef<Path>) -> Result<String>
```
Common patterns:
- `impl AsRef<Path>` — for paths
- `impl AsRef<str>` — for string-like types
- `impl Into<String>` — when ownership is needed
### Constructors
- **Simple:** `T::new()` for basic instantiation
- **Configured:** `T::with_capacity(n)` for single-option variants
- **Complex:** Use the **Builder pattern** for 3+ optional fields
```rust
let config = ConfigBuilder::new()
.port(8080)
.timeout(Duration::from_secs(30))
.build()?;
```
### Monomorphization Control
For widely-used generic functions, consider splitting:
```rust
// Public generic wrapper (thin)
pub fn process(path: impl AsRef<Path>) -> Result<()> {
process_inner(path.as_ref())
}
// Private concrete implementation (bulk of logic)
fn process_inner(path: &Path) -> Result<()> {
// ...
}
```
This reduces binary bloat and compile times.
---
## Error Handling
### The `?` Operator
Use `?` to propagate errors. It:
1. Unwraps `Ok(value)` or returns `Err(e)` early
2. Automatically converts via `From` trait
### Library vs. Application Errors
| Context | Approach | Crate |
| :--------------- | :------------------------ | :---------- |
| **Libraries** | Custom enum error types | `thiserror` |
| **Applications** | Boxed errors with context | `anyhow` |
```rust
// Library: structured, matchable errors
#[derive(Debug, thiserror::Error)]
pub enum ParseError {
#[error("invalid header at byte {0}")]
InvalidHeader(usize),
#[error("unexpected EOF")]
UnexpectedEof,
}
// Application: rich context chains
fn main() -> anyhow::Result<()> {
let config = load_config()
.context("failed to load configuration")?;
Ok(())
}
```
### Parse, Don't Validate
Encode invariants in the type system:
```rust
// ❌ Stringly-typed, requires repeated validation
fn send_email(to: &str) -> Result<()>
// ✅ Invalid states are unrepresentable
fn send_email(to: EmailAddress) -> Result<()>From nrdxp/predicate, MIT.
More from nrdxp/predicate
- 0.591score
refine
nrdxp
SOP for the automated refinement loop (/refine) workflow.
SkillBFreshness: B★ 10Claude Code +9 - 0.590score
remediation
nrdxp
Discipline for repairing a false claim once it has propagated: select what depends on it, produce a replacement, and accept with an expiring verdict.
SkillBFreshness: B★ 10Claude Code +9 - 0.590score
record
nrdxp
Durable categorized record-keeping for any predicate-enabled walk.
SkillBFreshness: B★ 10Claude Code +9 - 0.590score
boundary
nrdxp
Normative sufficiency conditions for Initial Boundary Conditions (IBCs) and the SOP for the cheap-tier boundary refinement loop (/boundary).
SkillBFreshness: B★ 10Claude Code +9 - 0.590score
council
nrdxp
The LAW a council SEAT is bound by — deliberation protocol, pact obligations, governance, and decision-ledger recording — the discipline half of a seat.
SkillBFreshness: B★ 10Claude Code +9 - 0.545score
commit-hygiene
nrdxp
Rules, conventions, and constraints for formatting git commit messages and committing at logical boundaries.
SkillCFreshness: C★ 10Claude Code +9 - 0.545score
chronicle
nrdxp
Maintain and update the persistent project chronicle (docs/chronicle.md).
SkillCFreshness: C★ 10Claude Code +9 - 0.545score
security-audit
nrdxp
Phased risk-centric security assessment framework.
SkillCFreshness: C★ 10Claude Code +9 - 0.540score
ai-audit
nrdxp
SOP for auditing AI-generated code.
SkillCFreshness: C★ 10Claude Code +9 - 0.540score
formal-foundations
nrdxp
Mathematical foundations, logical structures, and formal verification guidance.
SkillCFreshness: C★ 10Claude Code +9 - 0.540score
core
nrdxp
SOP for the micro-execution C.O.R.E.
SkillCFreshness: C★ 10Claude Code +9 - 0.540score
engineering
nrdxp
Core technical, safety, and maintainability rules for codebase edits.
SkillCFreshness: C★ 10Claude Code +9
Signals
- Stars
- 10
- Forks
- 2
- Open issues
- 1
- Last commit (this folder)
- Jun 20, 2026 (4 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/nrdxp/predicate
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from nrdxp
- 0.591score
refine
nrdxp
SOP for the automated refinement loop (/refine) workflow.
SkillBFreshness: B★ 10Claude Code +9 - 0.590score
record
nrdxp
Durable categorized record-keeping for any predicate-enabled walk.
SkillBFreshness: B★ 10Claude Code +9 - 0.590score
boundary
nrdxp
Normative sufficiency conditions for Initial Boundary Conditions (IBCs) and the SOP for the cheap-tier boundary refinement loop (/boundary).
SkillBFreshness: B★ 10Claude Code +9 - 0.590score
remediation
nrdxp
Discipline for repairing a false claim once it has propagated: select what depends on it, produce a replacement, and accept with an expiring verdict.
SkillBFreshness: B★ 10Claude Code +9 - 0.590score
council
nrdxp
The LAW a council SEAT is bound by — deliberation protocol, pact obligations, governance, and decision-ledger recording — the discipline half of a seat.
SkillBFreshness: B★ 10Claude Code +9 - 0.545score
commit-hygiene
nrdxp
Rules, conventions, and constraints for formatting git commit messages and committing at logical boundaries.
SkillCFreshness: C★ 10Claude Code +9
Cite this page
rust skill. Agent Mart. https://agentmart.dev/skills/nrdxp-rust (last updated 2026-10-24)