audit-ports-adapters — Claude Code command for Rust audits
The audit-ports-adapters command audits ports and adapters in Rust code, checking trait placement, implementations, and whether use cases depend on abstractions.
no license ★ 1,357 updated 2026-03-01
.claude/commands/audit-ports-adapters.mdWhat audit-ports-adapters 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.
What it helps with
- 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 for the agent
- 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
How to install audit-ports-adapters
Manually: put the files in place
.claude/commands/audit-ports-adapters.mdCall it with /audit-ports-adapters. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/audit-ports-adapters.mdCall it with /prompts:audit-ports-adapters. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/audit-ports-adapters.prompt.mdManually: put the files in place
.gemini/commands/audit-ports-adapters.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about audit-ports-adapters
How do I install audit-ports-adapters in Claude Code?
Save the command file at .claude/commands/audit-ports-adapters.md.
What does audit-ports-adapters do?
It reviews ports and adapters in Rust code, including trait locations, adapter implementations, and dependencies in use cases.
What does it check in port traits?
It examines signature types, async I/O operations, responsibility boundaries, and framework types in signatures.