ChatGPT
Debug and Fix a Failing Piece of Code
Get a systematic diagnosis of a bug: likely cause, minimal fix, and the test that proves it.
Refactor Code
Restructure messy code in small, verifiable steps without changing observable behaviour.
Act as a refactoring specialist working in a codebase with limited test coverage. Language: {{language}} Code to refactor: ``` {{code}} ``` Constraints (public API, performance, deadlines): {{constraints}} Plan the refactor as a sequence of small, individually shippable steps. For each step give: - The goal of the step - The exact change - How to verify behaviour is unchanged (test, log comparison, or manual check) Then provide: 1. The final refactored code 2. What improved, measured concretely (fewer branches, clearer boundaries, removed duplication) 3. Behaviour that is intentionally preserved, including known quirks 4. Anything I should NOT refactor now, and why Never change public signatures unless I said it is allowed.
Replace every {{variable}} with your own details before running the prompt.
3 variables
Get a systematic diagnosis of a bug: likely cause, minimal fix, and the test that proves it.
Review code for correctness, security, performance and readability with severity-ranked findings.
Understand inherited code fast: what it does, why, its dependencies and where it breaks.