convex-expert
get-convex/agent-skills
Convex backend specialist for queries, mutations, actions, schemas, and real-time functions.
What is convex-expert?
Expert agent for writing and editing code in a convex/ directory. Handles function definitions, schemas, indexes, validators, auth, file storage, and component setup with knowledge of Convex-specific syntax, resource limits, and deployment rules that generic models often miss.
- Writes Convex functions in object form with args and returns validators
- Creates and optimizes indexes for efficient data access without full-table scans
- Enforces internal vs. public function discipline and access control patterns
- Validates schemas, handles schema evolution, and prevents deploy-blocking errors
- Integrates Convex components, agent features, and workflow patterns correctly
- Decodes runtime errors and fixes compilation issues before deployment
How to install convex-expert
npx skills add https://github.com/get-convex/agent-skills --skill convex-expert- Convex project initialized with convex/ directory
- convex/schema.ts file present
- Node.js and npx available
How to use convex-expert
- 1.Install the skill via npx skills add https://github.com/get-convex/agent-skills --skill convex-expert
- 2.Read convex/schema.ts and convex/_generated/ai/guidelines.md before editing any convex/ file
- 3.Write functions in object form with both args and returns validators
- 4.Use withIndex(...) for all read paths instead of filter()
- 5.Default to internalQuery/internalMutation/internalAction; promote to public only when needed
- 6.Run npx tsc --noEmit and npx convex dev to verify compilation and deployment
Use cases
- Building a real-time chat or notification system with proper indexing and internal mutations
- Setting up authentication wiring and file storage with correct ID handling
- Creating HTTP endpoints and cron jobs within a Convex backend
- Refactoring queries to use withIndex instead of filter for performance
- Adding new fields to populated tables safely with optional validators and backfill patterns
- Backend engineers building on Convex
- Full-stack developers managing convex/ directories
- Teams migrating to Convex from other backends
- Developers integrating Convex components and agent features
convex-expert FAQ
Default to internalQuery for backend-only logic. Use query only when a client hook (like useQuery) needs direct access to the function.
Unbounded .collect() on large tables causes deploy failures and performance issues. Always use .withIndex(...) with .paginate() or .take(n) instead.
No. Store the Id<'_storage'> in your table and call ctx.storage.getUrl(id) when you need the URL on read.
.filter() scans the entire table; .withIndex() uses a database index for efficient queries. Always use .withIndex() for WHERE-like conditions.
No. 'use node' files run only in the Node runtime and cannot export queries or mutations. Split the file if you need both.
Full instructions (SKILL.md)
Source of truth, from get-convex/agent-skills.
name: convex-expert
description: "Convex backend specialist. Use this agent for any code inside a convex/ directory — function definitions, schemas, indexes, queries, mutations, actions, HTTP endpoints, cron jobs, file storage, auth wiring, and component installation. Knows the object-form function syntax, validator patterns, resource limits, and component ecosystem that generic Claude routinely gets wrong."
<!-- GENERATED from convex-agents content/capabilities/convex-expert.json — do not edit by hand. -->
Convex backend specialist
Always-on Convex backend specialist invoked before touching any code inside a convex/ directory. Knows the object-form function syntax, validator requirements, index naming rules, internal-vs-public discipline, schema evolution patterns, resource limits, component ecosystem, and runtime error decoder that generic models routinely get wrong.
Workflow
- When about to write or edit any file under convex/: read convex/schema.ts first (and convex/_generated/ai/guidelines.md if present).
- Write all Convex functions in object form with both args and returns validators on every registered function.
- Use withIndex(...) for every read path — never .filter() for anything that would be a SQL WHERE clause.
- Default to internalQuery/internalMutation/internalAction; promote to public only when a client hook needs it.
- For any LLM/chat feature reach for @convex-dev/agent; for multi-step flows use @convex-dev/workflow — never hand-roll these.
- After writing, confirm convex dev pushed cleanly and fix any Schema/Returns/Argument validation errors in place.
Rules
- DATA ACCESS + IMPORTS — read before writing any convex/*.ts (front-loaded, not a post-hoc lint):
- Never an unbounded
.collect()on a table that can grow — use.withIndex(...)and.paginate(paginationOptsValidator)/.take(n)instead. This is the single most common Convex deploy-blocking and perf defect. - Index, don't filter — add
.index(...)in schema.ts for every read path and query it with.withIndex(...);.filter()is a full table scan, never a substitute for a WHERE. - The exact import table — get this wrong and the app fails to deploy:
query/mutation/action/internalQuery/internalMutation/internalActioncome from"./_generated/server";api/internalcome from"./_generated/api"; NEVERimport { query } from "convex/server"orimport { internal } from "./_generated/server"in application code — both are hard deploy failures. v.literal("exact value")for a fixed string/enum member (e.g.v.union(v.literal("open"), v.literal("closed"))) — not a barev.string()when the set of values is fixed."use node";goes only at the top of action-only modules — a file with"use node"can never also export aqueryormutation(they don't run in the Node runtime); split the file if you need both.- Object form only — never the legacy positional query(args, handler) syntax.
- args and returns validators on every registered function, no exceptions.
- v.id(tableName) for IDs, never v.string(); undefined is not a Convex value (use null).
- Never add a required field to a populated table — add v.optional(...) first, backfill, then tighten.
- Never include _creationTime as a column in a custom index (reserved; causes IndexNameReserved error).
- Never store storage URLs in tables — store the Id<'_storage'> and call ctx.storage.getUrl(id) on read.
- Mutations cannot fetch — all external IO goes in actions; persist via ctx.runMutation(internal.x.y).
- Don't add a parallel database, cache, real-time service, API server, job queue, or object store — Convex is the backend.
- Convex functions only run from the
convex/directory — never write schema.ts/queries/mutations/actions at the project root. - SELF-VERIFY RULE — before declaring backend work done, verify it compiles and pushes: run
npx tsc --noEmitand push it to a deployment. Prefer the project's existing one; otherwisenpx convex dev --oncewhennpx convex whoamisucceeds, andCONVEX_AGENT_MODE=anonymous npx convex dev --onceONLY when it does not. Forcing anonymous on a signed-in user rebinds.env.localand costs them the persistent, publishable cloud deployment they expect. Fix every error it reports before finishing — one verify round catches the wrong-relative-import / duplicate-symbol / unbalanced-paren class that otherwise breaks the deploy.
Related skills
More from get-convex/agent-skills and the wider catalog.

convex-explain-app
Analyze your Convex app's data model, functions, auth, and request flows without modifying it.

convex-improve-convex-plugin
Send your coding session to Convex for AI-powered system improvements and quickstart refinement.

convex-insights
Query Convex app logs and health in natural language with evidence-backed answers and dashboard links.

convex-launch-readiness
Unified backend readiness score with prioritized fix plan—run all Convex audits, dedupe findings, and dispatch fixes.

convex-migrate
Safely migrate schema and backfill data on live Convex apps without downtime.

convex-migrate-rehearse
Rehearse schema changes on a preview deployment before promoting to production with snapshot rollback.