solid-rust
/solid-rust
Use when writing or refactoring Rust code, structuring src/modules/[feature]/ layers, or defining traits.rs interfaces (SOLID, files within FUSE_SOLID_MAX_LINES).
- Author
- fusengine ↗
- Repository
- agents ↗
- Licence
- MIT
- Last repository change
- 12.10.2026
Assessment and security
- Files in this package
- 14
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 12.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Use when writing or refactoring Rust code, structuring src/modules/[feature]/ layers, or defining traits.rs interfaces (SOLID, files within FUSE_SOLID_MAX_LINES).
Original author description
Use when writing or refactoring Rust code, structuring src/modules/[feature]/ layers, or defining traits.rs interfaces (SOLID, files within FUSE_SOLID_MAX_LINES).
How it works
- Agent Workflow (MANDATORY)
- DRY - Reuse Before Creating (MANDATORY)
- Architecture (Modules MANDATORY)
- Critical Rules (MANDATORY)
- Reference Guide
- Forbidden
SKILL.md preview
---
name: solid-rust
description: "Use when writing or refactoring Rust code, structuring src/modules/[feature]/ layers, or defining traits.rs interfaces (SOLID, files within FUSE_SOLID_MAX_LINES)."
versions:
rust: "2024"
user-invocable: true
references: references/solid-principles.md, references/single-responsibility.md, references/open-closed.md, references/liskov-substitution.md, references/interface-segregation.md, references/dependency-inversion.md, references/architecture-patterns.md, references/templates/module.md, references/templates/service.md, references/templates/trait-def.md, references/templates/handler.md, references/templates/error.md, references/templates/test.md
related-skills: solid-detection
---
<objective>
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.
</objective>
# 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)
| Layer | Location |
|-------|----------|
| Handlers | `src/modules/[feature]/handlers.rs` |
| Services | `src/modules/[feature]/services.rs` |
| Repositories | `src/modules/[feature]/repository.rs` |
| Traits | `src/modules/[feature]/traits.rs` |
| Models | `src/modules/[feature]/models.rs` |
| Shared | `src/core/{services,traits,models}/` |
**NEVER use flat `src/` structure - always `src/modules/[feature]/`**
---
## Critical Rules (MANDATORY)
| Rule | Value |
|------|-------|
| File limit | `FUSE_SOLID_MAX_LINES` |
| Handlers | Thin, delegate to services |
| Traits | `traits.rs` or `src/core/traits/` ONLY |
| Rustdoc | `///` on every public item |
| Error handling | Use `thiserror` for custom errors |
| Generics | Use trait bounds, not concrete types |
---
## Reference Guide
### Concepts
| Topic | Reference | When to consult |
|-------|-----------|-----------------|
| **SOLID Overview** | [solid-principles.md](references/solid-principles.md) | Quick reference |
| **SRP** | [single-responsibility.md](references/single-responsibility.md) | Fat structs |
| **OCP** | [open-closed.md](references/open-closed.md) | Adding impls |
| **LSP** | [liskov-substitution.md](references/liskov-substitution.md) | Trait contracts |
| **ISP** | [interface-segregation.md](references/interface-segregation.md) | Fat traits |
| **DIP** | [dependency-inversion.md](references/dependency-inversion.md) | Generics/DI |
| **Architecture** | [architecture-patterns.md](references/architecture-patterns.md) | Modular crate |
### Templates
| Template | When to use |
|----------|-------------|
| [module.md](references/templates/module.md) | Feature module structure |
| [service.md](references/templates/service.md) | Business logic service |
| [trait-def.md](references/templates/trait-def.md) | Trait definition |
| [handler.md](references/templates/handler.md) | HTTP handler (Axum) |
| [error.md](references/templates/error.md) | Custom errors (thiserror) |
| [test.md](references/templates/test.md) | Unit + integration tests |
---
## Forbidden
| Anti-Pattern | Fix |
|--------------|-----|
| Files over `FUSE_SOLID_MAX_LINES` | Split by responsibility |
| Traits in impl files | Move to `traits.rs` |
| `Box<dyn Any>` | Use proper trait bounds |
| Flat `src/` structure | Use `src/modules/[feature]/` |
| Unwrap in library code | Use `Result<T, E>` |
Files in this package (14)
- SKILL.md 4 KB
- references/architecture-patterns.md 10 KB
- references/dependency-inversion.md 9 KB
- references/interface-segregation.md 8 KB
- references/liskov-substitution.md 9 KB
- references/open-closed.md 8 KB
- references/single-responsibility.md 5 KB
- references/solid-principles.md 2 KB
- references/templates/error.md 10 KB
- references/templates/handler.md 9 KB
- references/templates/module.md 11 KB
- references/templates/service.md 9 KB
- references/templates/test.md 13 KB
- references/templates/trait-def.md 10 KB
Versions
The database has no other skills named solid-rust.
Database snapshot: 13.11.2026 · package version e2dc9a8e041e (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 90solid-go
Use when writing or refactoring Go code, structuring internal/modules/[feature]/ layers, or defining ports/ interfaces (SOLID, files within FUSE_SOLID_MAX_LINES). - 90solid-python
Use when writing or refactoring Python code, structuring modules/[feature]/ layers, or defining Protocol-based interfaces (SOLID, files within FUSE_SOLID_MAX_LINES). - 100rust-programming
Use when writing, reviewing, or refactoring Rust code, especially workspace crates, public APIs, error handling, async code, ownership choices, or performance-sensitive paths. - 100rust-development
Expert Rust development guidance covering naming conventions, type safety, error handling, documentation, and best practices based on official Rust guidelines. Use this skill when writing new Rust code, reviewing or modifying existing Rust code, designing Rust APIs or libraries,… - 100rust-pro
Use when writing or reviewing Rust code, including Cargo projects, .rs files, ownership and borrowing changes, async Rust, traits, error handling, clippy findings, and Rust tests. # Development skill for this repository; not for installation by users. - 100rust-patterns
Idiomatic Rust patterns, ownership, error handling, traits, concurrency, and best practices for building safe, performant applications. Use when writing or reviewing Rust code and ownership, error handling, traits, or concurrency is in question.