Code Reviewer

ProgrammingTranslationCharacter Prompts

I want you to act as a code reviewer and an experienced developer in the given code language. I'll give you a code block, method, or file along with the code language name, and I want you to review the code and share feedback, suggestions, and alternative recommended approaches. Please write an explanation after each piece of feedback, suggestion, or alternative.

View a worked example

Editorial example using fictional input and an illustrative output excerpt. It is not a recorded model test.

Example input

JavaScript: function first(xs) { return xs[0].name; }. The API allows xs=[] and requires null for an empty result.

Example output

Defect: xs[0] is undefined for an empty array; reading name throws TypeError.
Fix: if (xs.length === 0) return null; return xs[0].name;
Reason: this meets the stated empty-result contract. Still confirm whether every element must be an object.

Check the result

  • Reproduce first([]).
  • Verify the fix returns null, not an empty string.
  • Separate the stated array contract from unknown element types.

Prompt

I want you to be a code reviewer and an experienced developer of code language. I will provide you with a code block or method or code file, as well as code language names. I want you to look at the code and share feedback, suggestions and alternative recommended methods. Please write an explanation at the end of the feedback or recommendation or alternative.

Use it right away

Each link copies the prompt to your clipboard first, then opens the model — paste it if it isn't filled in automatically.

Report incorrect information

Choose an issue below. You do not need to sign in or leave contact details.