coding-rust

Applies Rust idioms and review checks for errors, secrets, dependencies, and type design.

1|Updated Jun 23, 2026
One-click install
npx skills add https://github.com/bitranox/bitranox-skills --skill coding-rust-bitranox
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: coding-rust
Source: https://github.com/bitranox/bitranox-skills/tree/main/plugins/bitranox/skills/coding-rust
Command: npx skills add https://github.com/bitranox/bitranox-skills --skill coding-rust-bitranox

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Rust code reviews repeatedly surface the same classes of bugs: synthetic std::io::Error values that erase error types, timing-leaking secret comparisons, inline passwords visible in process lists, heavyweight crates pulled in for one narrow job, and structs whose invalid field combinations are constructible. This Skill encodes the concrete fixes for each of these findings so they are caught at writing or review time. ## Core Features & Use Cases - Error handling rules: Replace synthetic std::io::Error with dedicated thiserror enum variants and preserve the error source chain with anyhow::Context or #[from] attributes. - Secrets and credential handling: Enforce constant-time XOR-fold comparison for tokens and passwords, and prefer --password-file over inline --password CLI arguments. - Dependency and type design guidance: Choose minimal purpose-specific crates, feature-gate heavy optional dependencies, and make invalid states unrepresentable by bundling coupled fields behind a single Option. - Use Case: While reviewing a Rust CLI that accepts an auth token, apply the Skill to replace a short-circuiting byte comparison with a constant-time XOR-fold, switch the CLI to --password-file, and run cargo clippy with warnings denied before committing. ## Quick Start Review this Rust crate for error handling, secret comparison, dependency, and type design issues using the coding-rust checks.

Frequently Asked Questions about coding-rust

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle non-IO errors in Rust without std::io::Error?▼

Define a dedicated variant in the crate's own error enum using thiserror instead of fabricating a std::io::Error. Synthetic IO errors erase the type so callers cannot pattern-match; keep real IO errors behind a #[from] std::io::Error variant.

How do I compare passwords or tokens in constant time in Rust?▼

Use an XOR-fold over the byte slices combined with a length check, or a vetted crate such as subtle. A short-circuiting zip-and-all comparison leaks length and prefix information through timing.

Should a Rust CLI accept --password or --password-file?▼

Prefer --password-file PATH as the primary interface, with --password VALUE only as a convenience fallback. Inline password values are visible to every user through ps aux and /proc/<pid>/cmdline.

How do I choose between a minimal crate and a heavyweight crate in Rust?▼

Pick the minimal purpose-specific crate when you need one narrow capability, such as jpeg-encoder instead of image for JPEG-only encoding. Verify current size differences with cargo tree and the crate pages rather than trusting stale numbers.

How do I make invalid struct states unrepresentable in Rust?▼

Bundle fields that are only valid together into one struct behind a single outer Option, so the mismatched combination cannot be constructed. Two independent Option fields allow a Some/None state that is constructible but invalid.

Why does a per-crate cargo build break a Rust workspace?▼

Building only one crate with cargo build -p misses downstream consumers when you change a shared or public type. Build and test the whole workspace before pushing so dependent crates do not break silently.