plugins/axiom-rust-engineering/skills/using-rust-engineering/SKILL.md
Use when working in Rust — routes to specialist sheets for borrow-checker errors (E0502/E0597/E0382), trait bounds (E0277), async Send/Sync, clippy warnings, unsafe/FFI soundness, performance profiling, or PyO3/candle interop
npx skillsauth add tachyon-beep/skillpacks using-rust-engineeringInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This meta-skill routes you to the right Rust specialist based on symptoms. Rust engineering problems fall into distinct categories that require specialized knowledge. Load this skill when you encounter Rust-specific issues but aren't sure which specialized skill to use.
Core Principle: Different Rust problems require different specialists. Match symptoms to the appropriate specialist skill. Don't guess at solutions—route to the expert.
Load this skill when:
Don't use for: Non-Rust languages, general systems theory (not Rust-specific), deployment infrastructure (not Rust-specific), algorithm selection (not language-specific)
Workspace-scope concerns: For multi-crate workspaces ([workspace.dependencies], workspace-scope clippy.toml/deny.toml, public-vs-internal crate partition, version drift across the workspace, the resolver-2/3 choice, workspace anti-patterns), load /rust-workspaces (the axiom-rust-workspaces pack). This pack is single-crate-shaped; that pack composes these concerns at workspace scale.
IMPORTANT: All reference sheets are located in the SAME DIRECTORY as this SKILL.md file.
When this skill is loaded from:
skills/using-rust-engineering/SKILL.md
Reference sheets like systematic-delinting.md are at:
skills/using-rust-engineering/systematic-delinting.md
NOT at:
skills/systematic-delinting.md ← WRONG PATH
When you see a link like [systematic-delinting.md](systematic-delinting.md), read the file from the same directory as this SKILL.md.
Symptoms:
Route to: modern-rust-and-editions.md
Why: Rust editions change capture semantics, import syntax, and resolver behavior in ways that silently break or subtly alter code.
Example queries:
Symptoms:
*self because it is borrowed" (E0505)x because it is borrowed" (E0506)Route to: ownership-borrowing-lifetimes.md
Why: Ownership and lifetime errors are Rust's most common stumbling block and require systematic mental models, not ad-hoc fixes.
Example queries:
Symptoms:
T: Foo is not satisfied"+ to add bounds on object-safe trait"Route to: traits-generics-and-dispatch.md
Why: Rust's trait system—object safety, dispatch mechanics, HRTB—has non-obvious rules that require a dedicated reference to navigate correctly.
Example queries:
Symptoms:
? operator can't convert between error types"match on every Result is exhausting"anyhow vs thiserror?"Route to: error-handling-patterns.md
Why: Idiomatic Rust error handling involves a hierarchy of strategies (custom types, anyhow, thiserror, ?) that must be matched to the codebase's ownership model and API surface.
Example queries:
? operator?"Symptoms:
Route to: project-structure-and-tooling.md
Why: Cargo workspaces, feature flags, and build scripts interact in ways that require an end-to-end setup guide rather than piecemeal answers.
Example queries:
Note: This pack's project-structure sheet is single-crate-shaped. For workspace-scope concerns (multi-crate composition, [workspace.dependencies], workspace-scope clippy.toml / deny.toml, public-vs-internal crate boundaries, version drift across the workspace) load /rust-workspaces (the axiom-rust-workspaces pack) instead.
Symptoms:
cargo build and cargo build -p some-crate produce different binaries"deny.toml live in a workspace?"pub use a type from an internal crate?"[workspace] block with one member — is that fine?"Route to: /rust-workspaces (the axiom-rust-workspaces pack — separate skill, different pack)
Why: This pack's sheets assume one crate's perspective. Workspace-scope decisions (structure, dep unification under the resolver, workspace-wide lint/deny policy, publish/internal partition, anti-pattern sweeps) are a different axis and live in axiom-rust-workspaces. Each crate in a workspace passes this pack's bar; the workspace as a whole passes the workspaces pack's gate.
Example queries:
Symptoms:
Route to: testing-and-quality.md
Why: Rust's test module system, integration test layout, and mocking patterns differ from other languages and require specific structural knowledge.
Example queries:
Symptoms:
too_many_arguments"clippy::expect_used across a large codebase?"Route to: systematic-delinting.md
Why: Reducing clippy warnings at scale requires a staged methodology—triaging, grouping, fixing by category—to avoid churn and accidental regressions.
Example queries:
Note: If setting UP linting (not fixing), route to project-structure-and-tooling.md first.
Symptoms:
Send because it contains a MutexGuard"Option::unwrap() on a None value'"impl Future not satisfied"tokio::select! correctly?"Route to: async-and-concurrency.md
Why: Rust async adds a Send/Sync layer on top of ownership and lifetime rules; tokio's runtime model, task spawning, and executor requirements create failure modes that require dedicated treatment.
Example queries:
Symptoms:
Route to: performance-and-profiling.md
Why: Rust performance work requires profiling before optimization; the allocator, inlining, and LLVM pass pipeline all interact in ways that demand measurement-driven decisions.
Example queries:
Symptoms:
no_std crate — which allocator to use?"Route to: unsafe-ffi-and-low-level.md
Why: Unsafe Rust, C FFI, and no_std environments require precise knowledge of invariants, ABI contracts, and platform constraints that cannot be safely approximated.
Example queries:
Symptoms:
Route to: ai-ml-and-interop.md for the AI/ML framework choices (candle, burn, tch-rs, ndarray, nalgebra) and basic PyO3 onboarding.
For production-grade PyO3 work, redirect to /pyo3-interop (the axiom-pyo3-interop pack). That pack treats the Python ↔ Rust FFI boundary as a discipline distinct from per-crate Rust work — GIL release patterns, abi3 vs native and the wheel matrix, maturin inside a Cargo workspace, batched FFI to amortise crossing cost, zero-copy NumPy via the buffer protocol, Gymnasium environments backed by Rust, error mapping with traceback fidelity, lifecycle and teardown at interpreter shutdown, async across the boundary (pyo3-async-runtimes, tokio + asyncio), packaging and wheels (cibuildwheel, manylinux), debugging boundary panics / segfaults / GIL deadlocks, and the cost-of-crossing performance model. Load that pack when the FFI surface is the hot path (RL self-play, simulation engines, training data pipelines, inference servers); this sheet is sufficient for one-off bindings and ML-framework selection.
Why: Rust's role in AI/ML pipelines—as Python extension via PyO3, as a performance kernel, or as a standalone inference host—introduces cross-language ownership and memory layout constraints not covered by either the Rust or ML literature alone. Once the Python surface becomes more than a thin convenience binding, those constraints deserve their own pack.
Example queries:
/pyo3-interop for production hardening./pyo3-interop for the binding./pyo3-interop:numpy-buffer-protocol./pyo3-interop:gil-release-patterns and /pyo3-interop:debugging-pyo3./pyo3-interop:abi3-vs-native-extensions and /pyo3-interop:packaging-and-wheels.Some symptoms cross multiple specialist domains. Use the following priority rules:
"Unsafe async code" (e.g., raw pointer passed across await points):
"clippy warnings inside unsafe blocks":
"PyO3 + lifetime errors":
Python<'py> tokens)"Async trait not object-safe":
async_trait crate or BoxFuture patterns"Performance regression after adding generics":
"Ambiguous general query" (e.g., "my Rust code is broken"): → Ask: "What specific issue? Borrow checker errors? Compile-time trait errors? Runtime panics? Performance? Clippy warnings?"
Never guess when ambiguous. Ask once, route accurately.
Some tasks span multiple specialists and must be loaded in a specific order. Setup before fixes, diagnosis before optimization, soundness before polish.
New Rust project with FFI (greenfield crate that will call C or be called from C):
build.rs, feature flags, links= metadataLegacy crate cleanup (inherited codebase, no lint config, warnings everywhere):
[lints] table, rustfmt config, CI gatesSlow release binary (production binary missing performance targets):
Adding a Python binding to an existing Rust crate (exposing a mature Rust library via PyO3):
Python<'py>, GIL, NumPy buffer protocol)Migrating to edition 2024 (upgrading edition on an established crate):
cargo fix --edition, resolver differencesimpl Trait precise captureasync fn in trait, RPITIT interactions)Load in order of execution: Setup before optimization, diagnosis before fixes, soundness before polish.
| Symptom | Wrong Route | Correct Route | Why | |---------|-------------|---------------|-----| | "Code slow" | traits-generics | performance-and-profiling FIRST | Don't optimize without profiling | | "Setup clippy and fix warnings" | systematic-delinting only | project-structure THEN delinting | Setup before fixing | | "E0277 in async function" | async-and-concurrency | traits-generics-and-dispatch | Trait bound errors are a type system problem | | "unsafe lifetime error" | ownership-borrowing-lifetimes only | unsafe-ffi THEN ownership | Soundness before lifetime annotation | | "PyO3 panic at runtime" | ai-ml-and-interop only | unsafe-ffi or ownership first | Find the UB/lifetime root cause first | | "Fix 500 clippy warnings" | project-structure | systematic-delinting | Process for fixing, not setup |
Key principle: Diagnosis before solutions, setup before optimization, measure before performance fixes.
If you catch yourself about to:
allow attribute → Route to systematic-delinting.md for methodologyAll of these mean: You're about to give incomplete advice. Route to the specialist instead.
| Excuse | Reality | What To Do |
|--------|---------|------------|
| "Just a simple borrow-checker fix" | Ad-hoc fixes mask the real ownership issue and recur later | Route to ownership-borrowing-lifetimes.md |
| "User knows Rust, skip routing" | Experience in safe Rust ≠ expertise in async Send/Sync or unsafe invariants | Route based on symptom, not assumed skill |
| "I'll just add .clone()" | That's the anti-pattern the specialist exists to prevent | Route to ownership-borrowing-lifetimes.md for the systematic alternative |
| "Quick lifetime annotation" | Sprinkling 'a without a model creates compounding problems | Route to ownership-borrowing-lifetimes.md |
| "One clippy allow won't hurt" | Allows accumulate; that's exactly why the delinting sheet exists | Route to systematic-delinting.md |
| "unsafe is fine here, I checked" | Unsafe requires documented invariants, not gut-check | Route to unsafe-ffi-and-low-level.md |
If you catch yourself thinking ANY of these, STOP and route to the specialist.
Before giving ANY Rust advice, ask yourself:
❓ Did I identify the symptom?
❓ Is this symptom in my routing table?
❓ Am I about to give advice directly?
❓ Is this a diagnosis issue or a solution issue?
❓ Is the query ambiguous?
❓ Am I feeling pressure to skip routing?
If you failed ANY check above, do NOT give direct advice. Route to the specialist or ask a clarifying question.
After routing, load the appropriate specialist skill for detailed guidance:
? operator, error contextSkip Rust pack when:
Rust pack is for: Rust-specific implementation, tooling, borrow checker, traits, async, FFI, performance, and AI/ML interop.
Critical: Many Rust issues require diagnosis before solutions:
| Issue Type | Diagnosis Skill | Then Solution Skill | |------------|----------------|---------------------| | Performance | performance-and-profiling (flamegraph, heaptrack) | async-and-concurrency or performance-and-profiling | | Runtime panic (unwrap, index out of bounds) | ownership-borrowing-lifetimes | error-handling-patterns or unsafe-ffi-and-low-level | | Trait errors in async | traits-generics-and-dispatch | async-and-concurrency | | Test failure of unclear cause | testing-and-quality | the relevant domain skill once isolated |
If unclear what's wrong, route to diagnostic skill first.
Phase 1 — Standalone: Rust skills are self-contained.
Future cross-references:
Current focus: Route within Rust pack only. Other packs handle other concerns.
tools
Use when designing, implementing, or auditing an MCP (Model Context Protocol) server — tool API design, idempotency under agent retry, structured error envelopes agents can recover from, schema versioning across model drift, transport reliability (stdio / HTTP), output-shape and pagination discipline, and choosing between tools / resources / prompts / sampling. Also use when an MCP server's tools confuse agents, return unstructured errors, deadlock under concurrent calls, double-execute under retry, or lose state across reconnects. Do not use for general REST/GraphQL API design (use `/web-backend`), for client-side prompt engineering or tool-loop design (use `/llm-specialist`), for general in-process plugin architecture (use `/system-architect`), or for cryptographic-provenance audit trails (use `/audit-pipelines`).
development
Use when running **SQLite or DuckDB inside an application process** as the durable store — not as a development convenience but as the production database. Use when scaling an SQLite layer that worked at low concurrency and is now hitting SQLITE_BUSY, WAL bloat, lock contention, schema-migration ceremony, or correctness gaps under multi-process writers. Use when introducing DuckDB as an OLAP complement to an OLTP SQLite store, or when picking between the two for a new component. Pairs with `/web-backend` (the API surface above the DB) and `/audit-pipelines` (when the DB is also the audit trail). Do not load for server databases (Postgres, MySQL), key-value stores, or ORM choice in isolation.
development
Use when designing or critiquing the structure of a staged procedure — a wizard, configuration flow, troubleshooting tree, training curriculum, multi-stage approval pipeline, decision pipeline, or any decomposition of expert work into composable stages. Use for both producer work (build the decomposition) and critic work (audit a proposed decomposition). Use when reasoning about capacity, bottlenecks, or soundness of a procedural flow. Do not use for implementation-plan critique of code changes (use `/axiom-planning` instead), for execution-time dynamics (use `/simulation-foundations`), or for rendering an already-designed procedure as docs or UI (use `/technical-writer` or `/ux-designer`).
testing
Use when the user wants to draft fiction or creative nonfiction prose, get craft critique on prose they have written, or plan story structure, outline, or premise. Workshop-voiced. Three explicit modes (draft, critique, plan) and the router will refuse to begin work without a declared mode.