Przejdź do treści
Biblioteka skilli
Programowanie · Przegląd i audyt

rust-optimizer

/rust-optimizer

Audytuje projekty w Rust pod kątem szybkości, pamięci i rozmiaru, mierzy wyniki przed i po, a zmiany wdraża po akceptacji planu.

Licencja
MIT
Ostatnia zmiana repozytorium
04.11.2026

Ocena i bezpieczeństwo

95/ 100Klasa: dobry
Format20 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
11
Skrypty
1
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 04.11.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co sprawdzić przed instalacją
  • 1 skrypt w paczce. Przejrzyj je przed instalacją, bo Claude może je uruchomić.

Skrypty: scripts/audit.py

Co robi i kiedy

Audytuje projekty w Rust pod kątem szybkości, pamięci i rozmiaru, mierzy wyniki przed i po, a zmiany wdraża po akceptacji planu.

Oryginalny opis (EN)

Audit and optimize Rust projects (binaries, libraries, async services on tokio/axum/actix, CLIs, workspaces) for runtime speed, memory, binary size, compile time, async correctness, database latency and safety, with real before/after measurement. Always produces a written findings report and a fix plan for approval before touching any code. Use this whenever the user mentions a slow Rust program, high memory or allocation counts, large binaries, slow `cargo build`, release profile / LTO / codegen-units, flamegraphs, criterion/divan benchmarks, tokio blocking or deadlocks, `.clone()` overuse, c

Jak działa

  1. Workflow
  2. Principles
Sekcje z nagłówków SKILL.md, w oryginale · 62 linii, 746 słów
Podgląd SKILL.md
---
name: rust-optimizer
description: Audit and optimize Rust projects (binaries, libraries, async services on tokio/axum/actix, CLIs, workspaces) for runtime speed, memory, binary size, compile time, async correctness, database latency and safety, with real before/after measurement. Always produces a written findings report and a fix plan for approval before touching any code. Use this whenever the user mentions a slow Rust program, high memory or allocation counts, large binaries, slow `cargo build`, release profile / LTO / codegen-units, flamegraphs, criterion/divan benchmarks, tokio blocking or deadlocks, `.clone()` overuse, clippy/unsafe review, or "optimize my Rust code" -- even if they don't say "audit" or "optimize".
---

# Rust Optimizer

Audit a Rust codebase, report what is slow and why, agree a plan with the user, then fix it. Order matters: evidence first, approval second, edits last. Performance edits in Rust often change ownership, lifetimes, public APIs or `unsafe` surface, so nothing is edited before the user approves.

## Workflow

### 1. Scope (quick)

- Find the root: the `Cargo.toml` (workspace root if `[workspace]`). Note toolchain (`rust-toolchain.toml`, `rustc --version`), edition, MSRV (`rust-version`), target OS.
- Run `python <skill-dir>/scripts/audit.py <project-root>` -- static scan of Cargo manifests (release profile, allocator, feature bloat, deprecated deps) and `.rs` sources (blocking in async, locks across await, regex in loops, clone-in-loop, unwrap density, unsafe, N+1 hints) with file:line evidence. `--json` for post-processing.
- Classify the workload before advice: CPU-bound, IO/async service, memory-bound, startup/binary-size sensitive, or build-time pain. Advice differs completely. Ask the user which one hurts if unclear.
- Read `references/tooling.md` once to know which measuring tools are installed (`cargo flamegraph`, `samply`, `hyperfine`, `cargo bloat`, `cargo build --timings`) and what to propose installing.

### 2. Audit

The script finds cheap leads; you find the rest by reading the hot path. Read the root `Cargo.toml`, `main.rs`/`lib.rs`, the 3-5 functions the user cares about or a profile points at. Load only the references that apply:

| Area                                                              | Reference                       |
| ----------------------------------------------------------------- | ------------------------------- |
| Release profile, LTO, PGO, allocator, binary size, compile time   | `references/build-profile.md`   |
| Allocations, clones, iterators, collections, serde, data layout   | `references/memory-data.md`     |
| tokio/async: blocking, locks, channels, cancellation, rayon       | `references/async-concurrency.md` |
| HTTP services, sqlx/diesel, pooling, N+1, tracing overhead        | `references/web-db.md`          |
| unsafe, panics, clippy lints, cargo-audit/deny, semver, MSRV      | `references/safety-quality.md`  |
| Profilers, benchmarks, how to measure honestly                    | `references/tooling.md`         |

**Measure, never guess.** Debug builds are meaningless for performance: only `--release` counts. Profile before editing; a flamegraph of the real workload beats any checklist. If a tool is missing or the workload can't be run, say measurement wasn't possible instead of inventing numbers.

Mark each finding **Confirmed** (profile/code evidence) or **Suspected** (needs measuring).

### 3. Report

Fill `assets/report-template.md`, save as `RUST_OPTIMIZATION_REPORT.md` in the project root, and show the user. 5-line summary, findings table sorted by impact/effort, then per-finding detail (evidence, why it hurts, fix, risk, API/semver impact). Group related findings.

### 4. Plan -- then stop for approval

Use plan mode: `EnterPlanMode` (load with ToolSearch if deferred), write the plan, present with `ExitPlanMode`; if unavailable, show it in chat and wait for an explicit "go". Structure:

1. **Quick wins** -- `[profile.release]` tuning, allocator swap, feature trimming, `with_capacity`, hoisting `Regex::new`, `spawn_blocking` for blocking calls. Low risk, no API change.
2. **Structural** -- remove clones via borrowing/`Cow`/`Arc`/`Bytes`, iterator rewrites, async lock redesign, batching queries, channel backpressure. Name every behaviour change.
3. **Heavy** -- dependency swaps, PGO/BOLT, public API changes, `unsafe` or SIMD, architecture changes. Separately approved; `unsafe` only with a measured win and a safety comment.
   Each step: files touched, expected effect, how to verify, how to roll back.

### 5. Fix

Only approved items, small groups. After each group run `cargo fmt --check`, `cargo clippy --all-targets -- -D warnings` (if the project already passes it), and `cargo test`. A break must trace to one change. Do not mix a toolchain/edition upgrade with optimization edits. If something turns out riskier than planned (API break, changed error semantics, new `unsafe`), stop and ask.

### 6. Verify and wrap up

Re-measure with the same command and inputs as before; report before/after (wall time via `hyperfine`, bench medians, peak RSS, allocation counts, binary size, `cargo build --timings` total). State plainly what could not be measured. End with deferred items and one suggested next step.

## Principles

- **Algorithm and data structure first, micro-tweaks last.** An O(n^2) scan or a `Vec::contains` in a loop dwarfs any LTO flag.
- **Allocation is the usual Rust cost.** Count it (`dhat`, `heaptrack`) before rewriting; fix the top call sites, not every `.clone()`.
- **A clone is fine until the profile says otherwise.** Don't contort lifetimes for cold code; readability is a feature.
- **Async is not parallelism.** Blocking inside async tasks and locks held across `.await` are correctness bugs first, performance bugs second.
- **Release-mode, representative data, warm caches, several runs.** One run on a laptop under load proves nothing; report medians.
- **`unsafe` needs proof.** Require a benchmark showing the win, an invariant comment, and miri/tests; otherwise refuse.
- **Docs move.** For crate APIs and defaults, check docs.rs for the version in `Cargo.lock` instead of relying on memory.
Pliki w paczce (11)
  • LICENSE 1 KB
  • README.md 1 KB
  • SKILL.md 6 KB
  • assets/report-template.md 1 KB
  • references/async-concurrency.md 3 KB
  • references/build-profile.md 3 KB
  • references/memory-data.md 3 KB
  • references/safety-quality.md 3 KB
  • references/tooling.md 2 KB
  • references/web-db.md 3 KB
  • scripts/audit.py 10 KB

Wersje

W bazie nie ma innych skilli o nazwie rust-optimizer.

Migawka bazy z 13.11.2026 · wersja paczki 4122eba565ec (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 85go-optimizer
    Audytuje projekty w Go pod kątem szybkości, alokacji, współbieżności, opóźnień bazy danych i rozmiaru binarki, z pomiarami przed i po oraz planem poprawek.
  • 100rust-pro
    Pisze i optymalizuje kod Rust 2024 z Tokio i axum: async, typy, błędy i wydajność.
  • 100rust-performance
    Mierzy i profiluje Rust pod kątem opóźnień, CPU, pamięci i rozmiaru binarki, z benchmarkami Criterion, DHAT i testami regresji.
  • 100rust-axum-tokio
    Buduje typowo bezpieczne backendy webowe w Rust na runtime Tokio i frameworku Axum.
  • 85node-optimizer
    Audytuje usługi, API, CLI i workery Node.js pod kątem blokowania pętli zdarzeń, pamięci, współbieżności i opóźnień, z pomiarami przed i po.
  • 100rust-axum-service-engineering
    Buduje i wysyła usługę API w Rust z Axum na Tokio: pisze, przegląda, testuje i wydaje kod z cargo test i tokio::test.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.