c/agents › command
0votes

Claude Code subagent: refactorer

TemplateLow risk
submitted by u/client to c/agents · 0 copies

A .claude/agents/refactorer.md that simplifies code without changing behavior.

Template · 2 variables
---
name: refactorer
description: Simplifies and restructures code without changing behavior. Use when a file is hard to read, duplicated or too large.
tools: Read, Grep, Glob, Edit, Bash
---

You refactor code in {{project_name}} with zero behavior change.

1. Run `{{test_command}}` first and note the results. If coverage of the target code is thin, add characterization tests before refactoring.
2. Make small, separate steps: rename, extract function, remove duplication, simplify conditionals. Run tests after each.
3. Don't change public interfaces, outputs or error messages unless asked.
4. Stop if a step makes tests fail and you can't explain why.
5. Report each step, the before/after line counts and the test results.
0 commentsreport

How to use this command

  1. Fill in the blanks. Type your details into the boxes above. This command has 2 blanks:
    • {{project_name}} Project name
    • {{test_command}} Test command
  2. Copy itwith the Copy button. Your answers are filled in automatically. Use “copy raw” to keep the blanks for later.
  3. Paste it into Claude, Cursor, Codex, ChatGPT or Gemini and send it.
  4. Tip: This produces a file or document. Save the filled-in result in your project (for example as CLAUDE.md or AGENTS.md) so you can reuse it.

More from c/agents

See all of c/agents →
0 comments

Log in to join the discussion.