💻 Coding & Development
Code Review Assistant
Example outputs
Here is what ChatGPT, Claude, and Gemini typically return for this prompt:
**Code Analysis:** Your function correctly identifies prime numbers, but has efficiency concerns. The nested loop creates O(n²) complexity, which will slow significantly for larger inputs. **Specific Feedback:** The inner loop (line 4) checks all numbers up to `num`, but you only need to check up to √num. Also, checking even numbers after 2 is unnecessary. **Improvement Suggestions:** Implement the Sieve of Eratosthenes for better performance, or at minimum, skip even numbers and limit your range to `int(num**0.5) + 1`.
This prime-finding function works but suffers from significant inefficiency. The nested loop structure results in quadratic time complexity, and you're doing unnecessary work by checking divisibility against all numbers rather than just up to the square root. I'd recommend either implementing a sieve algorithm or, at minimum, adding `if num > 2 and num % 2 == 0: continue` before your inner loop and changing `range(2, num)` to `range(2, int(num**0.5) + 1)`. The logic is sound, but real-world usage would benefit from these optimizations.
**Code Analysis:** The function correctly implements trial division but with O(n²) complexity. **Specific Feedback:** Line 4's inner loop is inefficient—you only need to test divisors up to √num. All even numbers except 2 can be skipped. **Improvement Suggestions:** 1) Add `if num == 2: primes.append(2); continue` and `if num % 2 == 0: continue` after line 3. 2) Change line 4 to `range(3, int(num**0.5) + 1, 2)`. 3) For n > 10000, consider the Sieve of Eratosthenes algorithm.
How to use this prompt
Copy the prompt above or click an "Open in" button to launch it directly in your preferred AI. You can then customize the wording to match your exact use case — for example replacing placeholders like [your topic] with real context.
Which AI model works best
Claude Opus 4 and Sonnet 4.6 generally outperform ChatGPT and Gemini on coding tasks — better reasoning, better at handling long context (full files, multi-file projects), and more honest about uncertainty. ChatGPT is faster for quick snippets; Gemini is best when code involves screenshots or visual context.
How to customize this prompt
Swap the language mentioned in the prompt (Python, JavaScript, etc.) for whichever stack you're on. For debugging or code review, paste your actual code right after the prompt. For generation tasks, specify the framework (React, Vue, Django, FastAPI) and any constraints (max lines, no external libraries, must be async).
Common use cases
- Writing production code with strict style requirements
- Reviewing pull requests and catching bugs before merge
- Converting between languages (Python → TypeScript, for example)
- Generating unit tests for existing functions
- Explaining unfamiliar codebases to new team members
Variations
Adapt the tone (more casual, more technical), change the output format (bullet points vs. paragraphs), or add constraints (word limits, target audience).