katgpt-rs: Skill for Claude Code

.agents/skills/rust-optimize/SKILL.md

rust-optimize is a skill for Claude Code from katopz/katgpt-rs. It costs 31 tokens per session (8,653 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 Code

Written for Claude Code: disable-model-invocation in frontmatter. Also seen: installed under .agents/ (shared by several agents).

This is katopz/katgpt-rs's own configuration. It tells Claude Code how to work on katgpt-rs itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything katgpt-rs configures →

Reuse

Borrowing it

Nothing to install: this file belongs to katopz/katgpt-rs. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/katopz/katgpt-rs/develop/.agents/skills/rust-optimize/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/katopz/katgpt-rs

Made for: Claude Code.

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/github.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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for rust-optimize

Your own site · 80×15
<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="Reviewed on agentmods" width="80" 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 8,653 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium analysis-evasion · line 1
    Suspicious Unicode normalization or mixed-script content
    Fix: Review the flagged content for security risks. Ensure no credentials, secrets, or sensitive data are exposed.
How audits are shown
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.00031 $0.08653
Opus 5.5 $0.00012 $0.03461
Sonnet 5.5 $0.00006 $0.01731
Haiku 4.5 $0.00003 $0.00865

Measured 3d ago against content hash 0a68e2254be9, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 3d 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.

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 · 591 lines

How it starts

The opening of the file, as written. The whole thing — 591 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
  12. Sorted indexes & scans (see § Sorted Indexes & Scans for details): seek to a prefix (never skip-walk), visitor/borrowing scans (0 alloc), bulk insert via sorted merge, order maintained at mutation not per-read, sort keys computed once, early-exit bounded scans

Read the full file on GitHub · 591 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. 3d ago Changed · +35 lines 0a68e2254be9
  2. 1mo ago Changed · +1 lines f5751ef61004
  3. 2mo 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 (140 stars, last pushed today), licensed MIT. It adds 31 tokens to every session and 8,653 once invoked, about $0.0001 per session on Opus 5.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.