writing-solid-rust

Apply SOLID principles and hexagonal architecture to structure Rust applications.

1|Updated Nov 25, 2025
One-click install
npx skills add https://github.com/89jobrien/dotfiles --skill writing-solid-rust
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: writing-solid-rust
Source: https://github.com/89jobrien/dotfiles/tree/main/dot-claude/skills/writing-solid-rust
Command: npx skills add https://github.com/89jobrien/dotfiles --skill writing-solid-rust

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill teaches how to structure Rust applications using SOLID principles and hexagonal architecture, enabling clean separation of business logic from infrastructure and improving testability and maintainability.

Core Features & Use Cases

  • Learn to apply SRP, ISP, OCP, DIP, and other SOLID concepts in Rust by defining domain traits (ports) and adapters.
  • Build modular systems with plug-in backends, swap adapters, and testable domain logic across core domains and infrastructure.
  • See real-world patterns and references in the included examples (LLM inferences, UI components, and payment processing) to guide architecture decisions.

Quick Start

Study the SOLID Rust material and open the references to begin implementing a domain-driven, hexagonal Rust project.

Frequently Asked Questions about writing-solid-rust

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I apply hexagonal architecture in Rust to separate domain logic from infrastructure?

Apply hexagonal architecture in Rust by defining domain-focused traits as ports and implementing infrastructure-specific adapters. This separates business logic from external concerns, creating a modular system with plug-in backends and testable domain logic independent of infrastructure frameworks.

What is the best way to structure a Rust application using SOLID principles and domain-driven design?

Structure a Rust application using SOLID principles by defining independent domain types and trait-based ports for dependencies. Implement adapters that map infrastructure errors to domain errors, ensuring the domain remains isolated, testable, and compliant with SRP, ISP, OCP, and DIP.

Can I build modular Rust systems with plug-in adapters for backend services and AI integrations?

Yes, you can build modular Rust systems with plug-in adapters by defining ports as traits in the domain layer. Adapters implementing these ports can be swapped at the composition root, supporting backend services, UI components, and AI inference integrations without modifying core domain logic.

How do I test domain logic independently of infrastructure in a Rust hexagonal architecture?

Test domain logic independently in hexagonal Rust by defining ports as traits and mocking or stubbing adapter implementations at the composition root. This allows unit testing the domain layer without relying on actual database, API, or infrastructure dependencies.

Does hexagonal architecture work for Rust applications processing LLM inferences and payment processing?

Hexagonal architecture works for Rust applications processing LLM inferences and payments by treating these external services as adapters behind domain-defined ports. This isolates domain logic from API changes, enabling testable and maintainable processing logic across different integration points.

When should I not use hexagonal architecture and SOLID principles in a Rust project?

Avoid hexagonal architecture and SOLID principles in small Rust projects where the overhead of defining ports, adapters, and independent domain types exceeds the complexity of the domain logic itself. For simple scripts or prototypes, direct implementation is more efficient than enforcing strict separation.