mcpField
S
solid-rust

solid-rust

github.com/fusengineDevelopment3441 installsUpdated 2w ago
Repository

About solid-rust

solid-rust is a coding skill for applying modular SOLID architecture in Rust 2024 projects. It guides code reuse, layer placement, error handling and documentation, and prescribes a parallel agent workflow before implementation.

Key features

  1. 01Feature-based module layout
  2. 02DRY checks before adding code
  3. 03Trait-bound generics and trait placement
  4. 04thiserror-based custom errors
  5. 05Rustdoc on public items
  6. 06Templates and SOLID references

Use cases

  1. 01Structuring a new Rust feature module
  2. 02Checking for reusable services or traits
  3. 03Scaffolding handlers, tests, or errors

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/fusengine/claude-plugins --skill solid-rust

After installing, type/solid-rustin Claude Code to confirm it loaded.

Details

From the project README
SOLID Rust enforces a modular architecture for Rust 2024 edition: every feature lives under `src/modules/[feature]/` (handlers.rs, services.rs, repository.rs, traits.rs, models.rs) with shared code in `src/core/`, traits live only in `traits.rs` or `src/core/traits/`, generics use trait bounds instead of concrete types, `thiserror` handles custom errors, and every public item carries a rustdoc `///` comment.

Before writing any new code it requires a DRY check against src/core/services and src/core/traits. See solid-principles.md for the overview, the per-principle references for SRP/OCP/LSP/ISP/DIP detail, and the templates for module/service/trait/handler/error/test scaffolding.

SOLID Rust - Modular Architecture

Agent Workflow (MANDATORY)

Before ANY implementation, spawn 3 agents in parallel, one Agent call each with a name:

  1. fuse-ai-pilot:explore-codebase - Analyze existing architecture
  2. fuse-ai-pilot:research-expert - Verify Rust docs via Context7
  3. fuse-ai-pilot:sniper - Post-implementation validation

DRY - Reuse Before Creating (MANDATORY)

Before writing ANY new code:

  1. Grep the codebase for similar traits, services, or logic
  2. Check shared locations: src/core/services/, src/core/traits/
  3. If similar code exists -> extend/reuse instead of duplicate
  4. If code will be used by 2+ features -> create it in src/core/

Architecture (Modules MANDATORY)

LayerLocation
Handlerssrc/modules/[feature]/handlers.rs
Servicessrc/modules/[feature]/services.rs
Repositoriessrc/modules/[feature]/repository.rs
Traitssrc/modules/[feature]/traits.rs
Modelssrc/modules/[feature]/models.rs
Sharedsrc/core/{services,traits,models}/

NEVER use flat src/ structure - always src/modules/[feature]/


Critical Rules (MANDATORY)

RuleValue
File limitFUSE_SOLID_MAX_LINES
HandlersThin, delegate to services
Traitstraits.rs or src/core/traits/ ONLY
Rustdoc/// on every public item
Error handlingUse thiserror for custom errors
GenericsUse trait bounds, not concrete types

Reference Guide

Concepts
TopicReferenceWhen to consult
SOLID Overviewsolid-principles.mdQuick reference
SRPsingle-responsibility.mdFat structs
OCPopen-closed.mdAdding impls
LSPliskov-substitution.mdTrait contracts
ISPinterface-segregation.mdFat traits
DIPdependency-inversion.mdGenerics/DI
Architecturearchitecture-patterns.mdModular crate
Templates
TemplateWhen to use
module.mdFeature module structure
service.mdBusiness logic service
trait-def.mdTrait definition
handler.mdHTTP handler (Axum)
error.mdCustom errors (thiserror)
test.mdUnit + integration tests

Forbidden

Anti-PatternFix
Files over FUSE_SOLID_MAX_LINESSplit by responsibility
Traits in impl filesMove to traits.rs
Box<dyn Any>Use proper trait bounds
Flat src/ structureUse src/modules/[feature]/
Unwrap in library codeUse Result<T, E>

Comments

Markdown supported