Home › All prompts › Hit the Slop Wall? Refactor Without Breaking Everything

Mini pack

Free

Hit the Slop Wall? Refactor Without Breaking Everything

Hit the slop wall? Your vibe coded app grew so tangled that every new feature breaks an old one. These 10 free prompts help you see the mess, plan small safe steps, clean it up without changing what the app does, and stop the mess from growing back.

See the mess, plan safe steps, clean it up, and prove nothing changed.

10 prompts in 4 sections. Replace everything in [BRACKETS IN CAPS], then copy and paste into your AI tool.

Download the free PDF

PDF, 17 pages

Written for use with

  • Claude Code or Cursor's Agent: all 10 prompts read your project, run your tests, or change code, so they need a coding tool opened in your project.
  • Safety net: the pack uses git commits on a cleanup branch as the main undo, with Claude Code's /rewind checkpoints and Cursor's Agent checkpoints as extra undo buttons, checked against their docs.
  • Rules files: Prompt 4.2 adds cleanup rules to CLAUDE.md, AGENTS.md, or a file in .cursor/rules.

Written for use with Claude Code or Cursor's Agent. Not yet tested against them.

All 10 prompts

  1. 1.1 Codebase Health Report
  2. 1.2 Write Down What Works Right Now
  3. 2.1 A Cleanup Plan in Small, Undoable Steps
  4. 2.2 Do One Step, Then Stop
  5. 3.1 One Set of Colors, Fonts, and Spacing
  6. 3.2 One Version of Each Component
  7. 3.3 Split a Giant File Safely
  8. 3.4 Prove Nothing Changed
  9. 4.1 A Fix List That Tracks What's Done
  10. 4.2 Rules So the Mess Doesn't Grow Back

Section 1: See the Mess

1.1 Codebase Health Report

Untested: not yet run against a model.

Use this when your app feels tangled but you don't know where the worst problems are. It's for a short report on duplicated code, dead code, and giant files, ranked by how risky each one is.

Use in: Claude Code or Cursor's Agent, opened in your project.

Fill in: [WHAT MY APP DOES] (e.g. "a booking app for dog walkers"), [WHAT KEEPS BREAKING] (e.g. "adding anything to the dashboard breaks the login page", or "nothing specific, it just feels messy").

Give me a health report on my codebase. I'm a beginner, so keep it plain. Don't change any code. Only read and report.

What my app does: [WHAT MY APP DOES]
What keeps breaking: [WHAT KEEPS BREAKING]

Please look through the whole project and find:
1. Duplicated code: the same logic, component, or style copied into more than one place. Name the files.
2. Dead code: files, functions, components, or packages that nothing uses anymore. Say how sure you are, because some code is only used in ways that are hard to spot.
3. Giant files: any file over about 300 lines, with a one-line summary of everything it's doing.
4. Scattered styles: how many different colors, font sizes, and spacing values the code uses, and where they're set.
5. Tangled spots: code that many other parts depend on, or that mixes jobs (like a page that also talks to the database directly).
6. Whether the project has any tests, and what they cover.

Then rank the top 10 problems by risk: how likely each is to cause new bugs, and how hard it would be to fix safely. For each, give one line on why it matters and one line on what fixing it would involve.
End with the one problem you'd fix first, and why.
Keep it to one or two pages. Point to real files, don't guess.

Tips to customize: Ask the AI to save the report as CLEANUP.md in your project, so you can come back to it later (Prompt 4.1 uses it). In Claude Code, you can switch to plan mode first by pressing Shift+Tab until the status bar shows plan mode. In plan mode, Claude reads files and makes a plan but makes no edits until you approve. Cursor has a Plan mode too (also Shift+Tab from the chat input). If the report says you have no tests, do Prompt 1.2 before anything else.

1.2 Write Down What Works Right Now

Untested: not yet run against a model.

Use this when you're about to clean up and you're scared of breaking things that work today. It's for a short checklist of your app's key features and a few simple tests that pin down how they behave now.

Use in: Claude Code or Cursor's Agent, opened in your project.

Fill in: [MY MOST IMPORTANT FEATURES] (e.g. "sign up, log in, create a booking, pay"), [PARTS I PLAN TO CLEAN UP] (e.g. "the dashboard and the shared buttons", or "not sure yet").

Before I clean up my code, I want a safety net: a record of what works right now, so I can tell if a cleanup breaks anything. I've never written tests, so keep it simple. Don't change any app code.

My most important features: [MY MOST IMPORTANT FEATURES]
Parts I plan to clean up: [PARTS I PLAN TO CLEAN UP]

Please:
1. Write a checklist I can click through by hand in about 10 minutes. One line per feature: where to go, what to do, and what I should see. Put the features most likely to be affected by the cleanup first.
2. Recommend the simplest test tool for my stack, or use the one already in my project. Give me the install command if I need one.
3. Write 3 to 6 small tests that check how the most important features behave today, even if that behavior looks odd. Their job is to catch changes, not to judge the code.
4. Run the tests and show me the real output. They should all pass on the code as it is now. If you can't run them, say so and give me the command.
5. Give me one command that runs all the tests, and save the hand checklist as CHECKS.md in my project.

Tips to customize: If a test fails on the code as it is now, don't fix the app yet. Ask the AI whether the test is wrong or the app has a real bug, and write the answer down. Fix real bugs separately, with our Fix My Bugs pack, so they don't get mixed into the cleanup. Commit the tests and CHECKS.md before you start Section 2.

Section 2: Plan Small, Safe Steps

2.1 A Cleanup Plan in Small, Undoable Steps

Untested: not yet run against a model.

Use this when you know what needs cleaning and want a safe order to do it in. It's for a step-by-step plan where each step is small, leaves the app working, and can be undone on its own.

Use in: Claude Code or Cursor's Agent, opened in your project. Plan mode is a good fit.

Fill in: [WHAT I WANT TO CLEAN UP] (e.g. "the top 3 problems from my health report", or paste them), [HOW I CHECK THE APP STILL WORKS] (e.g. "npm test plus the CHECKS.md list", or "I click around by hand").

Make me a plan to clean up my code in small, safe steps. Don't change any code yet. Just make the plan.

What I want to clean up: [WHAT I WANT TO CLEAN UP]
How I check the app still works: [HOW I CHECK THE APP STILL WORKS]

Rules for the plan:
- The app must do exactly the same thing after every step. No new features, no bug fixes, no design changes mixed in.
- Each step should be small enough to review in a few minutes, usually a few files at most.
- Each step must leave the app working, so I can stop after any step.
- Each step gets its own commit, so it can be undone on its own.

For each step, give me:
1. A one-line name.
2. Exactly which files it touches.
3. What could go wrong.
4. How to check it worked: which tests to run and which items in my checklist to click through.

Put the safest, most useful steps first. If a step is risky, split it, or tell me it needs a test first.
Save the plan as a numbered list in CLEANUP-PLAN.md, then stop and wait for me to approve it.

Tips to customize: If the plan has more than about 10 steps, ask for just the first 5 and plan the rest later. Things change as you go. If a step says "and also update everything that uses it," ask the AI to split it into smaller steps.

2.2 Do One Step, Then Stop

Untested: not yet run against a model.

Use this when you're ready to start the plan and want the AI to do one step at a time instead of five. It's for doing a single step, checking it, showing proof, and stopping before the next.

Use in: Claude Code or Cursor's Agent, opened in your project.

Fill in: [STEP NUMBER] (e.g. "3"), [HOW I CHECK THE APP STILL WORKS] (e.g. "npm test plus the CHECKS.md list").

Do step [STEP NUMBER] from CLEANUP-PLAN.md, and only that step.

How I check the app still works: [HOW I CHECK THE APP STILL WORKS]

Rules:
- Change only the files that step lists. If you need to touch another file, stop and ask me first.
- Don't fix bugs, rename things, or "improve" anything that isn't part of this step, even if you notice it. Write it down at the end instead.
- The app must behave exactly the same afterward.

When you're done:
1. Run the tests and show me the real output.
2. List every file you changed and, in one line each, what you changed.
3. Tell me which items from my checklist I should click through by hand for this step.
4. List anything you noticed but didn't touch.
5. Stop. Don't start the next step. Tell me the commit message to use once I've checked it.

Tips to customize: Commit after every step that passes, before you start the next one. If a step breaks something, don't ask the AI to patch it. Go back to your last commit instead (or use Claude Code's /rewind or a Cursor checkpoint), then ask for that step to be split smaller. A fresh chat for every few steps keeps the AI focused.

Section 3: Do the Cleanup

3.1 One Set of Colors, Fonts, and Spacing

Untested: not yet run against a model.

Use this when your app has dozens of slightly different colors, font sizes, or spacing values. It's for collecting them into one small set of named design tokens, and then switching the code over in small batches.

Use in: Claude Code or Cursor's Agent, opened in your project.

Fill in: [HOW MY APP IS STYLED] (e.g. "Tailwind", "plain CSS", or "not sure"), [MY MAIN BRAND COLORS] (e.g. "a dark blue and a bright orange", or "pick from what's used most").

My app uses too many different colors, font sizes, and spacing values. Help me collect them into one small set of design tokens, without changing how the app looks.

How my app is styled: [HOW MY APP IS STYLED]
My main brand colors: [MY MAIN BRAND COLORS]

Step 1 (report only, no changes yet):
1. List every color, font size, and spacing value the code uses, with how many times each appears.
2. Group values that are nearly the same (like five slightly different grays).
3. Propose a short set of named tokens (colors, font sizes, spacing, corner rounding) and show which old values map to each one. Flag any merge that would visibly change how a screen looks.
4. Tell me where the tokens should live in my project, so there's only one place to change them.

Then stop and wait for my OK.

Step 2 (after I approve): create the tokens file, then switch the code over one area at a time (for example, buttons first, then the header). After each area, list the files you changed and tell me which screens to look at. Stop after each area so I can check and commit.

Tips to customize: If you want nothing to change on screen at all, ask the AI to merge exact matches only. You can decide on the "nearly the same" merges later, as a separate design choice. Take a screenshot of your key screens before you start, so you can compare after each area.

3.2 One Version of Each Component

Untested: not yet run against a model.

Use this when the same button, card, form, or modal exists in several slightly different copies. It's for merging them into one shared component, one copy at a time.

Use in: Claude Code or Cursor's Agent, opened in your project.

Fill in: [THE COMPONENT] (e.g. "buttons", "the product card", or "tell me which one is copied most").

My app has several copies of the same component. Help me merge them into one shared version, without changing how anything looks or works.

The component: [THE COMPONENT]

Step 1 (report only, no changes yet):
1. Find every copy of this component in the project, including near-copies with small differences. Name the files.
2. Make a table of the differences between them: looks, props or options, and behavior (like what happens on click or while loading).
3. Propose one shared component with options that cover every real difference. Point out any difference that looks like a mistake rather than a choice, but don't fix it. I'll decide.

Then stop and wait for my OK.

Step 2 (after I approve): create the shared component. Then replace the copies one at a time. After each one, tell me which page to check and stop so I can test and commit. Delete an old copy only once nothing uses it anymore, and show me how you checked.

Tips to customize: Start with the component that's copied most, like buttons. It gives the biggest win. If two copies behave differently on purpose (say, one shows a confirmation and one doesn't), keep that as an option on the shared component instead of forcing them to match.

3.3 Split a Giant File Safely

Untested: not yet run against a model.

Use this when one file has grown so big that the AI keeps breaking it or losing track of it. It's for splitting it into smaller files by job, with the code moved as-is and nothing rewritten.

Use in: Claude Code or Cursor's Agent, opened in your project.

Fill in: [THE GIANT FILE] (e.g. "app/dashboard/page.tsx"), [HOW I CHECK THE APP STILL WORKS] (e.g. "npm test plus the dashboard items in CHECKS.md").

This file is too big. Help me split it into smaller files without changing what the app does.

The file: [THE GIANT FILE]
How I check the app still works: [HOW I CHECK THE APP STILL WORKS]

Step 1 (no changes yet):
1. List every job this file is doing (for example: fetching data, form logic, three separate sections of the page, helper functions).
2. Propose a split: which pieces move to which new files, and what stays. Follow the folder style my project already uses.
3. Tell me what else in the project imports from this file, so nothing breaks when things move.

Then stop and wait for my OK.

Step 2 (after I approve): move one piece at a time. Move the code as-is. Don't rename, rewrite, or "tidy" it while moving. Update the imports. After each piece, run the tests, show me the real output, and stop so I can check and commit.

Tips to customize: "Move it, don't change it" is the key rule. Once the split is done and committed, you can tidy each small file in its own step. If the file has no tests, do Prompt 1.2 for the features it handles first.

3.4 Prove Nothing Changed

Untested: not yet run against a model.

Use this when you've finished a cleanup step and haven't committed it yet. It's for a careful review of the changes that looks for anything the app now does differently, even by accident.

Use in: Claude Code or Cursor's Agent, opened in your project. Best in a fresh chat, so the review isn't done by the same chat that made the change.

Fill in: [WHAT THE CLEANUP WAS SUPPOSED TO DO] (e.g. "merge three button copies into one shared Button").

I just made a cleanup change that should not change what the app does. Check that it really doesn't. Don't change any code. Just review and report.

What the cleanup was supposed to do: [WHAT THE CLEANUP WAS SUPPOSED TO DO]

Please:
1. Look at the changes since my last commit (run git diff, or git diff --stat first for a summary of which files changed).
2. Go through every change and sort it into one of these:
   - Safe: only moved, renamed, or reorganized, with the same behavior.
   - Changed behavior: anything that now works, looks, or saves data differently, even slightly (a different default, a missing check, a changed order of steps, a different style).
   - Not sure: explain what I'd need to check.
3. Check for things that are easy to miss: imports pointing to the wrong place, a deleted file something still uses, an error check that was dropped, or text on the screen that changed.
4. Run the tests and show me the real output.
5. Give me a verdict in one line: "Safe to commit" or "Not yet," with the reasons.

Tips to customize: Any "Changed behavior" item is a reason to stop, even if the change looks like an improvement. Undo it, or move it into its own separate step. Also click through the CHECKS.md items for that area yourself. Tests catch a lot, but not everything.

Section 4: Keep It Clean

4.1 A Fix List That Tracks What's Done

Untested: not yet run against a model.

Use this when you have a long list of problems and the AI keeps re-finding or re-fixing the same ones. It's for one list the AI works through an item at a time, marking each done with proof.

Use in: Claude Code or Cursor's Agent, opened in your project.

Fill in: [MY LIST OF PROBLEMS] (paste them, or write "use the report in CLEANUP.md"), [HOW I CHECK THE APP STILL WORKS] (e.g. "npm test plus the CHECKS.md list"), [HOW MANY ITEMS TO DO THIS SESSION] (e.g. "3").

I want one fix list for my cleanup work, so nothing gets fixed twice and nothing gets forgotten.

My list of problems: [MY LIST OF PROBLEMS]
How I check the app still works: [HOW I CHECK THE APP STILL WORKS]
How many items to do this session: [HOW MANY ITEMS TO DO THIS SESSION]

First, set up the list:
1. Create FIXLIST.md (or update it if it exists). Read it before doing anything else.
2. Give each problem one line with an ID number, a short description, the files involved, and a status: To do, Done, or Skipped.
3. Before adding a problem, check whether it's already on the list, in any status. Don't add duplicates. If it was marked Done but seems back, add a note to that item instead of a new line.

Then work through the list:
4. Take the next To do item. Make the smallest change that fixes it, without changing anything else in the app.
5. Run the checks. Mark it Done only if they pass, and write the proof next to it: the test result and the commit message to use.
6. If you can't fix it safely, mark it Skipped with one line on why, and move on.
7. Stop after the number of items I gave you. Then show me what's Done, what's Skipped, and what's next.
Don't add new features while you work. If you spot a new problem, add it to the bottom of the list as To do instead of fixing it now.

Tips to customize: Keep FIXLIST.md in your project and commit it with each fix, so the next session (or a different AI tool) starts from the same list. Start a new session by saying, "Read FIXLIST.md and continue from the next To do item." Keep the number of items small at first, and check each one yourself before letting it do more.

4.2 Rules So the Mess Doesn't Grow Back

Untested: not yet run against a model.

Use this when your code is cleaner and you want to keep it that way. It's for a short set of rules in your project's rules file, so the AI reuses what exists instead of adding new copies.

Use in: Claude Code or Cursor's Agent, opened in your project.

Fill in: [MY RULES FILE] (e.g. "CLAUDE.md", "AGENTS.md", a file in .cursor/rules, or "I don't have one"), [WHAT WE CLEANED UP] (e.g. "design tokens in styles/tokens.css, one shared Button and Card, the dashboard split into small files").

We just cleaned up my code. Help me write a few rules for my rules file so the AI keeps it clean from now on.

My rules file: [MY RULES FILE]
What we cleaned up: [WHAT WE CLEANED UP]

Please:
1. Look at the project so the rules point to real files and folders.
2. Write 6 to 10 short rules, one line each, that the AI can actually follow. Cover:
   - Use the design tokens. Never add a new color, font size, or spacing value without asking.
   - Reuse the shared components. Search for an existing one before making a new one.
   - Keep files small. If a file is getting near about 300 lines, suggest a split instead of adding more.
   - Don't copy and paste logic. Move shared logic into one place and import it.
   - When cleaning up, change structure only, not behavior, and keep it separate from new features.
   - Run the tests before saying a change is done.
3. Add the rules to my rules file without removing anything already there. If I don't have one, create the right file for my tool and tell me its name.
4. Show me the final rules, and keep the whole section short. Long rules files get followed less.

Tips to customize: Claude Code's docs suggest keeping each CLAUDE.md under about 200 lines, since longer files take up more room and get followed less. They also say /init can write a starting CLAUDE.md for you. In Cursor, project rules live in .cursor/rules, and Cursor also reads an AGENTS.md file. If you use more than one AI tool, our One Rules File pack shows you how to keep one shared rules file. Once a month, run Prompt 1.1 again to catch new mess early.

Get new free packs in your inbox

Optional. Every prompt here is free, and you don't need to sign up to use any of them. We email when we add new free packs. Unsubscribe anytime.

More free packs: Vibe Code Starter Pack Ship It Safe Fix My Bugs Ship It Live Make It Pretty Get Paid Signup Emails That Actually Arrive Lovable Credit Saver One Rules File for Every AI Tool Make Your Claude Code Limit Last Graduate From Lovable First App Store Submission Survive Your First Traffic Spike Get Found on Google First 100 Users Two AIs, One Project It Broke in Production Vibe Code From Your Phone AI Reverse Engineering Run Several AI Agents at Once Claude Code Guardrails Let AI Review Your AI's Code Make Your Cursor Usage Last Privacy Policy and Terms That Match Your App Install Skills, Plugins and MCP Servers Without Getting Burned Say What You Mean Prompt Injection: Don't Let a Web Page or a Strange File Hijack Your Agent Hit Your Limit Mid-Task? Switch AI Tools Without Losing Your Place Don't Let the AI Delete Your Data: Safe Database Changes Make the AI Teach You While It Builds Bolt Token Saver v0 to Production Claude Code Subagents and Skills for Beginners Logins, Tokens and JWTs in Plain English Put Your Web App on Their Phone Add AI Features in Lovable Is Anyone Using It? Simple Analytics for Vibe Coders Use the Cheap Model for the Easy Stuff: Claude Code Model Mixing Ship Updates Without Breaking the Live App: Preview Links, Checks and One-Click Rollback Try to Break It: Stress-Test Your App Before Strangers Do Claude Code Memory: Stop It Forgetting Your Decisions Fix Your Lovable Security Warnings Without Breaking the Live App What Will My App Cost to Run? A Monthly Bill You Can Predict Leave Claude Code Running Without It Getting Stuck Put Your Lovable App on Autopilot: Automations That Check and Report for You Spec and Tests First: Tell the Agent When It's Done Only Change What I Asked: Stop the AI Rewriting Code You Didn't Mention Stop Getting 429'd: Call Other People's APIs Without Hitting Limits Use the Current Version: Stop the AI Writing Outdated Library Code What Did My Agent Actually Do? Read Your Claude Code Session History Your First Google Play Launch: Get Through the 12-Tester, 14-Day Closed Test Will Anyone Want It? Check Your App Idea Before You Build Claude Code Code Mode: Try It Without Breaking Your Safety Checks Coding With Gemini 4 Neon: Make It Double-Check Its Own Work Understand the App You Already Built: A Guided Tour of Your Own Code Your Guess Might Be Wrong: Make the AI Find the Real Cause Before It Fixes Replit Missions: Give Agents a Goal, a Budget and Approval Rules Make Your Antigravity Quota Last: Pick the Right Gemini Model and Check /usage Turn a Claude Artifact Into a Desktop App, Without Giving It Too Much Access Built It for Work? Make Sure Only Your Team Can Open It Plan Before It Builds: Use GitHub Spec Kit So the Agent Builds the Right Thing Saves That Stick: Fix Data That Disappears Rebuilt Your Site With AI? Make Sure Google Can Still See Every Page Subscriptions and Paywalls: Gate Features by Plan Your AI App Builder Is Shutting Down: Get Your Code, Data and Domain Out Your Own Android App From a Prompt: Build It in Google AI Studio and Put It on Your Phone Backups You Can Actually Restore: Check, Copy and Test Your Supabase Data Accessibility Pass Before You Ship: Make Your App Work With a Keyboard, a Screen Reader and Zoom Update Your Dependencies Without Breaking the App: npm Updates, Audits, Major Upgrades and Dependabot