Skip to content

BumpyClock/agent-templates / skills_archive/rust-skills

rust-skills

Unverified

Rust guidance for ownership, APIs, concurrency, and safety. Use when writing, reviewing, or refactoring Rust code.

FileKindSize
.github/workflows/ci.ymlconfig679 B
AGENTS.mdmarkdown8 B
CHANGELOG.mdmarkdown3.3 KB
CLAUDE.mdmarkdown8 B
CONTRIBUTING.mdmarkdown2.6 KB
LICENSEother1.0 KB
README.mdmarkdown9.9 KB
RULES.mdmarkdown36.2 KB
SKILL.mdskill md1.6 KB
agents/openai.yamlconfig255 B
checks/.gitignoreother68 B
checks/Cargo.lockmanifest41.6 KB
checks/Cargo.tomlmanifest1.1 KB
checks/README.mdmarkdown2.7 KB
checks/analyze.pyscript5.7 KB
checks/baseline.txtmarkdown8.2 KB
checks/check.shscript1.3 KB
checks/gen.pyscript3.4 KB
checks/gen_index.pyscript5.6 KB
checks/rust-toolchain.tomlconfig218 B
checks/src/lib.rsscript143 B
checks/test_index.pyscript2.8 KB
checks/validate.pyscript2.0 KB
rules/anti-clone-excessive.mdmarkdown2.6 KB
rules/anti-collect-intermediate.mdmarkdown3.2 KB
rules/anti-empty-catch.mdmarkdown3.1 KB
rules/anti-expect-lazy.mdmarkdown2.6 KB
rules/anti-format-hot-path.mdmarkdown3.6 KB
rules/anti-index-over-iter.mdmarkdown2.8 KB
rules/anti-lock-across-await.mdmarkdown3.1 KB
rules/anti-over-abstraction.mdmarkdown3.1 KB
rules/anti-panic-expected.mdmarkdown3.3 KB
rules/anti-premature-optimize.mdmarkdown3.7 KB
rules/anti-string-for-str.mdmarkdown2.6 KB
rules/anti-stringly-typed.mdmarkdown4.1 KB
rules/anti-type-erasure.mdmarkdown3.6 KB
rules/anti-unwrap-abuse.mdmarkdown3.3 KB
rules/anti-vec-for-slice.mdmarkdown2.5 KB
rules/api-builder-must-use.mdmarkdown3.8 KB
rules/api-builder-pattern.mdmarkdown4.6 KB
rules/api-common-traits.mdmarkdown4.3 KB
rules/api-default-impl.mdmarkdown4.0 KB
rules/api-extension-trait.mdmarkdown3.8 KB
rules/api-from-not-into.mdmarkdown3.3 KB
rules/api-impl-asref.mdmarkdown3.5 KB
rules/api-impl-fromiterator.mdmarkdown3.4 KB
rules/api-impl-into.mdmarkdown4.0 KB
rules/api-must-use.mdmarkdown3.5 KB
rules/api-newtype-safety.mdmarkdown3.9 KB
rules/api-non-exhaustive.mdmarkdown3.9 KB
rules/api-operator-overload.mdmarkdown3.3 KB
rules/api-parse-dont-validate.mdmarkdown4.3 KB
rules/api-sealed-trait.mdmarkdown4.5 KB
rules/api-serde-optional.mdmarkdown4.2 KB
rules/api-typestate.mdmarkdown4.9 KB
rules/async-async-fn-bounds.mdmarkdown3.4 KB
rules/async-bounded-channel.mdmarkdown4.5 KB
rules/async-broadcast-pubsub.mdmarkdown4.1 KB
rules/async-cancel-safety.mdmarkdown4.3 KB
rules/async-cancellation-token.mdmarkdown4.8 KB
rules/async-clone-before-await.mdmarkdown4.0 KB
rules/async-fn-in-trait.mdmarkdown3.6 KB
rules/async-join-parallel.mdmarkdown4.0 KB
rules/async-joinset-structured.mdmarkdown4.5 KB
rules/async-mpsc-queue.mdmarkdown3.9 KB
rules/async-no-lock-await.mdmarkdown4.0 KB
rules/async-oneshot-response.mdmarkdown4.5 KB
rules/async-select-racing.mdmarkdown4.6 KB
rules/async-spawn-blocking.mdmarkdown3.6 KB
rules/async-tokio-fs.mdmarkdown4.1 KB
rules/async-tokio-runtime.mdmarkdown4.5 KB
rules/async-try-join.mdmarkdown4.3 KB
rules/async-watch-latest.mdmarkdown4.5 KB
rules/closure-disjoint-capture.mdmarkdown3.5 KB
rules/closure-fn-trait-bounds.mdmarkdown2.9 KB
rules/closure-impl-fn-return.mdmarkdown2.8 KB
rules/closure-move-capture.mdmarkdown2.9 KB
rules/closure-static-vs-dyn.mdmarkdown3.2 KB
rules/coll-binaryheap.mdmarkdown3.5 KB
rules/coll-map-choice.mdmarkdown3.6 KB
rules/coll-seq-choice.mdmarkdown2.9 KB
rules/coll-set-membership.mdmarkdown3.1 KB
rules/conc-atomic-ordering.mdmarkdown3.5 KB
rules/conc-rayon-par-iter.mdmarkdown2.4 KB
rules/conc-scoped-threads.mdmarkdown2.7 KB
rules/conc-thread-local.mdmarkdown2.6 KB
rules/const-block.mdmarkdown2.9 KB
rules/const-fn.mdmarkdown2.1 KB
rules/const-generics.mdmarkdown2.7 KB
rules/const-vs-static.mdmarkdown2.8 KB
rules/conv-asmut-mutable.mdmarkdown2.1 KB
rules/conv-fromstr-parsing.mdmarkdown2.5 KB
rules/conv-tryfrom-fallible.mdmarkdown2.3 KB
rules/doc-all-public.mdmarkdown2.7 KB
rules/doc-cargo-metadata.mdmarkdown3.2 KB
rules/doc-crate-readme.mdmarkdown2.1 KB
rules/doc-errors-section.mdmarkdown3.2 KB
rules/doc-examples-section.mdmarkdown2.9 KB
rules/doc-hidden-setup.mdmarkdown3.5 KB
rules/doc-intra-links.mdmarkdown3.3 KB
rules/doc-link-types.mdmarkdown3.8 KB
rules/doc-module-inner.mdmarkdown2.8 KB
rules/doc-panics-section.mdmarkdown3.1 KB
rules/doc-question-mark.mdmarkdown3.2 KB
rules/doc-safety-section.mdmarkdown3.8 KB
rules/err-anyhow-app.mdmarkdown4.2 KB
rules/err-context-chain.mdmarkdown3.5 KB
rules/err-custom-type.mdmarkdown4.0 KB
rules/err-doc-errors.mdmarkdown3.8 KB
rules/err-expect-bugs-only.mdmarkdown3.7 KB
rules/err-from-impl.mdmarkdown3.9 KB
rules/err-lowercase-msg.mdmarkdown3.3 KB
rules/err-no-unwrap-prod.mdmarkdown3.1 KB
rules/err-question-mark.mdmarkdown3.3 KB
rules/err-result-over-panic.mdmarkdown3.4 KB
rules/err-source-chain.mdmarkdown3.8 KB
rules/err-thiserror-lib.mdmarkdown4.1 KB
rules/lint-cargo-metadata.mdmarkdown2.8 KB
rules/lint-cfg-check.mdmarkdown2.4 KB
rules/lint-clippy-nursery-selected.mdmarkdown2.6 KB
rules/lint-deny-correctness.mdmarkdown2.2 KB
rules/lint-missing-docs.mdmarkdown2.9 KB
rules/lint-pedantic-selective.mdmarkdown3.1 KB
rules/lint-rustfmt-check.mdmarkdown2.7 KB
rules/lint-unsafe-doc.mdmarkdown3.1 KB
rules/lint-warn-complexity.mdmarkdown3.0 KB
rules/lint-warn-perf.mdmarkdown3.2 KB
rules/lint-warn-style.mdmarkdown2.9 KB
rules/lint-warn-suspicious.mdmarkdown2.9 KB
rules/lint-workspace-lints.mdmarkdown3.6 KB
rules/macro-export-crate-path.mdmarkdown2.6 KB
rules/macro-fragment-specifiers.mdmarkdown2.9 KB
rules/macro-prefer-functions.mdmarkdown2.1 KB
rules/macro-private-helpers.mdmarkdown3.0 KB
rules/macro-proc-error-spans.mdmarkdown3.7 KB
rules/macro-proc-syn-quote.mdmarkdown3.5 KB
rules/macro-proc-two-crate.mdmarkdown3.8 KB
rules/macro-rules-hygiene.mdmarkdown2.8 KB
rules/mem-arena-allocator.mdmarkdown4.4 KB
rules/mem-arrayvec.mdmarkdown3.6 KB
rules/mem-assert-type-size.mdmarkdown3.8 KB
rules/mem-avoid-format.mdmarkdown3.5 KB
rules/mem-box-large-variant.mdmarkdown3.7 KB
rules/mem-boxed-slice.mdmarkdown3.5 KB
rules/mem-clone-from.mdmarkdown3.5 KB
rules/mem-compact-string.mdmarkdown3.7 KB
rules/mem-drop-order.mdmarkdown4.5 KB
rules/mem-reuse-collections.mdmarkdown4.2 KB
rules/mem-smaller-integers.mdmarkdown3.9 KB
rules/mem-smallvec.mdmarkdown3.4 KB
rules/mem-take-replace.mdmarkdown3.5 KB
rules/mem-thinvec.mdmarkdown3.2 KB
rules/mem-with-capacity.mdmarkdown3.7 KB
rules/mem-write-over-format.mdmarkdown4.3 KB
rules/mem-zero-copy.mdmarkdown4.0 KB
rules/name-acronym-word.mdmarkdown2.8 KB
rules/name-as-free.mdmarkdown2.3 KB
rules/name-consts-screaming.mdmarkdown2.2 KB
rules/name-crate-no-rs.mdmarkdown2.0 KB
rules/name-funcs-snake.mdmarkdown1.9 KB
rules/name-into-ownership.mdmarkdown2.7 KB
rules/name-is-has-bool.mdmarkdown3.2 KB
rules/name-iter-convention.mdmarkdown3.3 KB
rules/name-iter-method.mdmarkdown3.3 KB
rules/name-iter-type-match.mdmarkdown3.6 KB
rules/name-lifetime-short.mdmarkdown2.3 KB
rules/name-no-get-prefix.mdmarkdown3.0 KB
rules/name-to-expensive.mdmarkdown2.9 KB
rules/name-type-param-single.mdmarkdown2.3 KB
rules/name-types-camel.mdmarkdown1.8 KB
rules/name-variants-camel.mdmarkdown1.8 KB
rules/num-cast-try-from.mdmarkdown3.1 KB
rules/num-float-compare.mdmarkdown3.2 KB
rules/num-nonzero.mdmarkdown3.4 KB
rules/num-overflow-explicit.mdmarkdown2.7 KB
rules/num-saturating-clamp.mdmarkdown3.1 KB
rules/obs-error-chain.mdmarkdown3.4 KB
rules/obs-instrument-spans.mdmarkdown3.2 KB
rules/obs-levels-filter.mdmarkdown3.4 KB
rules/obs-library-facade.mdmarkdown2.6 KB
rules/obs-no-sensitive-data.mdmarkdown3.5 KB
rules/obs-structured-fields.mdmarkdown2.7 KB
rules/obs-tracing-over-log.mdmarkdown2.2 KB
rules/opt-bounds-check.mdmarkdown4.1 KB
rules/opt-cache-friendly.mdmarkdown4.5 KB
rules/opt-codegen-units.mdmarkdown3.3 KB
rules/opt-cold-unlikely.mdmarkdown3.5 KB
rules/opt-inline-always-rare.mdmarkdown3.3 KB
rules/opt-inline-never-cold.mdmarkdown4.3 KB
rules/opt-inline-small.mdmarkdown3.9 KB
rules/opt-likely-hint.mdmarkdown4.2 KB
rules/opt-lto-release.mdmarkdown3.3 KB
rules/opt-pgo-profile.mdmarkdown4.1 KB
rules/opt-simd-portable.mdmarkdown4.0 KB
rules/opt-target-cpu.mdmarkdown3.8 KB
rules/own-arc-shared.mdmarkdown3.4 KB
rules/own-borrow-over-clone.mdmarkdown2.4 KB
rules/own-clone-explicit.mdmarkdown3.4 KB
rules/own-copy-small.mdmarkdown3.0 KB
rules/own-cow-conditional.mdmarkdown3.5 KB

rules/err-doc-errors.md

View on GitHub
# err-doc-errors

> Document error conditions with `# Errors` section in doc comments

## Why It Matters

Users of your API need to know what can go wrong and why. The `# Errors` documentation section is the standard Rust convention for describing when a function returns `Err`. Good error documentation helps callers handle errors appropriately and understand the contract of your API.

## Bad

```rust
/// Loads a configuration from the specified path.
pub fn load_config(path: &Path) -> Result<Config, ConfigError> {
    // No documentation of error conditions
    // Caller must read source code to understand what can fail
}

/// Parses and validates the input string.
/// 
/// Returns the parsed value.  // What about errors?
pub fn parse_input(input: &str) -> Result<Value, ParseError> {
    // ...
}
```

## Good

```rust
/// Loads a configuration from the specified path.
///
/// # Errors
///
/// Returns an error if:
/// - The file at `path` does not exist or cannot be read
/// - The file contents are not valid TOML
/// - Required configuration keys are missing
/// - Configuration values are out of valid ranges
///
/// # Examples
///
/// ```
/// # use mylib::{load_config, ConfigError};
/// # fn main() -> Result<(), ConfigError> {
/// let config = load_config("app.toml")?;
/// # Ok(())
/// # }
/// ```
pub fn load_config(path: &Path) -> Result<Config, ConfigError> {
    // ...
}

/// Parses and validates the input string as a positive integer.
///
/// # Errors
///
/// Returns [`ParseError::Empty`] if the input is empty.
/// Returns [`ParseError::InvalidFormat`] if the input contains non-digit characters.
/// Returns [`ParseError::Overflow`] if the value exceeds `i64::MAX`.
/// Returns [`ParseError::NotPositive`] if the value is zero or negative.
pub fn parse_positive_int(input: &str) -> Result<i64, ParseError> {
    // ...
}
```

## Linking to Error Variants

```rust
/// Attempts to connect to the database.
///
/// # Errors
///
/// This function will return an error if:
///
/// - [`DbError::ConnectionFailed`] - The database server is unreachable
/// - [`DbError::AuthenticationFailed`] - Invalid credentials
/// - [`DbError::Timeout`] - Connection attempt exceeded timeout
/// - [`DbError::TlsError`] - TLS handshake failed
///
/// See [`DbError`] for more details on each variant.
pub fn connect(config: &DbConfig) -> Result<Connection, DbError> {
    // ...
}
```

## Panic vs Error Documentation

```rust
/// Divides two numbers.
///
/// # Errors
///
/// Returns [`MathError::DivisionByZero`] if `divisor` is zero.
///
/// # Panics
///
/// Panics if called from a non-main thread (debug builds only).
pub fn divide(dividend: i64, divisor: i64) -> Result<i64, MathError> {
    // ...
}
```

## Error Section Format Options

```rust
// Style 1: Bullet list (good for multiple conditions)
/// # Errors
///
/// Returns an error if:
/// - The file does not exist
/// - The file cannot be read
/// - The content is invalid UTF-8

// Style 2: Returns statements (good for mapping to variants)
/// # Errors
///
/// Returns [`Error::NotFound`] if the item doesn't exist.
/// Returns [`Error::PermissionDenied`] if access is forbidden.

// Style 3: Prose (good for complex conditions)
/// # Errors
///
/// This function returns an error when the input fails validation.
/// Validation includes checking that all required fields are present,
/// that numeric fields are within allowed ranges, and that string
/// fields match their expected formats.
```

## Clippy Lint

```toml
# Cargo.toml - require error documentation
[lints.clippy]
missing_errors_doc = "warn"
```

```rust
// This will warn without # Errors section
pub fn might_fail() -> Result<(), Error> { Ok(()) }
```

## See Also

- [doc-examples-section](./doc-examples-section.md) - Examples in documentation
- [err-thiserror-lib](./err-thiserror-lib.md) - Defining error types
- [api-must-use](./api-must-use.md) - Marking Results as must_use
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 466kUpdated Claude CodeCodexVerifiedInstall
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 466kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 319kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 319kUpdated Claude CodeCodexVerifiedInstall