aemerson-commits/shareable-skills/pre-merge-review
Claude Code and agent skill by aemerson-commits/shareable-skills
- community
Checking that the SKILL.md file is still in the repository.
Comprehensive pre-merge review — security pentesting, performance, scalability, UX consistency, and code hardening — then works the findings through to landed fixes on a branch. Run before merging dev to main to catch issues before production. The deliverable is a merge-ready branch, not a findings list: after synthesis the skill verifies each finding, triages apply/flag/outward-facing, fixes on a branch cut from the reviewed SHA with a regression test that fails on the unfixed code, and re-runs the full pre-flight. Triggers: 'pre-merge review', 'review before merge', 'full code review for merge', 'fix the review findings'. Soft-default: when planning a commit or merge that touches 3+ top-level projects, suggest running this skill before pushing — the cross-project blast radius warrants a review even if no individual change looks risky.
Install
npx vskill@latest install aemerson-commits/shareable-skills/pre-merge-reviewSKILL.md
The same SKILL.md was published earlier as aemerson-commits/shareable-skills/pre-merge-review.
Pre-Merge Review
Comprehensive review gate before merging dev to main. Dispatches parallel review agents across 5 domains, then compiles a ranked findings report.
When to Run
- Before every merge to production
- After large feature batches land on dev
- When security-sensitive changes are included (auth, RBAC, API endpoints, workers)
- Soft-default for 3+ project commits: When a commit/branch touches 3+ top-level project dirs, suggest this skill before pushing. Rationale: cross-project blast radius — a
shared/edit can break multiple frontends silently; a multi-project refactor often introduces drift that single-project review misses. The skill's parallel domain agents catch what serial reading misses. Implementation: count distinct top-level dirs ingit diff --name-only HEAD~N..HEAD | awk -F/ '{print $1}' | sort -u. If ≥3 project dirs, surface the recommendation. User can decline; this is a suggestion, not a gate.
Pre-Flight Validation (Parallel)
Before dispatching review agents, run these in parallel-batched Bash calls — one batch = one message with multiple tool_use blocks. Sequential runs take ~2min; parallel batches finish in ~35s.
Batch 1 — Lint (all frontend projects): run npm run lint (or your linter command) from each project dir. Stop if any fail. Use npm run lint, NOT a formatter-inclusive check command — formatter-only diffs are not lint errors and will produce false positives that the CI lint gate ignores. Match the canonical command CI runs.
Batch 2 — Build (same projects): each running npm run build. Catches type errors, missing imports, bundle-breaking changes. Builds are necessary but NOT sufficient — consumer tests catch what builds miss (see Batch 3).
Batch 3 — Tests + secrets scan: run every consumer project's full test suite whose code the diff affects — for a shared/* change that means running tests for all consumer projects, not just the shared package. A passing build is NOT a passing test: a consumer project can carry a test that asserts the shared module's behavior; builds miss it and the CI test gate catches it only after the push. Plus grep -rn "SECRET\|PASSWORD\|API_KEY\|CLIENT_SECRET" --include="*.js" across touched paths.
If any batch surfaces failures, surface them before proceeding — review agents below assume a clean build.
Review Domains
1. Security Penetration Review
Simulate three attacker profiles against all exposed surfaces:
Profile A — Unauthenticated External Attacker
- Can they access any API endpoint without authentication?
- Are all worker HTTP endpoints auth-gated?
- Are there CORS misconfigurations allowing cross-origin reads?
- Can they enumerate users, endpoints, or internal data via error messages?
- Rate limiting coverage on all public-facing endpoints
- CSP, HSTS, X-Frame-Options, X-Content-Type-Options on all responses
- Input validation on all user-controllable parameters (SQL injection, XSS, path traversal)
- Mass assignment: UPDATE/INSERT endpoints bind an explicit field allowlist — never spread or iterate the request body into SET clauses or column lists. A client adding an unexpected field (
"status":"approved","role":"admin") to the body must not change columns the endpoint didn't intend to expose. - Path traversal on file/key builders: any endpoint that builds a storage key, file path, or filename from a caller-supplied param validates it against a strict pattern (e.g.
^[\w-]+$-class) so../, encoded slashes, or absolute paths can't escape the intended prefix. - SSRF on server-side fetches: no backend route fetches a URL/host/path assembled from caller input beyond an allowlisted route map. Treat any caller-influenced fetch target as a finding, especially on services with access to internal/private-network hosts.
Profile B — Compromised Regular User (authenticated)
- Can they access admin endpoints? (RBAC enforcement on every admin route)
- Can they read other users' data?
- Can they submit privileged actions without the required permission?
- Can they escalate privileges via parameter manipulation?
- Are there IDOR vulnerabilities (accessing resources by guessing IDs)?
- Can they exfiltrate data beyond their authorized scope?
Profile C — Compromised Admin
- Can they access raw database credentials or service account keys?
- Can they modify worker code or deploy malicious functions?
- Are admin mutations audited? Can audit logs be tampered with?
- Is there a self-lockout prevention? (admin can't remove own admin role)
- Rate limiting on admin write operations
- Can they access other admins' sessions or tokens?
What to check:
- Shared API utilities — CORS, JWT verification, rate limiting
- Permission system — role checks, fallback behavior
- All API endpoints — auth guards on every route
- All worker HTTP endpoints — Bearer token auth
- Backend API server — admin auth, SQL parameterization
- Error responses — no stack traces, no internal details
- Headers on all responses — security headers present
- Scaffolding/diagnostic routes MUST be removed before commit — temporary endpoints added mid-session to introspect data (e.g.
/_tables,/_schema/:table,/debug/*,/_probe-*) get shipped by mistake when they should be deleted once they've served their purpose. Grep the diff for routes prefixed with_,debug,probe, or commented as "temporary" / "diagnostic" / "scaffolding" — every match is a removal candidate. If genuinely needed long-term, gate with the same auth as existing analogous routes. - The deploy targets, not just the diff. Every repo-side secret scanner — grep-based scanners, pre-push hooks, hosted secret scanning — is repo-scoped, so a script that was never
git added is invisible to all of them at once, even with no.gitignoreline naming it as sensitive. If your project deploys to something outside git (a VM, a network share, a bare-metal host), scan that target directly for credential literals, and separately list target-only files — present on the target, absent from git — the blind spot where literals accumulate unreviewed. A real incident: several untracked scripts on a production file share each carried a hardcoded database password, one byte-identical to the live credential the running service authenticates with, sitting in plaintext for months. A cleangit diffsays nothing about this class. Treat "target unreachable" as "the check did not run," never as a pass. - **Entropy/pattern-based secret scanners must cover base64url and UUID shapes, and be tuned
against the codebase's own conventions before shipping the wider rule.** A base64 detector class that misses -/_ won't catch what randomBytes().toString('base64url') emits, and most scanners have no UUID rule at all. But widening the character class naively will false-flag ordinary text conventions (a bolded key-style marker, a slug, a hex ID in a doc). Widen the class, then qualify candidates (mixed case + digit + separator), and pin negative controls from real lines already in your own docs/notes before trusting the wider rule.
- Never write a credential literal into a maintenance or throwaway script, not even temporarily. Resolve credentials through a shared helper — env var, then a local
.env, then wherever the running service's own deploy-time config actually lives — and have it exit non-zero rather than silently falling back to something embedded. Prefer no credential at all when a read-only path (an existing proxy, a health/schema endpoint) already serves the same data without one. - Rotation has a coupled blast radius. If a scratch script's hardcoded credential matches the value the production service authenticates with, rotating one without the other breaks the service. Check what else shares a credential before rotating it.
1b. Vibe-Coded Pre-Launch Checklist (behavioral)
Fast-moving / AI-generated ("vibe-coded") features ship correct-looking UI on top of un-audited data paths. Before any such feature merges, walk this checklist explicitly — it is the highest-yield subset of §1, scoped to the mistakes that recur when code is generated quickly:
- [ ] Every new endpoint has an auth guard.
POST/PUT/DELETEand any data-returningGETcalls the project's auth middleware. A new route with no guard is the default failure mode. - [ ] Identity is server-derived, never client-supplied. The user's email/role comes from the verified auth token — never from a request body, query param, or header the client controls. Grep the handler for any
body.email/?email=used for scoping. - [ ] Ownership / IDOR check on every resource fetch. Reading or mutating a record by id verifies the caller owns or participates in it. Guessing another id must not return another user's data.
- [ ] Row-level privacy holds. List/query endpoints filter to the caller's scope server-side; "company-wide read" is a deliberate, documented exception, not an accident.
- [ ] Admin routes enforce RBAC server-side. Role check on the server, not just a hidden nav item. A non-admin curling the endpoint must 403.
- [ ] No secrets in the client bundle. Tokens/keys live in environment secrets; the React build references none. Re-run the Batch 3 secrets grep against the new code.
- [ ] Input validation on every user-controllable param. Zod or explicit guards;
parseInt/JSON.parsewrapped so bad input is a 4xx with{ error: string }, never a 5xx.
Auth baseline: establish a baseline auth audit for your project surface (admin endpoints server-side guarded, server-side identity, owner/participant checks intact). Treat any new finding in these areas as a regression, not a pre-existing gap.
2. Performance Review
Bundle Analysis
- Check build output for each project — bundle sizes, code splitting
- Identify large chunks that could be split further
- Verify lazy loading is used for all non-critical views
- CSS code splitting aligned with component boundaries
API & Caching
- Cache TTLs appropriate for data freshness requirements
- Cache invalidation working correctly on mutations
- No N+1 query patterns
- Compression on large cached values
- Unnecessary API calls on page load
React Rendering
- useMemo/useCallback used correctly (not over-used or under-used)
- No components causing unnecessary re-renders
- No state in parent that should be in child
- Large lists virtualized or paginated
Assets
- Images optimized
- Fonts loaded efficiently
- No render-blocking resources
3. Scalability Review
- API rate limits — are we within budget?
- Cache storage patterns — key naming, TTLs, size limits
- Database query efficiency — indexes, query plans
- Worker CPU time budget
- Subrequest limits in complex operations
- Data growth patterns — will current approach work at 2x, 5x, 10x scale?
- Shared database across environments: if a migration or schema change applies automatically to a database instance shared by multiple environments (e.g. one DB backing both a dev/staging deployment and production), treat any change pushed to the lower environment as an immediate production change. For a breaking change (rename, DROP, constraint rebuild) on a table production reads: split additive-now work from destructive-later work so production survives the first apply, verify preconditions in the target environment before applying, and confirm the change live in every environment that shares the database — a single-environment smoke test is insufficient.
4. UX Consistency Review
Visual Consistency
- Color tokens used consistently (not hardcoded hex values)
- Typography consistent across views (font sizes, weights, families)
- Spacing and padding patterns consistent
- Theme applied uniformly (no theme leaks)
- Chart styling consistent (tooltips, axes, legends, grid lines)
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/pre-merge-review/SKILL.md
Popularity
- Repository stars
- 1
- 7-day trend score
- 3
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/aemerson-commits/shareable-skills/pre-merge-review)