Skip to content
Back to skills

Rust Structural Quality

ASecurity

Deletion test. Use when adding a crate, module, trait, layer, helper, or parallel path, deciding placement, or consolidating scattered rules.

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 15, 2026
developmentrustexpressapi

Works with

  • api

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned November 27, 2026

npx -y skills add Dankosik/rust-service-template-rest --skill rust-structural-quality --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rust Structural Quality?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rust Structural Quality
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/dankosik-rust-structural-quality/badge)](https://www.skillsdirectory.com/skills/dankosik-rust-structural-quality)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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.

Files in this skill

  • LICENSE1 KB
  • SKILL.md4.5 KB
  • references/responsibility.md2.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.