- Home
- Skills
- Code Quality & Review
- Next.js & TypeScript Code Review + Test Gap Filler
Next.js & TypeScript Code Review + Test Gap Filler
by Ahmad Rao
Review Next.js and TypeScript code with file-and-line findings, identify likely test gaps, and write tests in your existing style. Includes a local Python scanner, review checklist, report template and worked example.
$9
What it does
- Review security, correctness, performance, Next.js/React and accessibility in structured passes
- Identify likely missing tests with a local TypeScript, JavaScript and Python scanner
- Write requested tests in the project’s existing Vitest, Jest or pytest style
- Report findings with severity, file, line, evidence and a concrete suggested fix
- Run available test commands and distinguish passing, failing and unexecuted tests
Who it's for
Founders launching a Next.js app
Get a structured review of API routes, authorization, data writes and likely test gaps before launch.
Try asking: “Audit my repository before I launch on Monday.”
Developers with a big pull request
Speed up your reviews with a detailed list of bugs, security risks, and performance tips.
Try asking: “Review this pull request and find any logic errors.”
Teams needing better test coverage
Prioritize likely gaps, inspect existing tests and ask the agent to add useful regression cases.
Try asking: “Find the test gaps in my auth and payment logic and write Vitest tests for them.”
Next.js & TypeScript Code Review + Test Gap Filler
Example session with this skill installed
Offline exercise: review only this app/api/promo/route.ts before merging. Do not change files. The fixture has no manifest, dependencies, database implementation, schema, middleware or tests.
import { NextResponse } from 'next/server';
import { db } from '@/lib/db';
export async function POST(req: Request) {
const { code, userId } = await req.json();
const promo = await db.promo.findFirst({ where: { code } });
if (!promo) return NextResponse.json({ error: 'Invalid code' });
const user = await db.user.findUnique({ where: { id: userId } });
const orders = await db.order.findMany({ where: { userId } });
let total = 0;
for (const order of orders) {
const items = await db.orderItem.findMany({ where: { orderId: order.id } });
for (const item of items) total += item.price * item.qty;
}
const finalTotal = total - total * (promo.percentOff / 100);
await db.user.update({
where: { id: userId },
data: { credits: user.credits + promo.bonusCredits },
});
return NextResponse.json({ finalTotal });
}
- Read your context and instructions
- Compiled the next js
Offline exercise result. Do not merge: the handler permits caller-selected credit updates and repeated bonus grants.
Reviewed the fixture's only source file, app/api/promo/route.ts, in full. All line references below refer to that file.
| Severity | Lines | Finding and evidence | Concrete fix |
|---|---|---|---|
| High | 5, 8, 16–18 | Caller controls the credited account. userId comes directly from the request and selects the user to update; the handler performs no authentication or ownership check. If reachable without an upstream restriction, a caller can grant credits to an arbitrary known account. | Require an authenticated session and derive the target user ID from it. |
| High | 16–18 | Repeated requests repeatedly grant credits. Every valid request adds promo.bonusCredits; no redemption record, eligibility check or consumed state appears in the handler. Sequential replays accumulate bonuses unless unseen database logic prevents them. | Record redemption with a unique (userId, promoId) constraint and grant the bonus in the same transaction. |
| High | 8, 18 | Concurrent requests can lose credit updates. The handler reads user.credits, then writes that stale balance plus the bonus. Two successful requests reading 100 and adding 10 can both write 110. | Use an atomic database increment within the redemption transaction. |
| Medium | 8, 18 | Missing users cause an unhandled failure. The nullable findUnique result is dereferenced as user.credits without a guard. An unknown supplied ID reaches this path when the promo exists. | Validate the identifier and handle a missing user before accessing its fields. |
Two concrete safeguards exist: missing promos return before mutation (line 7), and the credit update is awaited before success is returned (lines 16–20).
Actual scanner result: ran the shipped test_gap_finder.py against the fixture; exit status 0.
Source files scanned : 1
Callable candidates : 1
Files with no test : 1
No test-name match : 1
app/api/promo/route.ts
- POST (line 4)
This is heuristic output, not executed coverage. Priority tests should cover authorization, repeated redemption, concurrent credits, missing users and malformed input.
Cannot verify: middleware or deployment access controls; database implementation, schema, constraints or triggers; promo eligibility rules; Next.js version; TypeScript strictness; or runtime behavior. The fixture provides no manifest, test suite or imported database module. No application tests were run. The route also issues one awaited item query per order (lines 9–13), but production workload is unavailable for assessing its impact.
Totals: 3 High findings, 1 Medium; 1 scanner candidate without a matching test file; 0 tests added. No files changed. Fix server-side account authorization first.
Connects securely to your tools. The creator never sees your data.
About this skill
Give your agent a repeatable code-review workflow before you merge a Next.js or TypeScript change. Get prioritized findings with file-and-line evidence, likely test gaps and requested regression tests in your project's existing style.
How it works
- Provide an accessible repository path, diff or files and define the review scope.
- The agent reads the code and reviews security, correctness, performance, TypeScript/React/Next.js and accessibility.
- A standalone Python scanner identifies common callable exports and likely missing tests in TypeScript, JavaScript and Python.
- The agent inspects those candidates, writes tests when requested and runs the available project test commands.
- You receive a verdict, evidence, concrete suggested fixes and honest test results. Production changes require your request.
What is included
- A structured SKILL.md workflow and detailed review checklist.
- A standard-library Python scanner with text and JSON output.
- A PR review report template plus Vitest and pytest starting templates.
- A worked offline review of a deliberately flawed promo-code API route, including actual scanner results and explicit execution limits.
Why use this workflow
The package combines a repeatable checklist, a runnable scanner and an evidence-based report format. It helps focus an agent on risky authorization, validation, data-write and concurrency paths, while keeping uncertain findings separate. It is an aid to engineering judgment, not a security certification.
Good fits
Review a pull request before merging, examine a Next.js API route before launch, or add regression tests around pricing, authorization and input validation.
Known limitations
The scanner uses lightweight syntax and test-name matching. It does not enumerate every export or measure executed coverage. Aliases, complex syntax and custom test layouts need manual inspection. Tests require the project's installed runtime and dependencies; unavailable tests are marked written, not run. Review is limited to accessible code and cannot guarantee a bug-free or secure application.
The scanner makes no network calls and writes no files. Review and test generation happen in your agent environment; its model and hosting determine code processing. No Agensi API tools or new API keys are required.
Package v1.0.1 contains 7 files: SKILL.md, a review checklist, a standalone Python test-gap scanner, three report/test templates, and an offline worked example. Scanner uses Python standard library only; supports common direct JavaScript/TypeScript callable exports and Python functions/methods. It uses colocated/mirrored paths and relative JS imports to associate tests. Name matches are not executed coverage. Run against a local repository with Python 3.10+. Existing project runtimes, dependencies and test commands are needed to execute Vitest/Jest/pytest tests. No platform tools, external API keys or automatic dependency installation.
How to use
- 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
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
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
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed today
- Software
- Python 3.10+ for the scanner
Python
- Optional
- Existing project test runner
Provide the repository or diff in your agent environment. Basic static review can work without Python; the scanner requires it. No Agensi tools or new API keys.
Permissions
File Scopes
Read access to buyer-selected code, tests and configuration. Shell runs the local scanner and inspected test commands. Write access creates a temporary scanner and requested tests/fixes. No network calls by the scanner. Live services are mocked; extra installation or external access needs buyer authorization.
What's inside
Frequently Asked Questions
New in Code Quality & Review
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.