# audit-ports-adapters

The audit-ports-adapters command audits ports and adapters in Rust code, checking trait placement, implementations, and whether use cases depend on abstractions.

- command · `type=command` · Claude Code, Codex, GitHub Copilot, Gemini CLI · ★ 1357 repo stars
- Author: Quintin Henry (https://github.com/qdhenry/)
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/qdhenry/Claude-Command-Suite/tree/HEAD/.claude/commands/rust/audit-ports-adapters.md
- Updated: 2026-03-01
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/commands/audit-ports-adapters

## What it does

The command examines a Rust codebase for its use of hexagonal architecture. It locates port traits, reviews where they live and what their signatures contain, maps them to adapter implementations, then checks whether use cases rely on concrete types. You can narrow the audit to a focus area such as repository ports.

Checks cover domain types in port signatures, async I/O operations, and whether adapters implement the ports. The command also searches application code for signs of trait-based dependency injection and references to concrete adapters. Use cases should depend on port traits; a concrete adapter dependency breaks that inversion.

Save the command as `.claude/commands/audit-ports-adapters.md` to add it to Claude Code. To focus the audit, pass an area after the command name, such as `repositories`.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/commands/audit-ports-adapters.md` — Call it with /audit-ports-adapters. For all projects use ~/.claude/commands/

### Codex

**Manually: put the files in place**
- File: `~/.codex/prompts/audit-ports-adapters.md` — Call it with /prompts:audit-ports-adapters. Codex marks this format deprecated in favour of skills

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/prompts/audit-ports-adapters.prompt.md`

### Gemini CLI

**Manually: put the files in place**
- File: `.gemini/commands/audit-ports-adapters.toml` — Gemini stores commands as TOML: the prompt text goes into the prompt field

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/qdhenry/Claude-Command-Suite/tree/HEAD/.claude/commands/rust/audit-ports-adapters.md

## When to use it
- find port traits declared outside the application layer
- check port signatures for framework types
- map ports to their adapter implementations
- spot use cases coupled to concrete adapters
- look for mock or in-memory port implementations

## Example prompts
- Run a full ports-and-adapters audit of this Rust project: `/rust:audit-ports-adapters`
- Focus the audit on repository ports: `/rust:audit-ports-adapters repositories`

## Similar
- [ports-and-adapters](https://affpapa.org/en/nevibecode/skills/ports-and-adapters.md) — skill · ★ 234 repo stars
- [framework-adapters](https://affpapa.org/en/nevibecode/skills/framework-adapters.md) — skill · 209 installs
- [dspy-adapters-multimodal](https://affpapa.org/en/nevibecode/skills/dspy-adapters-multimodal.md) — skill · ★ 125 repo stars
- [security-audit](https://affpapa.org/en/nevibecode/skills/decebals-security-audit.md) — skill · 364 installs
- [lsp-concurrency-audit](https://affpapa.org/en/nevibecode/skills/lsp-concurrency-audit.md) — skill · ★ 182 repo stars
- [go-dependency-audit](https://affpapa.org/en/nevibecode/skills/go-dependency-audit.md) — skill · ★ 90 repo stars

From the same set: [qdhenry/claude-command-suite](https://affpapa.org/en/nevibecode/by/qdhenry/claude-command-suite.md) — 112 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
