FILE // refactor-me
● discovery: shipped ○ scope: planned ○ scaffold: planned ▲ output → refactored/src/ ◇ stack: laravel 13 · livewire 4 · flux 2 · tailwind 4 ✷ agents: claude code task sub-agents ✱ resumable state on disk ● discovery: shipped ○ scope: planned ○ scaffold: planned ▲ output → refactored/src/ ◇ stack: laravel 13 · livewire 4 · flux 2 · tailwind 4 ✷ agents: claude code task sub-agents ✱ resumable state on disk
Sheet 01 · The thesis

Don't port the old app.
Hand it to an agent and rewrite it.

refactor-me is a CLI orchestrator. It drives Claude Code sub-agents to read a legacy repo end-to-end, then scaffolds a fresh Laravel + Livewire + Flux app inside it — staged, milestone-scoped, test-first.

$ php artisan refactor:run /path/to/repo

Sheet 02 · The pipeline

Three Artisan stages, in order.

Halts on failure. Pauses for input. The orchestrator is dumb on purpose — the agents do the thinking.

01 ● shipped

refactor:discover {path}

Foundation pass. Spawns Task sub-agents to scope the codebase, writes Claude Code skills + REFACTOR_PLAN.md + .claude/refactor/discovery.json. Internal Q&A loop.

step 01
02 ○ planned

refactor:scope {path} --area=

Per-area deep dives that emit refactored/requirements/<milestone>/week-N/<issue>.md — concrete, milestone-scoped, ready to feed back to the agent.

step 02
03 ○ planned

refactor:scaffold {path}

Generates refactored/src/ — a fresh Laravel + Livewire + Flux + Tailwind app, built from the discovery and scope artifacts.

step 03 → output

Sheet 03 · The artefact

What lands in your repo.

Everything the pipeline writes lives under refactored/ and .claude/refactor/. Your old code stays exactly where it is.

  • Laravel 13. with Livewire 4, Flux 2, Tailwind 4 — the boost-guideline stack

  • Pest 4 tests. feature tests scaffolded per area, pinned to discovery findings

  • Milestone scoping. requirements grouped by milestone/week, each one re-runnable

  • Skills written in. plain Markdown — the agent re-uses them on the next pass

fig. 01 — repo tree, post-pipeline v0.1
cloned-repo/
├─ app/            // untouched, legacy
├─ routes/         // untouched, legacy
├─ 
│
├─ .claude/refactor/
│  └─ discovery.json     ← stage 1 state
│
├─ REFACTOR_PLAN.mdhuman-readable plan
│
└─ refactored/
   ├─ requirements/
   │  └─ m1/week-1/
   │     ├─ auth.md
   │     └─ billing.md
   └─ src/                ← the new app
      ├─ app/
      ├─ resources/
      └─ tests/Pest/

Sheet 04 · Field notes

Why this, not a porting script.

Mechanical translators flatten the parts of a codebase that matter most: the implicit invariants, the load-bearing weirdness, the bits the original author would tell you about over coffee. An agent reading the repo end-to-end can preserve those. refactor-me is the harness that lets it do so deliberately — one milestone at a time, with everything it learns written down and re-readable.