/refactor

Refactor a file toward a stated goal, or convert it toward another language / style. Interactive apply when appropriate.

/refactor <file> <goal>

Refactor with a specific instruction.

/refactor utils.py extract-method for parse_config

Common goal patterns: extract-method · extract-class · simplify · modernize · convert to another language.

Examples

/refactor app/main.py simplify nested conditionals
/refactor legacy.js convert to typescript
/refactor svc.py extract-class for ConfigLoader

Safety

  • Confirm before destructive applies when prompted
  • Prefer git-clean trees so you can diff / revert
  • Run tests after applying (agent can do this via a follow-up task)