← ClaudeAtlas

refactorlisted

Safely restructure code in an isolated git worktree with test-preserved, incremental transformations
bjornjee/agent-dashboard · ★ 11 · Code & Development · score 82
Install: claude install-skill bjornjee/agent-dashboard
<codex_skill_must> 1. Run `mkdir -p` and `git worktree add -b refactor/<name> ... main` as separate `exec_command` calls. 2. Run `make test` before editing; halt if the baseline fails. 3. Make one behavior-preserving change, then run `make test`; repeat. 4. Allowed tools: `exec_command`, `apply_patch`, `spawn_agent`, `wait_agent`. 5. Every `spawn_agent` call must be followed by `wait_agent`. </codex_skill_must> Safely refactor code while preserving all existing behavior. Refactoring goal: $ARGUMENTS ## Instructions Follow these phases in order. Each phase has a gate — do not proceed until the gate is satisfied. Apply all project rules and conventions that are in your context. --- ### Phase 1: Setup 1. Derive a short kebab-case name from the refactoring goal. 2. Derive the app name from the git repo: `basename $(git rev-parse --show-toplevel)` 3. Switch to main: `git checkout main` 4. Pull latest: `git pull origin main` 5. Create branch `refactor/<name>` and worktree `../worktrees/<app>/<name>` from main. Run **two separate `exec_command` tool calls** — do not chain them with `&&`. The dashboard's PostToolUse hook only stamps `worktree_cwd` + `branch` when the command starts with `git worktree add`; a compound `mkdir … && git worktree add …` slips past the regex and leaves the dashboard unable to pin dir or branch. First, ensure the parent directory exists: ``` mkdir -p ../worktrees/<app> ``` Then run `git worktree add -b refactor/<name> ../worktrees/<ap