# suggest-refactor

The suggest-refactor command reviews Rust code for clean-architecture violations and returns ranked refactoring steps with code examples.

- 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/suggest-refactor.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/suggest-refactor

## What it 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.

## Install

### Claude Code (native platform)

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

### Codex

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

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/prompts/suggest-refactor.prompt.md`

### Gemini CLI

**Manually: put the files in place**
- File: `.gemini/commands/suggest-refactor.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/suggest-refactor.md

## When to use it
- 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
- 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`.

## Similar
- [typescript-refactor](https://affpapa.org/en/nevibecode/skills/typescript-refactor.md) — skill · 808 installs
- [163-java-profiling-refactor](https://affpapa.org/en/nevibecode/skills/163-java-profiling-refactor.md) — skill · 359 installs
- [rust-refactor](https://affpapa.org/en/nevibecode/skills/rust-refactor.md) — skill · 331 installs
- [view-refactor](https://affpapa.org/en/nevibecode/skills/view-refactor.md) — skill · 52 installs
- [suggest-rule](https://affpapa.org/en/nevibecode/commands/suggest-rule.md) — command · ★ 1104 repo stars
- [refactor-cleaner](https://affpapa.org/en/nevibecode/agents/affaan-mustafa-refactor-cleaner.md) — subagent · ★ 6739 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
