Debugging: root cause first, then changes
Locate the root cause first, then give the smallest change and how to verify it
Prompt
Copy it whole, then replace the brackets with your own contentHandle this coding task: Debugging: Root Cause, Then Change. Code/error: [paste] Environment: [language/version/framework] Requirements: Find the root cause first, then give the minimal change and how to verify. Give your assessment first, then the changes, then how to verify.
Replace the text in [ ] with your own situation; ask long tasks in stages.
How to get better results
Read this before you fill it inFor a clear error where you do not know what to change. Scrub production data before pasting; keep only the key log lines.
Give the conclusion and impact scope first, then only the changed snippets (no full files), and finally one check that proves it works. Flag risky spots separately.
Error: TypeError: Cannot read properties of undefined (reading 'map')\nCode: const list = res.data.items.map(...)\nEnv: React 18 + axios, the API occasionally returns {items: null}Pasting only the error without the code, the model can only guess Pasting a whole file, the point is drowned Not saying "intermittent," so it's treated as always-on
If problems remain after the fix, paste the new error and the changed snippet back; keep debugging on the original approach, don't switch approaches and rewrite.
More like this: Writing code prompts · All prompts