ProSkillsLibraryFreePassScan
Code Review

Code Review · agent skill

PR Reviewer

Staff-level review. Every finding labelled, with a line.

What it does

Loads when it is needed

Your agent loads it when the user asks for a code review or whether a change is safe to merge. It carries 5 rules and reads a profile.md with your details before it starts, so the output matches your brand and project.

Same prompt, with and without

Review refund endpoint before merge

Prompt · Review this diff before I merge it. Is it safe?

PR: "Add refund endpoint for support (BILL-118)". No test files changed.

src/billing/refund.ts (new)
 1 export async function refundOrder(orderId: string, amountCents: number) {
 2   const order = await db.orders.findById(orderId);
 3   if (order.refundedCents + amountCents > order.totalCents) {
 4     throw new Error("refund exceeds total");
 5   }
 6   await stripe.refunds.create({ payment_intent: order.paymentIntentId, amount: amountCents });
 7   await db.orders.update(orderId, { refundedCents: order.refundedCents + amountCents });
 8   return { ok: true };
 9 }

src/routes/orders.ts (+5)
41 router.post("/orders/:id/refund", requireAuth, async (req, res) => {
42   const result = refundOrder(req.params.id, Number(req.body.amount));
43   res.json(result);
44 });

Profile used: Project: order and payments API; Stack: TypeScript, Express, Stripe, Postgres; Strictness: Standard; Conventions: none beyond eslint

Without the skill
Not safe to merge yet. Main issues, in order: 1. **Missing await (blocking).** In the route, `refundOrder(...)` isn't awaited, so `result` is a Promise and the response is `{}`. Errors become unhandled rejections and the request never fails properly. Add `await` and error handling. 2. **No authorization.** `requireAuth` only proves the user is logged in. Any customer could refund any order. Add a role check (support/admin only). 3. **Race / double refund.** The read-check-write isn't atomic. Two concurrent requests can both pass the limit check and both hit Stripe. Use a transaction with `SELECT ... FOR UPDATE` or a conditional UPDATE, and pass a Stripe idempotency key. 4. **Stripe vs DB inconsistency.** If Stripe succeeds and the DB update fails, money is refunded with no record. Record the refund intent first, or reconcile via webhooks. 5. **Input validation.** `Number(req.body.amount)` can be NaN, negative, zero or fractional. Require a positive integer. Also handle `order` being null (404). 6. **No tests.** For a money path, add tests for over-refund, partial refund, concurrency and Stripe failure. Fix 1, 2, 3 and 5 before merging.
With the skill
## Review: Add refund endpoint for support (BILL-118) Intent: let support refund part or all of an order. Size: 2 files, ~14 lines. Checks run: none (diff only). Verdict: Request changes (4 blockers, 2 should-fix) ### Blockers [blocker] src/routes/orders.ts:42 `refundOrder` is not awaited, so `res.json` sends a Promise (always `{}`) and any rejection is unhandled. Fix: `await` it in try/catch. [blocker] src/routes/orders.ts:41 Only `requireAuth`: any logged-in customer can refund any order id. Fix: add a support/admin role guard; test that a customer gets 403. [blocker] src/billing/refund.ts:2-7 Read-modify-write with no lock: two concurrent requests both pass line 3 and over-refund. Stripe is called (6) before the DB write (7), so a failed write leaves money gone and unrecorded, and a retry refunds again. Fix: `UPDATE orders SET refunded_cents = refunded_cents + $1 WHERE id = $2 AND refunded_cents + $1 <= total_cents` first (0 rows = reject), then Stripe with an `idempotencyKey`. [blocker] No tests for money-moving code: over-refund, concurrent refund, unauthorised caller. ### Should-fix - refund.ts:2 `findById` can return null: TypeError, 500. Return 404. - orders.ts:42 `Number(req.body.amount)` allows NaN (`NaN > x` is false, so line 3 passes), negatives and fractions. Require a positive integer. Not reviewed: `requireAuth`, `db.orders`, Stripe setup (not in the diff).

Both answers from the same model (Claude sonnet), 2026-10-16. The one without the skill was written in a separate session that never saw it. Shortened where marked with …

Install

One command, in your project

It detects your agent; add --agent all for every agent.

npx proskills-cli add pr-reviewer --order <order id from your receipt>

Or copy the skill folder (the one holding SKILL.md) into the directory your agent reads, then restart it or start a new session.

AgentThis projectEvery project
Claude Code.claude/skills/~/.claude/skills/
Cursor.agents/skills/ (or .cursor/skills/)~/.cursor/skills/
Codex.agents/skills/~/.agents/skills/
Gemini CLI.agents/skills/ (or .gemini/skills/)~/.gemini/skills/

Changelog

What changed

  • v1.0.0 · 2026-10-16
    • First versioned release: Staff-level review. Every finding labelled, with a line.
    • Scanned 100/100 before release.

Keep it current with npx proskills-cli update; your profile.md is never touched. Everyone who bought it gets the update free and an email when it lands.

Same collection

More from Code Review

The scan checks spec compliance, token cost, clarity and security patterns. A clean scan is not a guarantee: static scanners can be evaded. Scan any skill yourself.