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 — Automated validation, codegen, and pre-commit checks
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"Automated checks and operations triggered by file changes:
Validates Convex functions have proper args and returns validators.
- Triggers on: Save in
convex/**/*.tsorconvex/**/*.js - Checks: Function exports have args and returns defined
Automatically runs Convex codegen after schema changes.
- Triggers on: Save in
convex/schema.ts - Action: Runs
npx convex codegen --dev
Runs ESLint, type checking, and common issue detection before commits.
- Checks:
- ESLint on Convex functions
- TypeScript type checking
- Date.now() in queries (warning)
- .filter() on database queries (warning)
// 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@latestThis 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]
MIT License - See LICENSE file for details
Built with ❤️ by the Convex team