rust-optimize

rust-optimize is a skill for Claude Code, Codex from katopz/katgpt-rs. It costs 31 tokens per session (7,312 once invoked), scanned A, original, MIT.

A looping workflow for finding and applying improvements to Rust source code. Rust is a programming language commonly used for fast, compiled software.

In plain words
What is it for?
Use it when optimizing Rust files, checking loops and data lookups, reducing allocations, improving memory layout, choosing suitable numeric types, and reviewing concurrency, SIMD, or caching.
Why use it?
It provides a repeatable checklist for spotting inefficient algorithms, unnecessary memory use, costly arithmetic, and concurrency or caching issues.

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/katopz/katgpt-rs/rust-optimize
Any agent
npx skills add katopz/katgpt-rs --skill rust-optimize
Clone the repo
git clone --depth 1 https://github.com/katopz/katgpt-rs

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/katopz/katgpt-rs/rust-optimize.svg)](https://agentmods.dev/skills/katopz/katgpt-rs/rust-optimize)
Your own site
<a href="https://agentmods.dev/skills/katopz/katgpt-rs/rust-optimize"><img src="https://agentmods.dev/badge/skills/katopz/katgpt-rs/rust-optimize.svg" alt="Measured on agentmods" height="20"></a>
Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 7,312 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.00031 $0.07312
Opus 5 $0.00015 $0.03656
Sonnet 5 $0.00006 $0.01462
Haiku 4.5 $0.00003 $0.00731

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

Security

Grade A, and why

rust-optimize 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.

- **Boundary-vs-volume (Stokes / divergence theorem)**: to compute a region's total mass / energy / activation magnitude, integrate over the boundary `∂M` (surface area, `O(n^{(d-1)/d})` cells) instead of the interior `M
.agents/skills/rust-optimize/SKILL.md · 556 lines

How it starts

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

Rust Optimization

Optimize *.rs files in the target scope using the checklist below. This is a LOOP. You keep optimizing until you cannot find anything to optimize.

Termination

After each turn, end your response with exactly one of:

  • Continue optimizing remaining files. — you made code changes this turn
  • No optimizations this pass. — you read files but changed nothing

If you only summarized what you read without changing code, say "no optimizations this pass".

Checklist

  1. Complexity: O(n) scan → O(1) lookup, merge HashMap lookups, merge loops, boundary-vs-volume (Stokes/divergence theorem: integrate boundary O(n^{(d-1)/d}) instead of interior O(n) for low-dim d≤3 region mass queries — curse-of-dim caps it at d≤3)
  2. Allocations: String&'static str, pre-allocate, eliminate .to_string()
  3. Layout: field reorder (u64→u32→u8), #[repr(u8)] enums, remove #[repr(C)]
  4. Arithmetic: f32 counters → u32/u64
  5. Iterators: fix double chunks_exact(), use index arithmetic
  6. Concurrency: Arc<RwLock<HashMap>>papaya, Mutex<u32>AtomicU32
  7. SIMD: chunked loops, branch-free inner loops
  8. Caching: pre-compute lookup tables, compute once not N×M
  9. Errors: unwrap()?, let _ =.log_err()
  10. Bevy / Real-time loop (see § Bevy / Real-time Loop for details):
    • Event loop spin: WinitSettings::default() (Continuous) pegs CPU at 100% even idle — switch to UpdateMode::reactive_low_power(max_wait) matching tick rate
    • Vsync ≠ event loop: PresentMode::Fifo controls GPU only, independent of CPU loop spin
    • Static geometry: bake to LineList / TriangleList mesh once, NEVER redraw via gizmos.line() per-frame (each call is CPU + per-frame buffer grow)
    • Asset lifecycle: despawning a Bevy Entity does NOT release its Assets<Mesh> / Assets<StandardMaterial> handles — call meshes.remove(handle.0.id()) + materials.remove(...) on despawn or leak indefinitely (regrow-on-new-EntityId patterns leak ~N assets per cycle)
    • GUI repaint storms: bevy_egui sets set_request_repaint_callback that fires bevy_winit::WakeUp on delay.is_zero() — bypasses reactive max_wait and spins the loop. Diagnose via in-process perf overlay before assuming the engine itself is the hog.
    • Frame-rate cap fallback: a Last-schedule std::thread::sleep system capped at e.g. 60 FPS is a belt-and-suspenders defense when vsync + reactive mode somehow don't throttle
  11. Perf diagnosis: ship an in-process perf overlay (sysinfo for CPU/RAM + Bevy's Time::delta() for FPS) inside the GUI itself — external ps sampling misses focused-window swings and requires keeping a terminal attached

Read the full file on GitHub · 556 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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 · +1 lines f5751ef61004
  2. 5d ago First seen · 555 lines · 31 tokens per session scan A 1039c342e37a

Subscribe to this mod's changes

rust-optimize is a skill published in the GitHub repository katopz/katgpt-rs (98 stars, last pushed today), licensed MIT. It adds 31 tokens to every session and 7,312 once invoked, about $0.0002 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.

Related

Other skills, from other repositories

lint-js

Lint JS/TS code only. Use before opening a PR when only JavaScript or TypeScript files were changed (no Rust).

denoland/deno · 29 tokens

rust-code-quality

Run a focused Rust quality review when the user requests one, when reviewing a Rust PR/commit, or when another selected review workflow delegates Rust-specific checks. Do not auto-load for every implementation edit.

rustfs/rustfs · 44 tokens

rust-pro

Master modern Rust (2024 edition) with async patterns, advanced type system features, and production-ready systems programming. Expert in the current Rust ecosystem including Tokio, axum, and modern crates. Use PROACTIVELY for Rust development, performance optimization, or systems programming.

vudovn/ag-kit · 58 tokens

switchyard-rust-review

Review Switchyard Rust changes for correctness and maintainability. Use for pull requests or diffs touching crates, PyO3 bindings, async runtime behavior, streaming, protocol types, translation, algorithms, or LLM clients.

NVIDIA-NeMo/Switchyard · 50 tokens

dd-code-generation

Use pup CLI for immediate Datadog operations or generate code for integration into applications.

DataDog/pup · 16 tokens

bevy-ecs

Structure a Bevy app around its Entity Component System: build the App with plugins, define Component/Resource types, write systems with Query/Res/Commands, filter and order systems, and use the Time resource for frame-rate-independent motion. Use when building or debugging a Bevy game in Rust — when the user mentions…

gamedev-skills/awesome-gamedev-agent-skills · 100 tokens