Refactor With the Constraints Stated

Featured intermediate
0.0 0 uses Aug 14, 2026 Coding & Development
Works with: ClaudeChatGPTGitHub Copilot
Save
The Prompt
Refactor the [LANGUAGE] code below.

CONSTRAINTS — these are hard:
- Language/runtime version: [VERSION]. Do not use anything newer.
- Behaviour must be identical, including error cases and edge cases.
- Keep the public signature unless I say otherwise.
- Match the surrounding style: naming, comment density, idiom.

Goals, in priority order: correctness, then readability, then performance.

Return:
1. The refactored code
2. A numbered list of every change and the reason
3. Anything you noticed that is a real bug — separately, NOT fixed inline, so I can decide
4. Any behaviour you could not preserve, stated plainly

If the code is already fine, say so instead of churning it.

CODE:
[CODE]
Variables — replace these:
[CODE]· The code to refactor [LANGUAGE]· e.g. PHP, TypeScript, Python [VERSION]· e.g. PHP 8.1, Node 18
Use with these AI models
Claude
Anthropic
Use Now
ChatGPT
OpenAI
Use Now
GitHub Copilot
GitHub
Use Now
Related Prompts
Tests for the Cases That Actually Break
Coding & Development · code

Generates a test suite weighted toward boundaries and failure paths, not happy paths.

0.0 0
Code Review That Ranks by Severity
Coding & Development · code

A review that separates real bugs from taste, so you know what must be fixed.

0.0 0
Debug From a Stack Trace
Coding & Development · code

Works backwards from the error to the cause and proposes the smallest fix.

0.0 0
Rate this Prompt
0.0 · 0 ratings
Log in to rate
Performance
0
Uses
0
Copies
0
Saves
0
Shares
Prompt Details
CategoryCoding & Development
Typecode
Difficultyintermediate
Tokens380
CreatedAug 14, 2026
UpdatedAug 14, 2026
Share