Run this checklist every time
- Does it run? Obvious, and frequently the answer is no
- Do these functions exist, in this language, at this version?
- Are queries parameterised, or is a variable concatenated into SQL?
- Is output escaped?
- Are errors handled, or silently swallowed?
- What about the empty case, the null, the failed request?
- Does it match the surrounding code, or has it invented a different style?
The specific failure patterns
- Invented APIs. A plausible method name that does not exist. Check the documentation
- Outdated syntax. A removed function, or a deprecated argument
- Missing edge cases. The happy path is handled beautifully; the empty array crashes
- Security shortcuts. String-concatenated SQL,
innerHTML with user data, a hardcoded key - Over-engineering. Three abstraction layers where a function would do
Test it before you trust it
Empty input, one item, many items, wrong type, no network. Generated code is written to satisfy the description you gave, not the reality it will meet.
Do not paste blindly into a large file
Add it in a small piece, run it, then continue. A 200-line paste that breaks the page gives you no idea which part is responsible.