convex-best-practices

Enforce Convex best practices for function organization, validation, and error handling.

Updated Feb 26, 2026
One-click install
npx skills add https://github.com/NitzanSelwyn/MomentumTrackerAdmin --skill convex-best-practices-nitzanselwyn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: convex-best-practices
Source: https://github.com/NitzanSelwyn/MomentumTrackerAdmin/tree/main/.claude/skills/Convex%20Best%20Practices
Command: npx skills add https://github.com/NitzanSelwyn/MomentumTrackerAdmin --skill convex-best-practices-nitzanselwyn

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Guidelines for building production-ready Convex apps covering function organization, query patterns, validation, TypeScript usage, error handling, and the Zen of Convex design philosophy

Core Features & Use Cases

  • Domain-based function organization across modules
  • Validators for arguments and returns, type-safety, and robust error handling
  • Efficient query patterns with indexes and reactive data access
  • Guidance on TypeScript usage, internal vs public functions, and write conflict avoidance
  • Real-world examples and best-practices for production-grade Convex apps

Quick Start

Review your Convex project and refactor functions to follow domain-based organization, add validators for args/returns, and implement index-based queries.

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 a production-ready Convex app with TypeScript?

Organize production-ready Convex apps using domain-based function modules, YAML-frontmatter discovery, typed argument and return validators, and ConvexError handling to ensure consistent architecture and robust safety checks across teams.

What is the best way to handle errors in Convex functions?

Handle errors in Convex functions by utilizing the ConvexError class to throw typed exceptions, ensuring robust error handling and safety checks are consistently applied across all public and internal query and mutation functions.

How do I organize Convex queries and mutations by domain?

Group Convex queries and mutations into domain-based file modules across your project, using YAML-frontmatter driven discovery to maintain consistent architecture and clear separation of concerns across teams.

Does this Convex best practices approach work with existing TypeScript projects?

Yes, this approach works with existing TypeScript projects by refactoring current functions to follow domain-based organization, adding validators for arguments and returns, and implementing index-based queries without requiring new dependencies.

Why do I need argument and return validators in Convex?

Argument and return validators in Convex are needed to enforce type-safety and robust safety checks at runtime, ensuring that data flowing through public and internal functions meets strict schema requirements before database access.

How do I avoid write conflicts in Convex production apps?

Avoid write conflicts in Convex production apps by following efficient query patterns with indexes, understanding internal versus public function boundaries, and applying the Zen of Convex design philosophy for reactive data access.