Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Rust Structural Quality?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/dankosik-rust-structural-quality)
---
name: rust-structural-quality
description: "Deletion test. Use when adding a crate, module, trait, layer, helper, or parallel path, deciding placement, or consolidating scattered rules."
---
# Rust Structural Quality
**Deletion test.** Judge every structure by the responsibility it owns and the facts a reader or caller must coordinate. Before settling a non-trivial public seam, sketch a 3–8 line caller walkthrough (happy path plus worst failure or cancellation) and deepen the interface when callers must coordinate multi-step ceremony; keep structure when it hides complexity or preserves an invariant, and collapse it when it merely relocates the same reasoning, as shown in [deep seam examples](references/deep-seams.md).
**Crate and module boundaries.** Follow the [repository architecture](../../../docs/repo-architecture.md) for composition, leaf, provider, and feature ownership when working in this repository. Add a crate only for a present dependency-direction, compile-time, or lifecycle boundary; split modules by coherent responsibility or authority rather than line count, keep `lib.rs` a thin re-export facade for multi-module crates, and create directories alongside their first real artifact.
**Polymorphism and seams.** Choose a concrete type for fixed behavior, an enum for closed alternatives, generics for required static variation, and `dyn` when consumers need type erasure or heterogeneous storage, weighing API, binary-size, and compile-time trade-offs. Separate pure state transitions from I/O (Sans-I/O, passing `now: Instant` rather than injecting a `Clock` trait or `MockCtrl`), collapse single-implementation traits introduced solely for internal mocking, follow one idiom per concern within a crate, and require macros to earn what functions, generics, or traits cannot express cleanly.
**Functions and receivers.** Push `if`s up and `for`s down: move precondition and mode branching to the owning caller so inner helpers run straight-line, and push batching or iteration down into leaf operations. Extract a single-caller private function when its signature expresses a complete decision without reading its body; keep trivial forwarding and local-state fragments inline. Use methods for meaningful receivers, plain functions for stateless one-shot operations, and private context structs where grouped state clarifies ownership, collapsing one-off `Drop`-closure or trait-adapter wrappers satisfied by `std` or declared crates; see [responsibility examples](references/responsibility.md). Treat broad names (`manager`, `service`, `helpers`) as prompts to inspect ownership rather than automatic defects.
**Co-change and single ownership.** Trace one realistic change: pieces that must change together through a copied rule, implicit call order, or split state belong under one owner or a compiler/test check. Place pure rules shared by unconnected crates in `crates/shared-rules` when they pass its crate-doc membership test. Exhaustive matches already surface new variants, independent similar text may stay separate, and flag-accumulating helpers warrant checking whether responsibilities diverged.
**Coupling and surface area.** Reduce coupling before adding layers by tightening visibility, narrowing parameters or results, or moving decisions to the existing owner (`loop`, error classifier, config section, or adapter). Keep public APIs minimal and single-path while using internal re-exports freely for crate layout. Retain shims or fallbacks only with an accepted requirement, owner, observable trigger, and removal condition, and verify where rollback or error-mapping guarantees live before collapsing a container or wrapper. Judge structure by ownership and behavior rather than line-count or syntax taste.