Code Refactoring
Explicitly stating that external behavior must be preserved prevents breaking changes. Requiring a change log with rationale makes the refactoring reviewable and educational.
Refactor the following {{language}} code to improve {{refactoring_goal}}.\n\nOriginal code:\n{{original_code}}\n\nConstraints:\n- Maintain the exact same external behavior (inputs and outputs must not change)\n- Do not add new dependencies unless absolutely necessary\n- Follow {{style_guide}} conventions\n\nProvide:\n1. The refactored code\n2. A bullet list of every change made and why\n3. Before/after comparison of any metrics that changed (lines of code, cyclomatic complexity, number of parameters)\n4. Any risks or trade-offs introduced by the refactoring
Variables to customize
Why this prompt works
Explicitly stating that external behavior must be preserved prevents breaking changes. Requiring a change log with rationale makes the refactoring reviewable and educational.
What you get when you save this prompt
Your workspace unlocks powerful tools to iterate and improve.
AI Optimization
One-click improvement with structure analysis and pattern suggestions.
Version History
Track every edit. Compare versions side-by-side with word-level diffs.
Folders & Tags
Organize your library with nested folders, tags, and drag-and-drop.
$ npm i -g @promptingbox/mcpUse Everywhere
Access prompts from Claude, Cursor, ChatGPT & more via MCP integration.
Your prompts, organized
Save, version, and access your best prompts across ChatGPT, Claude, Cursor, and more.