Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Code Reviews And Fixes

    1

    A code review of your diff against the repo's own conventions: blockers, majors and nits with file and line, then a numbered list of fixes it applies only once you pick them

    $5

    /mo

    Subscription · cancel anytime

    Secure checkout via Stripe

    • Always the latest version
    • Delivered live to your agent via MCP
    • Cancel anytime, access ends at period end
    Security scanned
    Code Reviews And Fixes

    Code Reviews And Fixes

    Example session with this skill installed

    Review this diff before I commit. Express + TypeScript API; every other route in the repo goes through the ORM (db.users.*), never raw SQL.

    diff --git a/src/api/users.ts b/src/api/users.ts
    @@ -10,9 +10,17 @@ export async function getUser(req: Request, res: Response) {

    • const user = await db.users.findById(req.params.id);
    • if (!user) return res.status(404).json({ error: 'not found' });
    • res.json(user);
    • const user = await db.query(SELECT * FROM users WHERE id = ${req.params.id});
    • if (!user) return res.status(404).json({ error: 'not found' });
    • res.json(user);
      +}

    +export async function listUsers(req: Request, res: Response) {

    • const all = await db.users.findAll();
    • const page = all.slice(req.query.offset, req.query.offset + 20);
    • res.json(page.map(u => ({ ...u })));
      }
    • Read your context and instructions
    • Compiled the code reviews

    Review: src/api/users.ts

    Don't commit this yet. There are two blockers in getUser and two majors in the new listUsers.

    Context

    src/api/users.ts: the HTTP handler layer. Each export is an Express (req: Request, res: Response) async handler. It reads params, calls the data layer and writes JSON.

    Baseline conventions (from your note and the unchanged lines in the hunk):

    • Data access goes only through the ORM (db.users.*). No route uses raw SQL. The removed line db.users.findById(req.params.id) is that pattern.
    • A missing record returns res.status(404).json({ error: 'not found' }).
    • A single resource is returned as one object (res.json(user)).

    Line numbers. The hunk header says @@ -10,9 +10,17 @@, but the body you pasted has 4 old lines and 10 new ones, so it looks trimmed. Below, "L10" means the first changed line of the hunk, and the other numbers count down from there in the new file:

    LineCode
    L10db.query(...)
    L11if (!user)
    L12res.json(user)
    L15export async function listUsers
    L16findAll()
    L17slice(...)
    L18res.json(page.map(...))

    Blockers

    B1. SQL injection in getUser (security, conventions)

    Where: src/api/users.ts L10

    const user = await db.query(`SELECT * FROM users WHERE id = ${req.params.id}`);
    

    req.params.id comes straight from the URL and is pasted into the SQL string. A request to /users/1 OR 1=1 returns every row. A request to /users/1;DROP TABLE users will do exactly that on any driver that allows several statements in one query. This line also adds a second data-access path, when the rest of the repo uses only the ORM (db.users.*).

    Fix: put back the ORM call. It is parameterised, it matches every other route, and the line is already in your diff:

    const user = await db.users.findById(req.params.id);
    

    If you really need raw SQL here, use a bound parameter (db.query('SELECT ... WHERE id = $1', [req.params.id]), or whatever placeholder your driver uses). The ORM call is still the better fix because it is the house pattern.

    B2. The 404 can never fire, and the response shape changed (correctness)

    Where: src/api/users.ts L10-L12

    findById returned one user or null. A raw db.query returns a collection: either a row array, or a result object such as { rows: [...] } (I can't see db.query's signature from the diff). Neither one is ever falsy, so:

    • if (!user) at L11 is dead code. An unknown id now returns

    200 with [] (or { rows: [] }) instead of

    404 { error: 'not found' }.

    • res.json(user) at L12 now sends an array or a result wrapper instead of a user object. Every caller that reads response.name, response.id and so on breaks.

    Fix: the same as B1. Reverting to db.users.findById restores both the null check and the single-object contract.


    Majors

    M1. listUsers pagination is broken by string arithmetic (correctness)

    Where: src/api/users.ts L17

    const page = all.slice(req.query.offset, req.query.offset + 20);
    

    req.query.offset is a string (or undefined, or an array), never a number:

    ?offset=40: "40" + 20 is the string "4020". slice turns both arguments into numbers, so you get slice(40, 4020), which is up to 3,980 users instead of 20.

    No offset: undefined + 20 is NaN, so you get slice(undefined, NaN), which is slice(0, 0). The default page is always empty.

    • ?offset=-5: returns the last 5 users.

    With Express's default typings (string | string[] | ParsedQs | ParsedQs[] | undefined), this line should not even pass tsc. If it does, something upstream has made req.query any, and the behaviour above is what you will see at runtime.

    Fix: parse and clamp the offset first:

    const PAGE_SIZE = 20;
    const raw = Number.parseInt(String(req.query.offset ?? '0'), 10);
    const offset = Number.isFinite(raw) && raw > 0 ? raw : 0;
    

    M2. listUsers loads the whole users table on every request (performance)

    Where: src/api/users.ts L16-L17

    db.users.findAll() pulls every row into memory and then keeps 20 of them. The cost of each call grows with the size of the table, and it costs memory and time on what is probably a frequently called list endpoint.

    Fix: let the database do the paging through the ORM. For example, db.users.findAll({ offset, limit: PAGE_SIZE }), or whatever your ORM calls its limit and offset options, which I can't see from here. This also lets M1's offset go straight into the query.


    Nits

    N1. page.map(u => ({ ...u })) adds nothing, and may change what is sent (conventions)

    Where: src/api/users.ts L18

    For plain objects this is a shallow copy that res.json doesn't need. getUser just does res.json(user). If db.users returns class instances, which is common in ORMs, spreading one drops its prototype. That means any toJSON() that hides fields like a password hash is skipped, and depending on the ORM you can serialise internal bookkeeping fields instead of the attributes.

    Fix: res.json(page) matches getUser. If you want to control which fields go out, map them explicitly: page.map(({ id, name, email }) => ({ id, name, email })).

    N2. Hard-coded page size (conventions)

    Where: src/api/users.ts L17

    The magic number 20 is easy to miss and easy to make inconsistent later. Use a named PAGE_SIZE constant, as in M1's fix.


    Review aspects covered

    AspectFindings
    CorrectnessB2, M1
    SecurityB1
    PerformanceM2
    ConventionsB1 (raw SQL instead of the ORM), N1 (spread instead of res.json(user)), N2

    Outside this diff (not findings, worth a look)

    Auth on listUsers. Where the route is mounted isn't in the diff. listUsers returns every user's full record, so check that it sits behind the same auth middleware as getUser. Better still, also limit it to admins.

    • SELECT * exposure. If your ORM model leaves out sensitive columns by default, SELECT * sent them anyway. Reverting to the ORM (B1) closes this. I can't confirm it from the diff.

    Which fixes should I apply?

    B1 + B2: revert L10 to db.users.findById(req.params.id). This fixes the injection, the dead 404 and the response shape.
    2. M1: parse and clamp offset, and add a PAGE_SIZE constant (this also covers N2).
    3.

    M2: move paging into the ORM query (findAll({ offset, limit })). Tell me your ORM's option names, or I'll follow the pattern your other list routes use if you paste one.
    4. N1: replace the spread with res.json(page).
    5. N2: covered by 2. Listed separately only if you want the constant without the offset change.

    Reply with the numbers you want, for example "1, 2, 3". I won't touch anything until you do.

    $5/mo

    Subscription · always the latest version

    • Secure checkout via Stripe
    • Cancel anytime
    • Delivered live via MCP

    About this skill

    Reviews a git diff the way a senior teammate would, against how this repository already does things rather than against a generic style guide. It reads the files the diff touches and the code around them, works out the conventions in force (data access, error handling, response shapes, naming), and checks the change for correctness, security, performance and style.

    What it does

    You get the context it used, then findings grouped as blockers, majors and nits. Each one has the file and line, what goes wrong and in what situation, and the fix, usually as code. It ends with a numbered list of the fixable findings and stops. Reply with the numbers you want ("1, 2") and it edits only those, then reports every fix it applied and every finding it skipped.

    Try it first

    Stage a change and say "review this diff before I commit", or paste a diff. Check that each finding points at a real line and that nothing in your files changed before you answered.

    What it needs

    Read access to the repo and git (Bash) to read the diff; write access only for the fixes you approve. Any language. No network access and no API keys.

    It reviews the diff, not the whole codebase, so a problem in code the change doesn't touch is out of scope unless the diff makes it worse. When you paste a diff without the repo, it reasons from the visible lines and says what it assumed. Line numbers follow the hunk headers, so a trimmed paste is flagged. It doesn't run your tests or the code; it tells you which test would catch each issue. Nothing is edited until you approve findings by number.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 28 days ago

    Requires

    Git

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Listed28 days ago

    What's inside

    Frequently Asked Questions

    A code review of your diff against the repo's own conventions: blockers, majors and nits with file and line, then a numbered list of fixes it applies only once you pick them

    This skill uses the open SKILL.md standard. Use it through an MCP-compatible agent connected to Agensi, and check the compatibility information on this page for confirmed agents and required capabilities.

    Connect your AI agent to Agensi through MCP, then ask it to use Code Reviews And Fixes on your task. Your agent loads the latest approved version each time. Paid skills require a purchase or active subscription. Skill files are not available for download; your licence does not allow you to save, copy or export any part of a skill.

    New in Code Quality & Review