Skip to content
agentscamp

Refactor Commands

A curated collection of 4 refactor commands for building with AI coding agents.

Command

Extract Function

Extract a code region into a well-named function and update the call site.

/extract-function<file:lines or description>
Command

Optimize Imports

Remove unused imports and organize the rest in a file or directory per the project's conventions — preferring the project's own import tool where one is configured — without changing behavior.

/optimize-imports<file, directory, or empty for the current changed files>
Command

Refactor

Refactor the target for readability and structure without changing behavior.

/refactor[file or function]
Command

Rename Symbol

Safely rename a symbol project-wide, distinguishing the real symbol from coincidental substring matches.

/rename-symbol<oldName> <newName>