suggest-refactor — Claude Code command: use and install
The suggest-refactor command reviews Rust code for clean-architecture violations and returns ranked refactoring steps with code examples.
no license ★ 1,357 updated 2026-03-01
.claude/commands/suggest-refactor.mdWhat suggest-refactor does
The command inspects a Rust codebase for broken layer boundaries. It looks for outer-layer imports in domain code, concrete adapters inside application use cases, and HTTP or database types leaking into application logic. Findings are grouped from P0 to P3, with suggested changes and code samples.
Its declared tools are Read, Grep, Glob, Bash, and Edit. You can narrow the review with an argument such as src/application/ or request a severity-focused pass with --critical. This is for Rust projects: its checks target Rust source layout under src/, so a non-Rust project is the wrong fit.
What it helps with
- spot adapter imports in domain code
- replace concrete use-case dependencies with ports
- move HTTP types out of application logic
- find missing abstractions for external services
- rank architecture fixes by priority
Example prompts for the agent
- Review this Rust project for clean-architecture issues with
/rust:suggest-refactor. - Focus the review on
src/application/with/rust:suggest-refactor src/application/. - Show only critical findings with
/rust:suggest-refactor --critical.
How to install suggest-refactor
Manually: put the files in place
.claude/commands/suggest-refactor.mdCall it with /suggest-refactor. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/suggest-refactor.mdCall it with /prompts:suggest-refactor. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/suggest-refactor.prompt.mdManually: put the files in place
.gemini/commands/suggest-refactor.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about suggest-refactor
How do I install suggest-refactor in Claude Code?
Save the command file at .claude/commands/suggest-refactor.md.
What does suggest-refactor do?
It reviews Rust code for clean-architecture violations, ranks the findings from P0 to P3, and suggests concrete refactoring steps with code examples.
Can I limit the review to one part of a project?
Yes. Pass a path such as src/application/, or use --critical to focus the command on critical findings.