# Improve Rust Hexagonal Architecture

Rust services often mix domain logic with databases, HTTP frameworks, and wiring code. This skill reviews those boundaries and suggests cleaner ports, adapters, and tests.

## Install

```bash
npx skillstore add emillindfors/hexagonal-advisor
```

## Metadata

- Status: approved
- Slug: emillindfors-hexagonal-advisor
- Version: 1.0.0
- Author version: 1.0.0
- Skillstore revision: r1
- Version status: valid
- Tree hash: 7668dcbb9792256cc0897845653391ff39c6e4a92d3bf9b9fe293484369c361e
- Author: EmilLindfors
- GitHub username: EmilLindfors
- License: MIT
- Repository: https://github.com/EmilLindfors/claude-marketplace/tree/main/plugins/rust-hexagonal/skills/hexagonal-advisor
- Ref: a06681402992ceae98ba04d54cfd4ab004862696
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands, network, env\_access
- Quality score: 79
- Quality tier: bronze
- Public page: https://skillstore.pages.dev/skills/emillindfors-hexagonal-advisor
- Manifest: https://skillstore.pages.dev/api/skills/emillindfors-hexagonal-advisor/manifest

## Capabilities

- Identifies domain code that depends on infrastructure types such as SQL clients or framework models.
- Suggests port traits for repositories, services, and external dependencies.
- Reviews adapter implementations for business logic leakage and dependency direction.
- Recommends composition-root wiring for Rust services and repositories.
- Explains testing strategies using mock repositories and domain-focused assertions.

## Use Cases

- Refactor a Coupled Service: Review a Rust service that directly uses database or HTTP clients and plan cleaner domain boundaries.
- Review Pull Requests: Check whether new repository, service, or handler code follows ports and adapters principles.
- Standardize Service Boundaries: Create consistent guidance for domain models, port traits, adapters, and composition roots across services.

## Prompt Templates

### Review Basic Service Boundaries

```
Review this Rust service for hexagonal architecture issues. Focus on domain purity, dependency direction, and simple refactoring steps.
```

### Define Ports and Adapters

```
Analyze these repositories and service traits. Suggest port definitions, adapter responsibilities, and names that match the existing Rust codebase.
```

### Plan a Testable Refactor

```
Create an incremental refactoring plan for this coupled Rust module. Prioritize tests, mock ports, and changes with low migration risk.
```

### Audit Application Composition

```
Audit this Rust application composition root and module layout. Identify boundary violations, dependency wiring issues, and long-term architecture risks.
```

## Limitations

- It reviews architecture from visible code and does not run tests or compile projects.
- It focuses on Rust examples and may need adaptation for other languages.
- It provides guidance, not automated refactoring.
- It cannot inspect files unless the host tool provides readable project context.

## Best Practices

- Share the relevant service, domain, adapter, and test files together.
- Ask for incremental refactoring steps when the codebase is large.
- Verify recommended boundaries with your team naming conventions and module structure.

## Anti Patterns

- Do not ask it to replace product architecture decisions without project context.
- Do not apply every suggestion mechanically when legacy constraints are intentional.
- Do not use it as a substitute for compiling, testing, or profiling the application.

## Security Audit

- Audited at: 2026-07-06T14:52:29.88\+00:00
- Summary: All static alerts are false positives caused by Markdown fences and Rust sample code. I found no executable scripts, prompt injection, secret access, or data exfiltration intent in SKILL.md.

## Stats

- Views: 171
- Downloads: 10
- Favorites: 0
- Popularity score: 0
