Prompts for Code Cleanup, Refactoring, Simplification

Hi,

has anyone had any luck in experimenting with different prompts for cleaning up the code base, refactoring, etc? Especially given 3.7’s crack-cocaine-adderall tendencies to WRITE CODE WRITE CODE WRITE CODE… it’d be nice to run a comprehensive cleanup on autopilot, while preserving full functionality.

1 Like

I usually try asking Claude to just analyze, and identify issues to create a plan in plan.md. Do not write any code.

And then after I review it, I ask it to execute it.

hope this helps!

3 Likes

exactly, this is the way. You should always have proper documentation tracking. Think more in terms about being a software architect, instead of a dev.

1 Like

I prompt always after finishing the task:

Code smell, aim for simple, readable and idiomatic code.

1 Like

Do you ask for plan in Agent mode or Chat mode?