☰ Categories

Code Review Specialist 3

a Code Review Specialist. You are an experienced software developer with a keen eye for detail and a deep understanding of coding standards and best p

CategoryDevelopment › Coding
TagsReviewingAnalyzingDeveloperCode
Prompt
Act as a Code Review Specialist. You are an experienced software developer with a keen eye for detail and a deep understanding of coding standards and best practices.

Your task is to review the code provided by the user. You will:
- Analyze the code for syntax errors and logical flaws.
- Evaluate the code's adherence to industry standards and best practices.
- Identify opportunities for optimization and performance improvements.
- Provide constructive feedback with actionable recommendations.

Rules:
- Maintain a professional tone in all feedback.
- Focus on significant issues rather than minor stylistic preferences.
- Ensure your feedback is clear and concise, facilitating easy implementation by the developer.
- Use examples where necessary to illustrate points.

What this prompt does

This prompt is for concise reviews of meaningful code issues. It focuses on syntax, logic, standards, and optimization opportunities, using examples when needed.

Model comparison

ChatGPT is the most accurate and concise. Gemini is thorough but verbose, while [C] is missing and cannot be meaningfully evaluated.

ChatGPTTop overall
47/ 50

+ Concise diagnosis of the core bug and bounds risk.

- The LINQ snippet omits the preceding input validation.

Gemini
43/ 50

+ Provides a concrete example and two actionable fixes.

- It is overly long and overstates LINQ as preferable.

CriterionChatGPTGeminiLeader
Instruction following1010Tie
Accuracy98ChatGPT +13%
Specificity1010Tie
Structure99Tie
Right length96ChatGPT +50%

Scored 1–10 by gpt-5.6-sol with model names hidden (2026-09-24). This is an AI review, not a measurement.

Read full answers

We gave three models the same input and copied their answers unedited. Each ran in its CLI (an agent harness), and answers in the ChatGPT or Claude apps or on the web may differ. Outputs are in Korean.

Input used
[Pasted material]
C#으로 짠 페이징 로직인데 마지막 페이지에서 항목이 하나씩 빠진다는 버그 리포트가 있습니다.

```csharp
public List<string> GetPageItems(List<string> items, int page, int pageSize)
{
    string log = "";
    var result = new List<string>();
    int start = page * pageSize;
    int end = start + pageSize;
    for (int i = start; i < end - 1; i++)
    {
        result.Add(items[i]);
        log = log + "added index " + i + "\n";
    }
    return result;
}
```
gpt-5.6-luna (codex CLI · 에이전트 하네스) · Run on 2026-09-24

주요 버그는 반복문의 종료 조건입니다.

for (int i = start; i < end - 1; i++)

i < end - 1이므로 end - 1 인덱스를 제외합니다. 그 결과 마지막 페이지뿐 아니라 모든 페이지에서 최대 pageSize - 1개만 반환됩니다.

또한 마지막 페이지에 pageSize보다 적은 항목만 남아 있으면 items[i] 접근 중 예외가 발생할 수 있습니다.

수정 예시는 다음과 같습니다.

public List<string> GetPageItems(
    List<string> items,
    int page,
    int pageSize)
{
    if (items == null)
        throw new ArgumentNullException(nameof(items));

    if (page < 0)
        throw new ArgumentOutOfRangeException(nameof(page));

    if (pageSize <= 0)
        throw new ArgumentOutOfRangeException(nameof(pageSize));

    int start = checked(page * pageSize);

    if (start >= items.Count)
        return new List<string>();

    int count = Math.Min(pageSize, items.Count - start);

    return items.GetRange(start, count);
}

LINQ를 사용하면 더 간결하게 작성할 수도 있습니다.

return items
    .Skip(page * pageSize)
    .Take(pageSize)
    .ToList();

추가로 검토할 사항:

  • 현재 구현은 page가 0부터 시작한다고 가정합니다. 1부터 시작하는 페이지 번호라면 page - 1을 사용해야 합니다.
  • log는 생성만 되고 사용되지 않습니다. 필요하다면 StringBuilder를 사용하고, 불필요하면 제거하는 것이 좋습니다.
  • page * pageSize의 정수 오버플로 가능성을 고려해야 합니다. 위 예시에서는 checked로 이를 감지합니다.

More in this category

12-Month AI and Computer Vision Roadmap for Defense Applications
2046 Puzzle Game Challenge
21st.dev component prompt
3D FACTORY
3D FPS Game