Convert codebase to TypeScript

Refactor all files to TypeScript and run tests until the full suite passes.

prompt
→ Claude
/ralph-loop "Refactor codebase to use TypeScript. Output COMPLETE when all files converted and tests pass." --completion-promise "COMPLETE" --max-iterations 100
claude-code

Use this when

You are migrating an existing JavaScript codebase to TypeScript and the job is too large for one sitting — many files, an existing test suite that must stay green, and no appetite to babysit each batch.

Done when

Done means every file is converted and the full test suite passes — the loop declaring COMPLETE is not the signal, the passing suite is. High cost-risk: 100 iterations on a big repo burns real tokens. Run it in a worktree, commit before starting, and spot-check the types (not just the tests) afterward.

Why it works

The Ralph pattern restarts with fresh context each iteration, so a large migration does not decay as the context window fills. The completion promise (COMPLETE) plus --max-iterations 100 gives the loop both a goal state and a hard stop.

Source: MaouStan

More refactoring loops

Keep refactoring this module until it is clean…

Loop/loop

Community loop loop for refactoring, sourced from github. Verified exit condition, evaluator-gated.

prompt
→ Claude
/loop keep refactoring this module until it is clean, then stop
refactoringmedium riskclaude-code

Run full dev cycle autonomously

Loop/loop

Execute the complete development cycle repeatedly until completion or encountering a blocking issue.

prompt
→ Claude
/loop /dev-cycle # runs the full loop autonomously until done or blocked
refactoringmedium riskclaude-code

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.
refactoringmedium riskclaude-codecodex