convex-best-practices

Guide Convex application development with best practices for functions, queries, and validation.

Updated Mar 11, 2025
One-click install
npx skills add https://github.com/MohammedSaudAlsahli/dotfiles --skill convex-best-practices-mohammedsaudalsahli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: convex-best-practices
Source: https://github.com/MohammedSaudAlsahli/dotfiles/tree/main/ai/agents-skills/convex-best-practices
Command: npx skills add https://github.com/MohammedSaudAlsahli/dotfiles --skill convex-best-practices-mohammedsaudalsahli

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires convex, typescript, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill provides developers with best practices for building production-ready Convex applications, covering various aspects such as function organization, query patterns, validation, TypeScript usage, error handling, and the design philosophy of Convex.

Core Features & Use Cases

  • Best Practices Guide: Offers detailed guidelines for structuring Convex applications.
  • Code Quality Standards: Includes a reference to @convex-dev/eslint-plugin for build-time validation.
  • Documentation Sources: Provides links to primary documentation for deeper understanding.
  • Function Organization: Explains how to organize Convex functions by domain.
  • Argument and Return Validation: Shows examples of validating arguments and return types.
  • Query Patterns: Demonstrates efficient query techniques using indexes.
  • Error Handling: Describes the use of ConvexError for user-facing errors.
  • TypeScript Best Practices: Shares TypeScript-related recommendations for Convex apps.
  • Internal vs Public Functions: Differentiates between public and internal functions.
  • CRUD Pattern: Provides an example of a complete CRUD pattern for Convex tasks.

Quick Start

Apply the convex-best-practices skill to your Convex project to follow established patterns and improve code quality.

Frequently Asked Questions about convex-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure queries in Convex for optimal performance?

Optimize Convex queries by organizing functions by domain, validating arguments and return types, and using indexes for efficient query patterns. This ensures production-ready applications with maintainable code quality.

What is the best way to handle errors in a Convex application?

Handle errors in Convex applications by using ConvexError for user-facing errors. This approach maintains code quality standards while providing clear feedback during application development.

How do I validate arguments and return types in Convex functions?

Validate arguments and return types in Convex functions by applying TypeScript usage best practices and referencing @convex-dev/eslint-plugin for build-time validation to ensure code quality.

How should I organize internal vs public functions in Convex?

Differentiate between internal and public functions in Convex by following established function organization patterns. This separation enforces application security and design philosophy standards.

Does this guide include a complete CRUD pattern for Convex tasks?

Yes, it includes a complete CRUD pattern for Convex tasks. This example demonstrates function organization, validation, and TypeScript usage for production-ready application development.

What TypeScript best practices should I follow when developing Convex apps?

Follow TypeScript best practices for Convex apps by validating arguments and return types, organizing functions by domain, and using @convex-dev/eslint-plugin for build-time code quality validation.