Official Convex plugins for AI coding agents, providing comprehensive development tools for building reactive backends with TypeScript.
Supported Agents: Cursor, Claude Code (more coming soon)
This plugin makes Convex development easier by providing:
- 18 Best Practice Rules — Persistent AI guidance for query optimization, security, schema design, and more
- 6 Specialized Skills — Expert agent capabilities including quickstart, schema building, function creation, authentication, and migrations
- 2 Custom Agents — Specialized advisor and code reviewer for Convex development
- MCP Integration — Direct access to your Convex deployment data and operations
- Development Hooks — pre-commit checks (blocking) and an end-of-turn verify retry-loop (non-blocking; see Cursor plugin mechanism status)
Convex is the reactive backend-as-a-service where you build your entire backend in TypeScript. It provides:
- Reactive Database — Real-time queries that automatically update your UI
- Serverless Functions — Write queries, mutations, and actions in TypeScript
- Built-in Auth — Integrate with WorkOS, Auth0, or custom JWT providers
- Type Safety — End-to-end TypeScript with automatic type generation
- Vector Search — Built-in vector database for AI applications
Install this plugin via the Cursor Marketplace or manually:
# Clone or download this plugin
cd ~/.cursor/plugins
git clone <this-repo-url> convex
# Restart CursorThe plugin helps the AI understand when Convex might be a good fit for your project, such as when you're building real-time features, setting up a backend, or starting a new application. It provides relevant guidance and can help with setup when needed.
The plugin includes 18 rules that provide persistent AI guidance:
Development Best Practices:
- async-handling — Always await promises to prevent unexpected behavior
- query-optimization — Use indexes instead of
.filter()for efficient queries - argument-validation — All public functions must validate args and returns
- authentication-checks — Implement auth checks in all protected functions
- schema-design — Design flat, relational schemas with proper indexes
- function-organization — Keep wrappers thin, put logic in TypeScript functions
- scheduler-usage — Only schedule internal functions, never api functions
- no-date-now-in-queries — Avoid Date.now() in queries (breaks reactivity)
- use-node-for-actions — Use "use node" directive when actions need Node.js APIs
- custom-functions-for-auth — Data protection patterns (Convex's RLS alternative)
- use-components-for-encapsulation — Sibling components for modularity
- use-eslint-always — ESLint with @convex-dev/eslint-plugin is mandatory
- typescript-strict-no-any — TypeScript strict mode, avoid 'any' type
- error-handling-patterns — Proper error handling (throw vs return null)
- local-development-agent-mode — Agent mode for cloud coding agents
- use-pagination-for-large-datasets — Cursor-based pagination for performance
Plus contextual rules for new projects, real-time features, and deployment workflows.
Rules automatically guide the AI when working in your convex/ directory.
Invoke specialized agent capabilities for complex Convex tasks:
Initialize a new Convex backend from scratch with schema, auth, and CRUD operations.
Use when:
- Starting a brand new project with Convex
- Adding Convex to an existing React/Next.js app
- Need step-by-step setup guidance
Example:
User: "Set up a Convex backend for my project"
Assistant: [Walks through installation, schema, auth, and CRUD setup]
Design and generate database schemas with proper validation, indexes, and relationships.
Use when:
- Creating
convex/schema.ts - Adding tables or modifying structure
- Converting nested data to relational design
- Optimizing indexes
Example:
User: "Create a schema for a task management app with users, teams, and tasks"
Assistant: [Generates complete schema with proper indexes and relationships]
Create queries, mutations, and actions with proper validation, auth, and error handling.
Use when:
- Implementing new API endpoints
- Creating CRUD operations
- Adding authenticated functions
- Writing actions that call external APIs
Example:
User: "Create a mutation to update a task with ownership check"
Assistant: [Generates secure mutation with auth and authorization]
Set up authentication with user management, identity mapping, and access control.
Use when:
- Implementing authentication for the first time
- Setting up OAuth providers (WorkOS, Auth0)
- Creating auth helper functions
- Implementing role-based access control
Example:
User: "Set up WorkOS authentication with user roles"
Assistant: [Creates users table, auth helpers, and role checking functions]
Plan and execute schema migrations safely without downtime.
Use when:
- Adding required fields to existing tables
- Changing field types or structure
- Migrating from arrays to relational tables
- Renaming fields
Example:
User: "Migrate tags array to a separate tags table"
Assistant: [Creates migration plan with dual-write pattern and batch processing]
The plugin includes specialized agents for Convex development:
Provides guidance on Convex architecture and development patterns.
- Helps with backend architecture decisions
- Explains Convex features and capabilities
- Provides migration paths from other databases
- Answers questions about Convex best practices
Code reviewer specialized in Convex best practices.
- Security: Auth, validation, authorization
- Performance: Indexes, query optimization
- Code quality: Organization, type safety
- Identifies Convex-specific anti-patterns
The plugin includes MCP (Model Context Protocol) integration for direct access to your Convex deployment:
- Query your database schema
- Read deployment configuration
- Access environment variables
- View function definitions
- Check deployment status
Configuration:
Set these environment variables:
export CONVEX_DEPLOYMENT="your-deployment-name"
export CONVEX_DEPLOY_KEY="your-deploy-key"The plugin ships two Cursor hooks (hooks.json, wired via .cursor-plugin/plugin.json's hooks field — see Cursor's hooks docs for the full event list and schema). These are real Cursor mechanisms, not just instructions: each is a spawned script that Cursor calls automatically and whose JSON output Cursor acts on.
Runs before any shell command matching git commit; can deny the commit outright.
- Checks:
Date.now()inside/nearquery({...})bodies,.filter()chained ondb.query(...). - Script:
scripts/pre-commit-checks.sh
Fires when the agent's turn ends (status: "completed"). Cursor's stop hook cannot block completion — but it can return a followup_message that Cursor automatically submits as the next user turn, capped by loop_limit (set to 2 here) so it can't loop forever. This turns the SELF-VERIFY RULE already in rules/quickstart.mdc (run npx tsc --noEmit before declaring backend work done) from an instruction the agent might forget into a mechanism that catches it if it does: if convex/ exists and npx tsc --noEmit fails, the hook auto-submits a follow-up turn with the compiler errors so the agent fixes them before the session is really "done".
- Script:
scripts/stop-verify.sh - Honest limitation: this is a retry-loop, not a hard gate — Cursor has no hook that blocks turn completion the way Claude Code's
Stophook or a CI gate would. A user who ignores the follow-up (or an agent that exhausts the loop limit) can still end the session with a broken build. See Cursor plugin mechanism status below for how this compares to the Claude Code and Codex equivalents.
// Simply ask the AI:
"Create a schema for a blog with users, posts, and comments";
// The plugin's schema-builder skill will guide the creation of:
// - Properly indexed tables
// - Relational structure (no deep nesting)
// - Correct validator types
// - Compound indexes for common queries// Ask:
"Set up authentication with WorkOS and create a getCurrentUser helper";
// The auth-setup skill will create:
// - users table with tokenIdentifier index
// - getCurrentUser helper function
// - storeUser mutation for first sign-in
// - Example access control patterns// Ask:
"Create CRUD operations for tasks with ownership checks";
// The function-creator skill will generate:
// - Properly validated functions
// - Authentication checks
// - Authorization (ownership) checks
// - Indexed queries (no .filter())
// - Error handling// Ask:
"I need to add a required 'status' field to existing tasks";
// The migration-helper skill will:
// 1. Add field as optional first
// 2. Generate backfill migration code
// 3. Provide verification query
// 4. Guide making field required after backfill- ✅ All public functions validate arguments
- ✅ Authentication checks with
ctx.auth.getUserIdentity() - ✅ Authorization checks for resource ownership
- ✅ Only internal functions can be scheduled
- ✅ Use
.withIndex()instead of.filter() - ✅ Index all foreign keys
- ✅ Remove redundant indexes
- ✅ Batch large operations
- ✅ All promises awaited (no floating promises)
- ✅ Logic in plain TypeScript functions
- ✅ Thin query/mutation/action wrappers
- ✅ Clear error messages
- ✅ Flat, relational structure
- ✅ IDs for relationships (not nested objects)
- ✅ Arrays only for small, bounded collections
- ✅ Proper validator types
Make sure hook scripts are executable:
chmod +x scripts/*.shVerify environment variables are set:
echo $CONVEX_DEPLOYMENT
echo $CONVEX_DEPLOY_KEYGet your deploy key from the Convex Dashboard.
Ensure you have Convex installed:
npm install convex
# or
npm install convex@latestConvex ships an end-of-turn "verify before you say you're done" mechanism across the coding agents it supports, but the strength of that mechanism depends on what each agent's plugin format actually offers:
| Agent | Mechanism | Enforcement |
|---|---|---|
| Claude Code | Stop hook |
Can block: the hook can require the agent keep working before the turn is allowed to end. |
| Codex | MCP server leg (fix_errors_automatically) |
Blocking tool call: the agent's own idle loop calls a tool that blocks until a real event (including a compile error) fires. |
| Cursor | stop hook → followup_message (scripts/stop-verify.sh) |
Not blocking. Cursor's stop hook cannot prevent a turn from ending; it can only auto-submit a follow-up message (capped at loop_limit: 2 here) asking the agent to fix what the hook found. A user can still walk away from a broken build if they ignore the follow-up or the loop limit is hit. |
This is a real, Cursor-native mechanism — not just the static SELF-VERIFY RULE text in rules/quickstart.mdc — but it is a retry-loop, not a gate. Cursor's plugin format has no hook that blocks turn completion the way Claude Code's Stop hook does (confirmed against Cursor's hooks documentation: the stop event's own docs state it fires "when the agent loop ends" and its only output field is the informational/loop-triggering followup_message — there is no permission/block field on that event, unlike beforeShellExecution which this plugin already uses to hard-deny bad git commits). If Cursor ships a blocking end-of-turn hook in the future, this is the file to upgrade (scripts/stop-verify.sh + the stop entry in hooks.json).
This is the official Convex plugin maintained by the Convex team. For issues or suggestions:
- Report issues on GitHub
- Join the Convex Discord
- Contact: [email protected]
This plugin connects to Convex services. See the Convex privacy policy for full details and your rights.
This plugin sends no usage telemetry.
The /add command downloads a capability catalog and setup scripts from the Convex scaffolding service, and runs those scripts. The service logs each script download as an anonymous event.
If you don't run /add, the plugin sends nothing to these services.
MIT License - See LICENSE file for details
Built with ❤️ by the Convex team