agentleFS
medy-gribkovmedy-gribkov/arcana/skills/code-reviewer/SKILL.md

code-reviewer

Skill1 starsChanged 9 months agoApache-2.0View on GitHub

Code review workflow for local changes and remote PRs. Reviews focus on correctness, maintainability, security, and test coverage with concrete examples and inline comments.

  • Deletes or force-pushes

129 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use sql-query-expert, git-doc-updater and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Marine-softdrink524Skill

    sql-query-expert

    Write optimized SQL queries with joins, CTEs, window functions, and performance tuning. Based on Anthropic's Claude Cookbooks.

    Also in 3 projects that use this

  • u9401066Skill

    git-doc-updater

    Auto-check and update key documentation before Git commits to keep docs in sync with code. Triggers: docs, 文檔, 更新文檔, sync docs, release, 發布.

    Also in 3 projects that use this

  • u9401066Skill

    git-precommit

    Orchestrate pre-commit workflow including Memory Bank sync, README/CHANGELOG/ROADMAP updates. Triggers: GIT, gc, push, commit, 提交, 準備 commit, 要提交了, git commit, pre-commit, 推送.

    Also in 3 projects that use this

  • JeffallanSkill

    secure-code-guardian

    Use when implementing authentication/authorization, securing user input, or preventing OWASP Top 10 vulnerabilities — including custom security implementations such as hashing passwords with bcrypt/argon2, sanitizing SQL queries with parameterized statements, configuring CORS/CSP headers, validating input with Zod, and setting up JWT tokens. Invoke for authentication, authorization, input validation, encryption, OWASP Top 10 prevention, secure session management, and security hardening. For pre-built OAuth/SSO integrations or standalone security audits, consider a more specialized skill.

    Also in 4 projects that use this

  • alirezarezvaniSkill

    readme-updater

    Keep README files current with project changes. Use when project structure changes, features added, or setup instructions modified. Suggests README updates based on code changes. Triggers on significant project changes, new features, dependency changes.

    Also in 4 projects that use this

  • JohnJBorenSkill

    test-engineer

    Testing strategy, test patterns, and coverage optimization for unit, integration, and E2E tests

    Also in 9 projects that use this

  • +3 more from u9401066

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 111 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run preflight checks to catch automated failures early.

    line 22
  2. Distinctive:

    Read PR description and existing comments to understand context.

    line 28
  3. Distinctive:

    Check git status and read diffs.

    line 36
  4. Very specific:

    Flag: No tests found in src/payments/refund.test.ts.

    line 248
  5. Distinctive:

    Acknowledge strengths: Call out well-written code, good test coverage, or thoughtful design.

    line 304
  6. Distinctive:

    After completing the review, ask if the user wants to switch back to the default branch.

    line 310

“Common” is measured: kept by at least 6 in 10 of the 111 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Determine Review Target

Remote PR: User provides a PR number or URL (e.g., "Review PR #123").

Local changes: User asks to "review my changes" or no PR is specified.

Review Workflow

For Remote PRs

  1. Checkout the PR branch.
gh pr checkout 123
  1. Run preflight checks to catch automated failures early.
npm run preflight
  1. Read PR description and existing comments to understand context.
gh pr view 123

For Local Changes

  1. Check git status and read diffs.
git status
git diff          # Working tree changes
git diff --staged # Staged changes
  1. Optionally run preflight if changes are substantial.
npm run preflight

Review Pillars

Correctness

What to flag: Logic errors, incorrect assumptions, missing edge case handling.

Example review comment:

// File: src/orders/calculateTotal.ts:15
function calculateTotal(items: Item[]): number {
  return items.reduce((sum, item) => sum + item.price, 0);
}

Flag: This does not account for quantity. If an item has quantity: 3, it should multiply price * quantity.

Suggested fix:

function calculateTotal(items: Item[]): number {
  return items.reduce((sum, item) => sum + item.price * item.quantity, 0);
}

Maintainability

What to flag: Complex functions, unclear naming, duplicate logic, missing abstractions.

BAD:

// File: src/users/api.ts:42
async function handle(req: Request, res: Response) {
  const u = await db.query('SELECT * FROM users WHERE id = ?', [req.params.id]);
  if (!u) return res.status(404).send('Not found');
  if (req.user.id !== u.id && req.user.role !== 'admin') {
    return res.status(403).send('Forbidden');
  }
  res.json(u);
}

Flag: Function name handle is vague. Variable u is unclear. Authorization logic is inline and will be duplicated across routes.

GOOD:

async function getUserById(req: Request, res: Response) {
  const user = await findUserById(req.params.id);
  if (!user) return res.status(404).send('User not found');

  if (!canAccessUser(req.user, user)) {
    return res.status(403).send('Access denied');
  }

  res.json(user);
}

function canAccessUser(requester: User, target: User): boolean {
  return requester.id === target.id || requester.role === 'admin';
}

Security

What to flag: SQL injection, XSS, hardcoded secrets, missing authentication, unsafe deserialization.

BAD:

// File: src/search/api.ts:28
app.get('/search', (req, res) => {
  const results = db.query(`SELECT * FROM products WHERE name LIKE '%${req.query.q}%'`);
  res.json(results);
});

Flag: SQL injection vulnerability. User input is directly interpolated into the query. An attacker can inject '; DROP TABLE products; --.

GOOD:

app.get('/search', (req, res) => {
  const results = db.query('SELECT * FROM products WHERE name LIKE ?', [`%${req.query.q}%`]);
  res.json(results);
});

Readability

What to flag: Inconsistent formatting, missing comments for complex logic, misleading names.

BAD:

// File: src/analytics/metrics.ts:55
function calc(d: any) {
  const x = d.reduce((a, b) => a + b.v, 0);
  return x / d.length;
}

Flag: Cryptic naming. calc does not describe what it calculates. d, a, b, v, x are meaningless. Parameter type is any.

GOOD:

function calculateAverageValue(dataPoints: DataPoint[]): number {
  const sum = dataPoints.reduce((total, point) => total + point.value, 0);
  return sum / dataPoints.length;
}

Efficiency

What to flag: N+1 queries, unnecessary loops, unbounded data loading, missing indexes.

BAD:

// File: src/orders/report.ts:18
async function getOrdersWithUsers(orderIds: string[]) {
  const orders = await db.orders.findMany({ where: { id: { in: orderIds } } });

  for (const order of orders) {
    order.user = await db.users.findUnique({ where: { id: order.userId } });
  }

  return orders;
}

Flag: N+1 query problem. For 100 orders, this executes 101 queries (1 for orders, 100 for users).

GOOD:

async function getOrdersWithUsers(orderIds: string[]) {
  const orders = await db.orders.findMany({
    where: { id: { in: orderIds } },
    include: { user: true },
  });

  return orders;
}

Edge Cases and Error Handling

What to flag: Missing null checks, unhandled promise rejections, no fallback for empty arrays.

BAD:

// File: src/cart/total.ts:10
function getFirstItemPrice(cart: Cart): number {
  return cart.items[0].price;
}

Flag: Crashes if cart.items is empty. No validation that items exist.

GOOD:

function getFirstItemPrice(cart: Cart): number {
  if (cart.items.length === 0) {
    throw new Error('Cannot get price from empty cart');
  }
  return cart.items[0].price;
}

Test Coverage

What to flag: Missing tests for new logic, incomplete edge case coverage, no integration tests for API changes.

Example review comment:

// File: src/payments/refund.ts:25
export async function processRefund(orderId: string, amount: number) {
  const order = await db.orders.findUnique({ where: { id: orderId } });
  if (!order) throw new Error('Order not found');

  if (amount > order.total) {
    throw new Error('Refund amount exceeds order total');
  }

  await paymentGateway.refund(order.paymentId, amount);
  await db.orders.update({
    where: { id: orderId },
    data: { refundedAmount: order.refundedAmount + amount },
  });
}

Flag: No tests found in src/payments/refund.test.ts. Suggested tests:

  1. Refund succeeds for valid amount
  2. Throws error when order not found
  3. Throws error when refund exceeds order total
  4. Updates refundedAmount correctly
  5. Handles payment gateway failure gracefully

Provide Feedback

Structure

Summary: High-level overview of the changes and overall assessment.

Findings:

  • Critical: Bugs, security vulnerabilities, breaking changes. Must fix before merge.
  • Improvements: Code quality, performance, or design suggestions. Recommended but not blocking.
  • Nitpicks: Formatting, minor naming issues. Optional.

Conclusion: Clear recommendation (Approve / Request Changes).

Example Review

Summary:

This PR adds a refund processing feature for orders. The core logic is sound, but there are a few critical issues around input validation and error handling that need addressing before merge.

Findings:

Critical:

  1. src/payments/refund.ts:30 - Missing validation for negative refund amounts. Add if (amount <= 0) throw new Error('Refund amount must be positive').
  2. src/payments/refund.ts:35 - Payment gateway errors are not caught. Wrap in try/catch and handle failure cases (e.g., log error, notify admin).

Improvements:

  1. src/payments/refund.ts:25 - Consider extracting validation logic into a separate validateRefundRequest() function for reusability.
  2. src/payments/refund.test.ts - Missing tests for edge cases (see Test Coverage section above).

Nitpicks:

  1. src/payments/refund.ts:15 - Variable order could be named existingOrder for clarity.

Conclusion: Request Changes. Please address the critical issues and add the suggested tests. Happy to approve once those are resolved.

Tone

Direct and constructive. Explain why a change is needed, not just what to change.

BAD: "This is wrong."

GOOD: "This does not handle the case where items is empty, which will cause a runtime error. Add a length check before accessing items[0]."

Acknowledge strengths. Call out well-written code, good test coverage, or thoughtful design.

Example: "Nice work on the error handling in processPayment(). The fallback logic for gateway timeouts is solid."

Cleanup (Remote PRs Only)

After completing the review, ask if the user wants to switch back to the default branch.

gh pr checkout --detach
git checkout main

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.