clean-code-rust

clean-code-rust is a skill for Claude Code from CassetteTapeCrackle/claude-starters. It costs 44 tokens per session (350 once invoked), scanned A, original, MIT.

A set of Rust coding and review guidelines for ownership, borrowing, errors, types, iterators, and code style. It builds on Rust 2021, formatting, linting, and testing practices.

In plain words
What is it for?
Use it when writing or reviewing Rust code, designing error types, choosing between borrowed and owned values, replacing primitive IDs with newtypes, and running tests or Clippy.
Why use it?
It helps avoid common Rust problems such as unnecessary cloning, unchecked errors, unclear ownership, and unsafe code without a documented reason.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the claude-starters plugin — 9 skills, 1 command, 8 agents, 2 hooks shipped together

Good fit Use it when writing or reviewing Rust code, designing error types, choosing between borrowed and owned values, replacing primitive IDs with newtypes, and running tests or Clippy.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cassettetapecrackle/claude-starters/clean-code-rust
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add CassetteTapeCrackle/claude-starters --skill clean-code-rust
Clone the repo
git clone --depth 1 https://github.com/CassetteTapeCrackle/claude-starters

Made for: Claude Code.

Or install claude-starters, the plugin that ships this one along with the rest of its 9 skills, 1 command, 8 agents, 2 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for clean-code-rust

README.md
[![agentmods](https://agentmods.dev/badge/skills/cassettetapecrackle/claude-starters/clean-code-rust.svg)](https://agentmods.dev/skills/cassettetapecrackle/claude-starters/clean-code-rust)
Your own site
<a href="https://agentmods.dev/skills/cassettetapecrackle/claude-starters/clean-code-rust"><img src="https://agentmods.dev/badge/skills/cassettetapecrackle/claude-starters/clean-code-rust.svg" alt="Measured on agentmods" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 350 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00044 $0.00350
Opus 5 $0.00022 $0.00175
Sonnet 5 $0.00009 $0.00070
Haiku 4.5 $0.00004 $0.00035

Measured 7d ago against content hash c2d886d21303, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

clean-code-rust scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/clean-code-rust/SKILL.md · 28 lines

What it actually says

Clean-code Rust (depth)

On top of the base rules (edition 2021, clippy -D warnings, rustfmt, cargo test).

Errors

  • Libraries: define an error enum with thiserror, return Result<_, MyError>, propagate with ?.
  • Binaries: anyhow::Result + .context("..."). Never .unwrap()/.expect() outside tests or justified startup.

Ownership & borrows

  • Take &T/&mut T in function signatures; own only when you must. Return owned values.
  • Reach for Rc<RefCell<_>> only when shared mutability is genuinely required — it's a smell as a default; prefer restructuring ownership or passing &mut.
  • Newtypes (struct UserId(u64)) over bare primitives for meaning + type safety.

Style

  • Iterators/adapters over manual index loops; ? over match-on-error pyramids.
  • Derive (Debug, Clone, PartialEq) rather than hand-writing. impl Trait in args for flexibility.
  • clippy::pedantic is a good aspiration; silence lints with a reason, never blanket-allow.

Smells

  • .clone() sprinkled to dodge the borrow checker → rethink ownership.
  • unsafe without // SAFETY: → not acceptable.
  • Stringly-typed IDs/states → newtype or enum.
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 28 lines · 44 tokens per session scan A c2d886d21303

Subscribe to this mod's changes

clean-code-rust is a skill published in the GitHub repository CassetteTapeCrackle/claude-starters (1 stars, last pushed 19d ago), licensed MIT. It adds 44 tokens to every session and 350 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

spec-implement

Continue an approved Spec-backed workflow when the user says "implement", "go", "start", or "do it". After Codex Plan Mode, persist the next missing design.md or plan.json artifact and stop. When both artifacts exist, execute plan.json with TDD and report between batches.

martinffx/atelier · 63 tokens

rust-expert

This skill should be used when the user is writing, reviewing, debugging, or architecting Rust code. Detects edition and toolchain from the project. Provides expert critique covering ownership, error handling, unsafe review, async correctness, trait design, type system patterns, performance, SOLID principles, and…

mathisk2095/jko-claude-plugins · 148 tokens

rs-reviewer

Review Rust code for ownership, error handling, unsafe usage, and idiomatic patterns.

RaNDoM6913/claude-code-superkit · 20 tokens

fable-review

Use before trusting or shipping an answer, design, plan, analysis, or risky code change — when you are about to commit to it. Also when the user asks for a review, a red-team, a second opinion, or to check work adversarially. For pure code diffs, prefer a dedicated code-review command when the environment has one…

debabsah/fable-method · 86 tokens

scan-reward-hacking

Scan TypeScript code for reward hacking patterns — shortcuts that make linters pass without actually fixing type safety. This skill has a comprehensive checklist of 8 forbidden patterns with severity tuning (libraries vs apps) that you cannot reliably check on your own. ALWAYS consult this skill when the user says…

coalesce-labs/catalyst · 158 tokens

qector-architecture

QECTOR architecture overview: the Rust core / Python layer FFI boundary, the module map, the threading and memory models, the layering of services, and the bit-determinism guarantee. Load for any question about the engine's internals, where a class lives, how the GIL interacts with the decode call, or why batch decode…

GuillaumeLessard/qector-claude-plugin · 80 tokens