.cursor/skills/convex-performance-audit/SKILL.md
Audits and optimizes Convex application performance across hot-path reads, write contention, subscription cost, and function limits. Use this skill when a Convex feature is slow or expensive, npx convex insights shows high bytes or documents read, OCC conflict errors or mutation retries appear, subscriptions or UI updates are costly, functions hit execution or transaction limits, or the user mentions performance, latency, read amplification, or invalidation problems in a Convex app.
npx skillsauth add faroqomar/merter convex-performance-auditInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Diagnose and fix performance problems in Convex applications, one problem class at a time.
npx convex insights --details reports high bytes read, documents read, or OCC conflictsStart with the strongest signal available:
npx convex insights --details. Use --prod, --preview-name, or --deployment-name when needed.
insights, try npx -y convex@latest insights --details before giving up.convex-doctor, you may treat its findings as hints. Do not require it, and do not treat it as the source of truth.After gathering signals, identify the problem class and read the matching reference file.
| Signal | Reference |
|---|---|
| High bytes or documents read, JS filtering, unnecessary joins | references/hot-path-rules.md |
| OCC conflict errors, write contention, mutation retries | references/occ-conflicts.md |
| High subscription count, slow UI updates, excessive re-renders | references/subscription-cost.md |
| Function timeouts, transaction size errors, large payloads | references/function-budget.md |
| General "it's slow" with no specific signal | Start with references/hot-path-rules.md |
Multiple problem classes can overlap. Read the most relevant reference first, then check the others if symptoms remain.
If the likely fix is invasive, cross-cutting, or migration-heavy, stop and present options before editing.
Examples:
When correctness depends on handling old and new states during a rollout, consult skills/convex-migration-helper/SKILL.md for the migration workflow.
Pick one concrete user flow from the actual project. Look at the codebase, client pages, and API surface to find the flow that matches the symptom.
Write down:
useQuery, usePaginatedQuery, or useMutationFor each function in the path:
ctx.db.get() and ctx.db.query()ctx.db.patch(), ctx.db.replace(), and ctx.db.insert()In Convex, every extra read increases transaction work, and every write can invalidate reactive subscribers. Treat read amplification and invalidation amplification as first-class problems.
Read the reference file matching your problem class. Each reference includes specific patterns, code examples, and a recommended fix order.
Do not stop at the single function named by an insight. Trace sibling readers and writers touching the same tables.
When one function touching a table has a performance bug, audit sibling functions for the same pattern.
After finding one problem, inspect both sibling readers and sibling writers for the same table family, including companion digest or summary tables.
Examples:
Do not leave one path fixed and another path on the old pattern unless there is a clear product reason.
Confirm all of these:
references/hot-path-rules.md - Read amplification, invalidation, denormalization, indexes, digest tablesreferences/occ-conflicts.md - Write contention, OCC resolution, hot document splittingreferences/subscription-cost.md - Reactive query cost, subscription granularity, point-in-time readsreferences/function-budget.md - Execution limits, transaction size, large documents, payload sizeAlso check the official Convex Best Practices page for additional patterns covering argument validation, access control, and code organization that may surface during the audit.
tools
Sets up Convex authentication with user management, identity mapping, and access control. Use this skill when adding login or signup to a Convex app, configuring Convex Auth, Clerk, WorkOS AuthKit, Auth0, or custom JWT providers, wiring auth.config.ts, protecting queries and mutations with ctx.auth.getUserIdentity(), creating a users table with identity mapping, or setting up role-based access control, even if the user just says "add auth" or "make it require login."
development
Initializes a new Convex project from scratch or adds Convex to an existing app. Use this skill when starting a new project with Convex, scaffolding with npm create convex@latest, adding Convex to an existing React, Next.js, Vue, Svelte, or other frontend, wiring up ConvexProvider, configuring environment variables for the deployment URL, or running npx convex dev for the first time, even if the user just says "set up Convex" or "add a backend."
testing
Audits and optimizes Convex application performance across hot-path reads, write contention, subscription cost, and function limits. Use this skill when a Convex feature is slow or expensive, npx convex insights shows high bytes or documents read, OCC conflict errors or mutation retries appear, subscriptions or UI updates are costly, functions hit execution or transaction limits, or the user mentions performance, latency, read amplification, or invalidation problems in a Convex app.
tools
Plans and executes safe Convex schema and data migrations using the widen-migrate-narrow workflow and the @convex-dev/migrations component. Use this skill when a deployment fails schema validation, existing documents need backfilling, fields need adding or removing or changing type, tables need splitting or merging, or a zero-downtime migration strategy is needed. Also use when the user mentions breaking schema changes, multi-deploy rollouts, or data transformations on existing Convex tables.