plugins/sc-refactor/skills/sc-refactor-review/SKILL.md
This skill SHOULD be used when the user asks to "review code", "find dead code", "check for duplication", "simplify the codebase", "find refactoring opportunities", "do code cleanup", "check naming consistency", "analyze test organization", "run codebase health check", "review my PR", "refactor this code", "extract method", "rename variable", "consolidate duplicates", "adversarial review", "red team review", "find ways to break this", "multi-model review", "get multiple AI opinions on this code", "hunt bugs", "find bugs", "bug hunt", or "adversarial bug hunt". Routes to specialized analysis agents, refactoring workflow, multi-model adversarial review, or adversarial bug hunt based on the type of request.
npx skillsauth add kylesnowschwartz/simpleclaude sc-refactor-reviewInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Reference guide for routing review and refactoring requests to specialized agents.
| Command | Use When | Invokes |
|---------|----------|---------|
| /sc-refactor:sc-refactor | Refactor code (plan or execute) | sc-refactor-planner + sc-refactor-executor |
| /sc-refactor:sc-review-pr | Reviewing a PR for quality with ticket context | sc-code-reviewer + sc-structural-reviewer |
| /sc-refactor:sc-pr-comments | View unresolved PR review comments | Scripts (GraphQL) |
| /sc-refactor:sc-resolve-pr-parallel | Batch resolve all PR comments | sc-pr-comment-resolver (parallel) |
| /sc-refactor:sc-cleanup | Post-AI session cleanup (debug statements, duplicates) | 4 agents (dead-code, duplication, naming, test) |
| /sc-refactor:sc-structural-check | Verify structural completeness (wiring, configs) | sc-structural-reviewer |
| /sc-refactor:sc-codebase-health | Full codebase analysis | All 6 agents in parallel |
| /sc-refactor:sc-adversarial-review | Multi-model adversarial review | Codex CLI + Gemini CLI + Claude |
| /sc-extras:sc-adversarial-hunt | Adversarial analysis with competing agents | 3 Explore agents (maximizer, skeptic, arbiter) |
| Agent | Focus | Color |
|-------|-------|-------|
| sc-refactor-planner | Analyze code, recommend refactoring opportunities | yellow |
| sc-refactor-executor | Execute ONE surgical refactoring with test verification | green |
| sc-structural-reviewer | Change completeness, orphaned code, dev artifacts | blue |
| sc-duplication-hunter | Copy-paste, structural, logic duplication | yellow |
| sc-abstraction-critic | YAGNI violations, over-engineering, wrapper hell | orange |
| sc-naming-auditor | Convention violations, semantic drift | cyan |
| sc-dead-code-detector | Unreferenced exports, orphan files, commented code | red |
| sc-test-organizer | Test structure, missing tests, fixture sprawl | green |
| sc-pr-comment-resolver | Implement PR review comment changes | blue |
External dependency (from sc-core):
sc-code-reviewer - Bugs, security, CLAUDE.md complianceMatch the user's request to the appropriate command or agents:
| User Intent | Route To |
|-------------|----------|
| "refactor", "extract method", "rename", "consolidate", "inline" | /sc-refactor |
| "refactoring opportunities", "what should I refactor" | /sc-refactor (plan mode) |
| "review PR", "check my PR", "PR review" | /sc-review-pr |
| "PR comments", "view comments", "unresolved comments" | /sc-pr-comments |
| "resolve comments", "fix PR feedback", "address review" | /sc-resolve-pr-parallel |
| "clean up", "after AI session", "find debug", "console.log" | /sc-cleanup |
| "audit", "structural check", "verify wiring", "missing config" | /sc-structural-check |
| "health check", "full analysis", "comprehensive" | /sc-codebase-health |
| "adversarial review", "red team", "break this code", "multi-model" | /sc-adversarial-review |
| "bug hunt", "find bugs", "hunt bugs", "adversarial bug hunt" | /sc-extras:sc-adversarial-hunt |
| "dead code", "unused", "orphan" | sc-dead-code-detector |
| "duplicate", "DRY", "repeated" | sc-duplication-hunter |
| "simplify", "YAGNI", "over-engineer" | sc-abstraction-critic |
| "naming", "consistency", "convention" | sc-naming-auditor |
| "test organization", "test structure" | sc-test-organizer |
| "structural", "complete changes" | sc-structural-reviewer |
Task(
subagent_type: "sc-refactor:sc-[agent-name]",
prompt: "Analyze [target] for [focus area]. Report findings with confidence scores."
)
Spawn all relevant agents in a single message with run_in_background: true:
Task(subagent_type: "sc-refactor:sc-duplication-hunter", run_in_background: true, prompt: "...")
Task(subagent_type: "sc-refactor:sc-abstraction-critic", run_in_background: true, prompt: "...")
You MUST use the results delivered in task-notifications directly — do NOT call TaskOutput on completed background agents, as the task registry purges completed entries and TaskOutput will fail with "No task found".
Task(subagent_type: "sc-refactor:sc-structural-reviewer", run_in_background: true, ...)
Task(subagent_type: "sc-refactor:sc-duplication-hunter", run_in_background: true, ...)
Task(subagent_type: "sc-refactor:sc-abstraction-critic", run_in_background: true, ...)
Task(subagent_type: "sc-refactor:sc-naming-auditor", run_in_background: true, ...)
Task(subagent_type: "sc-refactor:sc-dead-code-detector", run_in_background: true, ...)
Task(subagent_type: "sc-refactor:sc-test-organizer", run_in_background: true, ...)
After agents complete, synthesize findings by priority:
## [Category] Analysis
### High Priority (confidence >= 90)
- [finding]: [description] ([file:line])
### Medium Priority (confidence 80-89)
- [finding]: [description] ([file:line])
### Recommendations
- [actionable next step]
Context-aware PR review with ticket integration. Gathers:
Then runs parallel review agents focused on the PR diff.
Post-AI session cleanup. Spawns 4 agents to find:
Offers auto-fix for immediate issues (debug removal, dead code deletion).
Structural completeness verification. Uses sc-structural-reviewer to check:
Reports PASS/FAIL per category with fix suggestions.
Surgical code refactoring workflow with two modes:
Plan Mode (no specific action given):
Execute Mode (specific action given):
Example usage:
/sc-refactor src/utils - Analyze for opportunities/sc-refactor extract duplicate validation in auth.ts - Execute specific refactoringKey constraints:
Comprehensive health check running all 6 agents in parallel. Produces:
Offers auto-fix for quick wins after analysis.
Multi-model adversarial review using external AI CLIs. Runs OpenAI Codex, Google Gemini, and Claude in parallel against the same target with an attacker's mindset.
Value: Model diversity. Different architectures find different blind spots. Findings categorized as:
Requires: codex and/or gemini CLI installed. Degrades gracefully to whichever is available + Claude.
Example usage:
/sc-adversarial-review — Review uncommitted changes/sc-adversarial-review branch — Review current branch vs main/sc-adversarial-review src/auth/ — Review specific directoryDomain-agnostic adversarial analysis with three competing agents (maximizer, skeptic, arbiter). Works on code, plans, docs, configs, or any artifact. Use /sc-extras:sc-adversarial-hunt with a file path, staged, branch, or pr <number> as target.
testing
Use when writing or editing a Slack message, email, pull request body, GitHub issue, Reddit post, agenda, or doc. Enforces a direct, warm, unfilled tone and removes AI tells. Always scores the final draft and runs a self-audit pass before delivery.
development
Reframe code design through functional programming principles for agent-assisted development. This skill SHOULD be used when the user says "think functional", "think FP", "make this pure", "separate effects", "where should this side effect go", "this function does too much", "how should I structure this for agents", "make this easier to review", "reduce context needed", or when planning module structure, store design, or code that agents will write and humans will review. Applies FP discipline within any language to maximize agent effectiveness and human reviewability.
development
Use when the user is clarifying beliefs, assumptions, goals, or framing before committing to decision or plan.
testing
Audit and improve project memory files (CLAUDE.md, AGENTS.md, .claude.local.md) — assess against a quality rubric, then apply additions and removals. This skill SHOULD be used when the user asks to audit, improve, edit, fix, tighten, rewrite, or update a memory file, or to check whether one is too long, stale, or bloated.