Loop/Prompt Library / Code quality & refactoring
๐ Safe refactor (keep the shape)
Improves one part of the code, one small change at a time, without changing how the rest of the system talks to it.
Use it when: You want one area cleaner, faster, or better typed, but nothing outside it should notice.
๐ Stops when: The goal you named is met and every test, type check, and lint check still passes. Or five rounds pass with no progress.
Copy this loop
Improve [file or module] so that [measurable goal, e.g. 'no function over 50 lines']. First write down how it behaves today and what other code depends on it. Then make one small change at a time. After each change, run the tests, type checks, lint, and any code that uses this module. Keep a change only if everything still passes. Do not change public function names or inputs unless I say so. Stop when the goal is met, or after [5] rounds, or if you need my approval. Show me the diff, what depends on it, and what you tried and threw away.
Review every change the agent makes before you keep it. Set a budget or round limit โ the prompt includes one.
Idea from Forward Future's Loop Library ยท by Subramanyam Badhika (@subbu6699). Prompt rewritten in plain English by FixKit AI.
More loops like this
Refactor until the design feels right
Reshapes a messy codebase step by step, testing and saving a checkpoint after each big step.
Tidy-up pass
Finds small messes like unused code, old comments, and broken links, and cleans them up one safe fix at a time.
Change it everywhere
After you change a value like a version number or a name, it hunts down every old copy so nothing is left out of date.
Branch and worktree cleanup
Sorts through old branches, pull requests, and work-in-progress, rescues anything useful, and removes what is truly dead.
React Doctor: perfect score
Uses the React Doctor tool to push every React app in a project to a real 100 out of 100 health score.
React Doctor: small-batch fixes
Fixes a handful of real React problems at a time and keeps only the fixes that make the scan better.
