prompts library
Refactoring
System Text-to-Speech Ready
Slide: 0:00 / 0:00
Slide 1 of 0Interactive Deck
Full Lesson Reference
For improving existing code without changing what it does.
Simplification
General cleanup
This file has gotten messy. Clean it up without changing functionality.
Remove complexity
terminal
[Feature] feels over-engineered.
Simplify it — we don't need [unnecessary capability].Consolidate
We have similar code in [places]. Can we consolidate this?
Organization
Split file
This file is getting long. Split it into logical pieces.
Move code
Move [code/feature] to its own file. It doesn't belong in [current location].
Rename
Rename [thing] to [new name]. It's confusing as-is.
Group related
terminal
Group related [functions/components] together.
The current organization is confusing.Improving Quality
Make readable
Make this code more readable. I want to understand it when I come back later.
Add comments
Add comments explaining [the non-obvious parts] of this code.
Remove dead code
Remove any code that's not being used.
Preparing for Growth
Before adding feature
terminal
I want to add [feature] soon. Should we restructure anything first to make that
easier?Extensibility
terminal
We might need to [future capability] later.
Is our current structure going to make that hard?Performance
Make faster
[Feature] feels slow. Can we make it faster?
Identify bottlenecks
Where are the performance bottlenecks in [feature]?
Fixing Bad Patterns
Something feels wrong
terminal
Something about how [feature] is built feels wrong, but I can't articulate it.
Is there a better way to structure this?Tech debt
What's the most important thing to clean up in this codebase?
Safe Refactoring
Check before changing
terminal
I want to refactor [thing]. Before we do:
- What could break?
- How do we verify it still works after?Small steps
Let's refactor [thing] in small steps so we can verify each change works.
Exercises
- Run the "Check before changing" prompt on a file you want to refactor, then actually verify each item it lists before changing anything — note whether the "what could break" list matched reality.
- Use the "Tech debt" prompt to ask Claude what's most worth cleaning up, pick one item, and tackle it with the "Small steps" prompt.
- Before your next feature, run the "Before adding feature" prompt and decide whether the suggested restructure is worth doing first — record why you did or didn't.