loom-rust

loom-rust is a skill for Claude Code, Codex from cosmix/loom. It costs 15 tokens per session (8,195 once invoked), scanned A, original, MIT.

Guidance for writing production-quality Rust, a programming language focused on memory safety and performance. It covers ownership, lifetimes, errors, asynchronous code, workspaces, command-line tools, and data formats.

In plain words
What is it for?
Use it to build Rust libraries, applications, command-line tools, and multi-package Cargo workspaces.
Why use it?
It helps resolve difficult Rust design choices and avoid common mistakes in error handling, async code, serialization, and project organization.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/cosmix/loom/loom-rust
Any agent
npx skills add cosmix/loom --skill loom-rust
Clone the repo
git clone --depth 1 https://github.com/cosmix/loom

Made for: Claude Code, Codex.

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 loom-rust

README.md
[![agentmods](https://agentmods.dev/badge/skills/cosmix/loom/loom-rust.svg)](https://agentmods.dev/skills/cosmix/loom/loom-rust)
Your own site
<a href="https://agentmods.dev/skills/cosmix/loom/loom-rust"><img src="https://agentmods.dev/badge/skills/cosmix/loom/loom-rust.svg" alt="Measured on agentmods" height="20"></a>
Per session 15 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 8,195 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
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 $0.00015 $0.08195
Opus 5 $0.00008 $0.04097
Sonnet 5 $0.00003 $0.01639
Haiku 4.5 $0.00002 $0.00819

Measured today against content hash 9f23c563db39, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

loom-rust scanned grade A with 1 finding 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 today.

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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

for url in urls { set.spawn(fetch(url)); }
skills/loom-rust/SKILL.md · 532 lines

How it starts

The opening of the file, as written. The whole thing — 532 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Rust Language Expertise

Overview

Idiomatic, production-quality Rust for an engineer who already knows ownership/borrowing. This skill is decision rules, gotchas, and the traps that cost hours: async/Send correctness, error-handling architecture, serde pitfalls, and edition-2024 features. Assumes the borrow checker itself is not the problem — using it well is.

Error Handling: anyhow vs thiserror

The decision rule: will a caller ever match on the error to recover? → thiserror (concrete, matchable enum). Does the error only bubble up to be logged/reported? → anyhow (type-erased, context chains). Never put anyhow::Error in a library's public API — it erases the type and denies callers any recovery. Libraries expose thiserror enums; binaries/apps consume with anyhow.

// Library boundary: thiserror. Each variant = a distinct, matchable failure mode.
use thiserror::Error;

#[derive(Error, Debug)]
pub enum ParseError {
    #[error("IO error: {0}")]
    Io(#[from] std::io::Error), // #[from] gives `?` conversion for free
    #[error("invalid syntax at {line}:{column}: {message}")]
    Syntax { line: usize, column: usize, message: String },
    #[error("unexpected token: expected {expected}, found {found}")]
    Unexpected { expected: String, found: String },
}
// Application code: anyhow. `?` unifies heterogeneous errors; .context adds a chain.
use anyhow::{Context, Result, bail, ensure};

fn load_config(path: &str) -> Result<Config> {
    let content = std::fs::read_to_string(path)
        .with_context(|| format!("reading config: {path}"))?; // with_context: lazy, use for allocating msgs
    let config: Config = toml::from_str(&content).context("parsing config TOML")?; // context: eager literal
    ensure!(!config.name.is_empty(), "config name cannot be empty"); // returns Err on false
    if config.port == 0 { bail!("port must be non-zero"); }          // early return with Err
    Ok(config)
}
  • context (eager, takes a value) vs with_context(|| ...) (lazy closure) — use with_context whenever the message allocates (format!), else you pay the cost on the success path too.
  • #[from] generates From for ?; #[error(transparent)] forwards Display/source to the inner error (use for a pass-through variant).
  • Option→Result: .ok_or_else(|| Error::NotFound(id.to_string()))?. Prefer ok_or_else (lazy) over ok_or when the error allocates.
  • Collecting: iter.map(f).collect::<Result<Vec<_>>>() stops at the first Err; collect into Vec<Result<_>> to keep all outcomes.
  • thiserror 2.0: must be a direct dependency (not transitive); format strings dropped raw-identifier support ({type}, not {r#type}); field trait bounds no longer inferred when shadowed by a format arg. New: no_std via default-features = false, out-of-line #[error(fmt = path)], per-variant #[error(transparent)]. Pin thiserror = "2".

Read the full file on GitHub · 532 lines

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. today Changed · -43 tokens per session 9f23c563db39
  2. 4d ago First seen · 532 lines · 58 tokens per session scan A c61aee688519

Subscribe to this mod's changes

loom-rust is a skill published in the GitHub repository cosmix/loom (54 stars, last pushed today), licensed MIT. It adds 15 tokens to every session and 8,195 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.