/looprefactoringmedium riskintermediatesafety C · 65Forward Futurepre-dates current gate · under review

Repair React issues in small batches

Baseline the scan, fix a small batch of real errors or warnings, and verify each change improves it without regressions.

prompt
→ Claude
Run `pnpm exec react-doctor . --verbose --yes --offline --fail-on none` to record the baseline, then rerun with `--fail-on error`. Fix at most five genuine findings, run the same scan and relevant project checks, and keep only verified improvements. Clear errors before high-confidence warnings. Stop when clean, blocked, approval is required, a finding is false-positive, or another pass makes no measurable progress. Finish with baseline and final results, retained fixes, reverted attempts, checks, and remaining findings.
claude-code · codex

Use this when

Use this when a React codebase has actionable React Doctor errors or warnings and the safest repair strategy is to work in small, verified batches.

How it runs

  1. Record the complete React Doctor baseline before editing.
  2. Choose up to five genuine errors, trace their causes, and make the smallest coherent repairs.
  3. Rerun the same scan and relevant repository checks, reverting changes that do not produce a verified improvement.
  4. Repeat for remaining errors and then high-confidence warnings until a terminal state is reached.

Done when

React Doctor improves without introducing regressions. Compare the baseline and final scan under the same command and confirm each retained change with the repository checks relevant to the files touched.

Why it works

Small batches keep the causal link between a repair and the resulting scan clear. Repeating the same scan and repository checks prevents a cleaner diagnostic score from masking a product regression.

Implementation note

Do not manufacture a clean result by disabling rules, excluding files, adding suppressions, or deleting meaningful behavior. Ask before dependency upgrades, destructive changes, or actions outside the repository.

Source: Forward Future

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