hexagonal-advisor

Analyze Rust code for hexagonal architecture violations and ports-and-adapters separation.

2|1|Updated Oct 31, 2025
One-click install
npx skills add https://github.com/EmilLindfors/claude-marketplace --skill hexagonal-advisor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hexagonal-advisor
Source: https://github.com/EmilLindfors/claude-marketplace/tree/main/plugins/rust-hexagonal/skills/hexagonal-advisor
Command: npx skills add https://github.com/EmilLindfors/claude-marketplace --skill hexagonal-advisor

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

You are an expert at hexagonal architecture (ports and adapters) in Rust. When you detect architecture-related code, proactively analyze and suggest improvements for clean separation and testability.

Core Features & Use Cases

  • Dependency direction checks to ensure domain logic is not coupled to infrastructure
  • Suggestions for port definitions (repositories, services, external services)
  • Guidance on clean testability through adapters and mocks

Quick Start

Analyze a module with service and repository patterns and propose ports/adapters changes to improve testability.

Frequently Asked Questions about hexagonal-advisor

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

FAQPage Schema
How do I detect hexagonal architecture violations in Rust code?

Hexagonal architecture violations occur when domain logic couples to infrastructure—database queries in business logic, HTTP calls in services, or adapters importing domain code. Analyze your codebase for dependency direction: domain should depend on ports (interfaces), never adapters (implementations). This Skill scans for leaks and recommends ports-and-adapters refactoring to restore clean boundaries.

What's the difference between ports and adapters in Rust architecture?

Ports are domain-facing interfaces that define what external capabilities your business logic needs; adapters implement those ports to connect to real infrastructure like databases or HTTP clients. In Rust, ports are traits, adapters are concrete implementations. Separating them ensures domain logic remains testable and independent of technology choices.

How do I structure repositories and services for testability in Rust?

Define repository and service ports as traits in your domain, then implement them as adapters in infrastructure code. This decoupling lets you inject mock adapters during testing without touching domain logic. This Skill provides templates and refactoring guidance to restructure existing code into clean ports-and-adapters patterns for Rust services.

Can I apply hexagonal architecture to an existing Rust service?

Yes. Hexagonal architecture fits services, repositories, and domain logic boundaries in any stage of development. This Skill analyzes your current code for architecture problems—business logic mixed with database access, infrastructure leaking into domain—and provides concrete refactoring steps to incrementally adopt ports-and-adapters separation without rewriting from scratch.

What happens when business logic couples to database or HTTP code?

Tight coupling makes testing expensive, forces you to mock external systems, and locks your domain to specific technologies. It violates hexagonal architecture's core principle: domain logic should depend inward on ports, never outward on infrastructure. This Skill detects these violations and recommends adapter-based separation to restore testability and independence.

Do I need to refactor my entire codebase for hexagonal architecture?

No. Hexagonal architecture works incrementally: identify the highest-impact boundary violations—where business logic couples most tightly to infrastructure—and refactor those first. This Skill prioritizes recommendations by dependency-direction risk, so you can improve architecture in focused, manageable steps.