Refactor

From devclarityai/environment-setup · View interactive version

Refactor is an AI agent skill from the GitHub repository devclarityai/environment-setup. Refactor legacy code toward a stated goal, with safety. Use when improving readability, adopting patterns, or reducing coupling while preserving behavior.

How to use this skill

Skill file

Use this template to refactor legacy code toward a stated goal, with safety.

INPUTS

INSTRUCTIONS

  1. Restate REFACTOR_GOAL and constraints. Preserve behavior.
  2. Propose a target design (patterns, boundaries, contracts).
  3. Provide a refactored version or representative slices.
  4. Explain rationale trade-offs (perf, readability, testability).
  5. Add safety checks: tests, metrics, and rollout steps.
  6. Show an incremental plan of small commits.
  7. Keep lines ≤80 chars.

OUTPUT FORMAT

Goal & constraints

Diagnosis

Target design

Refactored code (slice)

- old
+ new

Rationale

Safety & verification

Incremental plan

  1. ...
  2. ...

Backout plan

Follow-ups

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.