← All use cases

Refactor your codebase

Strip out unused code and update outdated patterns while behavior stays the same.

ZeroTwo clears out dead code, untangles oversized files, merges repeated logic, and updates outdated patterns, working in small passes that are easy to review.

Advanced
1h

Skills & Plugins

  • Security
    Reviews risky cleanups and dependency changes before you merge.
  • Skill Creator
    Turns a proven checklist into a reusable skill ($skill-creator).

Starter prompt

The billing module in this repo has grown messy: there's dead code, a couple of 1,000-line files, and copy-pasted helpers. Read through it first and don't change anything yet. Then propose a sequence of small cleanup passes, each noting the current behavior, what improves, and the quickest test or command that proves nothing broke. Start with the safest pass and keep public APIs unchanged.

Introduction

Refactoring reduces engineering debt by reshaping the existing system, not migrating the stack. ZeroTwo maps the messy area first, then lands cleanup in small passes with validation. Run it as a Work or Code task against your repo. Aims:

  1. Delete unused code, flags, and shims.
  2. Shrink noisy modules and clarify boundaries.
  3. Adopt the repo's current conventions.
  4. Keep public behavior stable.

How to use

  1. Have ZeroTwo map the area before editing.
  2. Choose one cleanup theme at a time.
  3. Before patching, state current behavior, the intended improvement, and the smallest proving check.
  4. Review and test after every pass.
  5. Treat stack or dependency migrations as separate tasks.

Plan mode (/plan-mode) can draft the refactor plan first, since it keeps that turn read-only.

Use skills for repeatable patterns

Skills help when cleanup rules recur across repos. Add framework, security, and CI skills around risky work, and turn a proven pass into a reusable skill.

Related use cases