agentleFS
gurinderugurinderu/craft/skills/rust-architecture-review/SKILL.md

rust-architecture-review

Skill1 starsChanged 42 days agoMITView on GitHub

Rust architecture-audit rubric — builds a whole-project dependency graph (crates and modules), then judges it against a checklist (cycles, inverted dependencies, layer leaks, god modules, anemic domain) and over-engineering (ghost abstractions, over-layering), issuing a Healthy/Concerns/At-risk rating — and INCOMPLETE (not run) when no graph could be built at all, never Healthy. Use when auditing a Rust project's architecture or structural debt. Triggers: structural debt, dependency cycle, layer leak, god module, is this over-engineered.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If a tool is absent, say so (cargo-modules not installed — using source analysis) and fall back to Grep over use, mod, and pub use …

    line 35

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Rust Architecture Review

The rubric for auditing a Rust project's whole-graph structure — not a diff. Build the dependency graph, judge it against the severity tiers, then issue a health rating. This is the knowledge; the craft:rust-architecture-reviewer agent applies it to an actual codebase and reports back. The design vocabulary it leans on (ports, adapters, domain core, the criticism of cargo-culting) lives in the rust-architecture skill.

When to Use

  • Auditing the architecture of an existing Rust project or workspace
  • Assessing structural debt before a large refactor
  • Sanity-checking whether a structure is appropriate for the project's size — in both directions (under- and over-engineered)

This judges structure, not changes. For diff/PR review use rust-review.

Judging philosophy — appropriateness, both directions

Structure should match the project's real complexity. The upper tiers catch broken structure (leaks, cycles); the lower tiers catch needless structure (abstractions with one implementor, layering a 300-line crate doesn't need). Take the rust-architecture criticism section seriously: "hell is full of single-implementation abstractions." Do not reward indirection for its own sake.

Step 1 — Build the graph (hybrid)

Determine the perimeter from the root Cargo.toml: a [workspace] with multiple members → analyze the crate graph; a single package → analyze the module graph.

# crate graph
cargo metadata --no-deps --format-version 1   # members + intra-workspace deps (preferred)
cargo tree --workspace --locked                # fallback view of dependency edges
# module graph
cargo modules structure --package <pkg>        # if cargo-modules is installed

If a tool is absent, say so (cargo-modules not installed — using source analysis) and fall back to Grep over use, mod, and pub use declarations plus the [dependencies] tables in each Cargo.toml. Never block on a missing tool — the gate is "did we get a graph", not "is the tool present".

A missing tool is not a missing graph; a missing graph is not a healthy graph. The fallback is mandatory before any rating: with cargo metadata unavailable, Grep still reads use / mod / pub use and the [dependencies] tables, and a graph read that way earns an ordinary rating with the method named. Only when NO method produced a graph — no manifest, no sources, nothing readable — is there no subject to rate: report INCOMPLETE (not run), name what was missing, and say the architecture is UNASSESSED. An empty graph and an unreadable one look identical in the output and are opposites in meaning; a Healthy over a graph nobody read is the failure this row exists to prevent.

Step 2 — Severity checklist

Report findings as severity · location · what · why · fix. A finding without a location isn't actionable.

CRITICAL — integrity broken

  • Dependency cycle between modules or crates (objective, straight from the graph).
  • Inverted dependency direction — a domain/core module imports infrastructure: sqlx, axum, reqwest, tokio::net, hyper, a concrete DB/HTTP client. The domain must not know the outside world (dependency rule → rust-architecture).

HIGH — significant structural debt

  • Business logic in an adapter — non-trivial computation or decision logic inside an HTTP handler, CLI command, or repository impl instead of the domain.
  • God module — fan-in > 8 dependents and a size hub (~> 500 LOC); the thing everything reaches into.
  • Anemic domain — domain types are plain data holders while a single Service/Manager/Helper does all the work (behavior belongs with the data it operates on).

MEDIUM — smells & appropriateness (over-engineering side)

  • Ghost abstraction — a trait/port with exactly one implementor and no test double; pure indirection. Use the concrete type until a second implementor or a real testing seam appears.
  • Over-layering for size — full ports & adapters scaffolding in a tiny crate with a single external dependency; the indirection costs more than it saves.
  • Generic soup — Service<R, M, N> style structs with Clone + Send + Sync + 'static bounds propagating across the codebase, fighting the language.

LOW / INFO

  • Mixed organization (by-layer and by-feature intermixed); unclear seams or entry points.

Thresholds (fan-in > 8, > 500 LOC) are tunable defaults — apply judgment around them, don't treat them as hard gates.

Step 3 — Health rating

RatingWhen
At-risk ⛔any CRITICAL, or ≥ 3 HIGH
Concerns ⚠️≥ 1 HIGH, or several MEDIUM
Healthy ✅a graph was read (by any method) and it holds only LOW / INFO
INCOMPLETE (not run) 🚫no graph could be built by any method — nothing was analyzed. Never Healthy: an empty graph reads exactly like an unread one

Boundaries

  • How to introduce a port, lay out a domain, or decide whether to abstract → rust-architecture (this rubric only judges the existing graph).
  • Diff-scoped / mergeability review → rust-review.
  • This skill judges; it does not rewrite. Propose the fix, let the author apply it.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.