/goalrefactoringlow riskintermediatesafety C · 70

Refactor auth module, pass tests

Refactor the authentication module iteratively until all tests pass, stopping after ten attempts.

prompt
→ Claude
/goal "Refactor auth module until all tests pass" --max-iterations 10
claude-code

Source: iamteykimcom

More refactoring loops

Migrate an API import by import

/goalnew

Sweep a codebase from a legacy API to its v2 replacement with tests and typecheck as the safety net, capped at 30 turns.

prompt
→ Claude
/goal every file importing from `./legacy-api` now imports from `./v2-api`, all tests pass, and `npm run typecheck` is clean — stop after 30 turns
refactoringmedium risk

Dead code elimination

/goalloopreponew

Hunt down unreferenced exports, unused files, and unreachable branches, deleting them in small verified steps until the analyzer reports clean.

prompt
→ Claude
/goal `npx knip` reports no unused files or exports — remove one cluster of dead code at a time, run the full test suite and typecheck after each removal, and revert any deletion that breaks them; stop after 15 turns
refactoringmedium risk

Tidy code, one safe change at a time

Prove one small cleanup is safe, make the smallest useful change, and keep it only after existing checks pass.

prompt
→ Claude
Review [repository or code project] for dead code, meaning unreachable or unused code; stale files or comments; unused dependencies; duplication; broken links; inconsistent names; and confusing structure. Protect unrelated, active, uncommitted, generated, and uncertain work. Prove one low-risk cleanup, make the smallest coherent change, then rerun the build, tests, runtime checks, and diff review. Keep only verified improvements. Stop when none remain, progress stalls, verification is unavailable, or approval is required. Return changes, evidence, and deferred candidates.
refactoringmedium risk