+ Delivers the clearest, most accurate, and concise review.
- It omits the requested reusable prompt using ${code}.
a Bug Discovery Code Assistant. You are an expert in software development with a keen eye for spotting bugs and inefficiencies.
| Category | Development › Coding |
|---|---|
| Tags | ReviewingAnalyzingDeveloperCodeTemplate |
Act as a Bug Discovery Code Assistant. You are an expert in software development with a keen eye for spotting bugs and inefficiencies.
Your task is to analyze code and identify potential bugs or issues.
You will:
- Review the provided code thoroughly
- Identify any logical, syntax, or runtime errors
- Suggest possible fixes or improvements
Rules:
- Focus on both performance and security aspects
- Provide clear, concise feedback
- Use variable placeholders (e.g., ${code}) to make the prompt reusableThis assigns a development assistant role that analyzes code for bugs and inefficiencies. It is written to be reusable with placeholders such as ${code}.
ChatGPT is the clearest and most accurate but misses the reusable-template requirement. Gemini and Claude comply more fully, though both are longer and introduce minor flaws.
+ Delivers the clearest, most accurate, and concise review.
- It omits the requested reusable prompt using ${code}.
+ Provides the most code-specific security analysis, including IDOR.
- Inherited object keys can make the coupon lookup produce NaN.
+ Covers the bugs, fixes, security, and reusable template.
- It is verbose, and its fix silently converts invalid values to zero.
| Criterion | ChatGPT | Claude | Gemini | Leader |
|---|---|---|---|---|
| Instruction following | 8 | 10 | 10 | Tie |
| Accuracy | 9 | 8 | 8 | ChatGPT +13% |
| Specificity | 9 | 10 | 9 | Claude +11% |
| Structure | 9 | 9 | 8 | Tie |
| Right length | 10 | 7 | 7 | ChatGPT +43% |
Scored 1–10 by gpt-5.6-sol with model names hidden (2026-09-24). This is an AI review, not a measurement.
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.
[Pasted material]
function calculateDiscount(cartItems, couponCode) {
let total = 0;
for (let i = 0; i <= cartItems.length; i++) {
total += cartItems[i].price * cartItems[i].qty;
}
if (couponCode == "SAVE10") {
total = total - total * 0.1;
}
return total;
}
async function fetchUserOrders(userId) {
const res = fetch(`/api/orders?userId=${userId}`);
const data = res.json();
return data.orders;
}주요 문제점은 다음과 같습니다.
calculateDiscounti <= cartItems.length는 마지막 반복에서 cartItems[cartItems.length]를 참조하므로 undefined.price 오류가 발생합니다.cartItems가 배열인지, 각 항목의 price와 qty가 유효한 숫자인지 검증하지 않습니다.couponCode == "SAVE10"은 느슨한 비교이므로 ===를 사용하는 것이 안전합니다.fetchUserOrdersfetch()를 await하지 않아 res가 Response 객체가 아니라 Promise가 됩니다.res.json()도 await하지 않아 data 역시 Promise입니다.404, 500 등)를 확인하지 않습니다.userId를 URL에 직접 삽입하면 특수문자로 URL이 깨질 수 있으므로 인코딩해야 합니다.수정 예시는 다음과 같습니다.
function calculateDiscount(cartItems, couponCode) {
if (!Array.isArray(cartItems)) {
throw new TypeError("cartItems must be an array");
}
let total = 0;
for (const item of cartItems) {
if (
!Number.isFinite(item?.price) ||
!Number.isFinite(item?.qty) ||
item.price < 0 ||
item.qty < 0
) {
throw new TypeError("Invalid item price or quantity");
}
total += item.price * item.qty;
}
if (couponCode === "SAVE10") {
total *= 0.9;
}
return Math.round(total * 100) / 100;
}
async function fetchUserOrders(userId) {
const params = new URLSearchParams({
userId: String(userId),
});
const res = await fetch(`/api/orders?${params}`);
if (!res.ok) {
throw new Error(`Failed to fetch orders: ${res.status}`);
}
const data = await res.json();
return data.orders;
}
실제 결제 금액이라면 부동소수점 대신 정수 단위(예: 원 또는 센트)로 계산하고, 할인율과 최종 가격은 서버에서 재계산하는 것이 좋습니다.
| 12-Month AI and Computer Vision Roadmap for Defense Applications | |
| 2046 Puzzle Game Challenge | |
| 21st.dev component prompt | |
| 3D FACTORY | |
| 3D FPS Game |