convex-mutations

Implement and standardize Convex mutation functions with validators and scheduling patterns.

25|4|Updated Oct 18, 2025
One-click install
npx skills add https://github.com/Sstobo/convex-skills --skill convex-mutations
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: convex-mutations
Source: https://github.com/Sstobo/convex-skills/tree/main/convex-mutations
Command: npx skills add https://github.com/Sstobo/convex-skills --skill convex-mutations

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill standardizes and accelerates the creation of Convex mutation functions by providing best practices, patterns, and tooling guidance for defining, registering, and scheduling mutations, including transaction semantics and error handling.

Core Features & Use Cases

  • Guided mutation function definitions with validators and file-based routing.
  • Reference-driven workflow spanning definition, registration (mutation and internalMutation), and mutation calls from queries.
  • Scheduling support using ctx.scheduler.runAfter and transactional guarantees.
  • Comprehensive mutation guidelines with examples and patterns, including database operations (insert, patch, replace) and error handling.
  • Real-world example: define a "sendMessage" mutation and schedule a response to run after a delay.

Quick Start

Review the reference documentation at references/mutation-guidelines.md to implement a sample mutation following the patterns described. Then create a simple mutation in your Convex project and validate it against the guidelines.

Frequently Asked Questions about convex-mutations

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

FAQPage Schema
How do I define and schedule Convex mutations with transactional guarantees?

To define and schedule Convex mutations, you use validators for input definitions and ctx.scheduler.runAfter for delayed execution. This approach enforces transactional guarantees and standardizes mutation functions within your database operations.

What are the best practices for structuring Convex mutation functions and database operations?

Best practices for Convex mutation functions include using file-based routing, defining validators, and separating standard mutations from internalMutation registrations. Following these patterns ensures proper transaction semantics and reliable database operations like insert, patch, and replace.

Can I call a mutation from a query or schedule a delayed response in Convex?

Yes, you can call mutations from queries and schedule delayed responses using ctx.scheduler.runAfter. This reference-driven workflow supports defining, registering, and executing mutations with proper validation and scheduling semantics.

Does this approach support handling errors and validation in Convex database mutations?

Error handling and validation in Convex database mutations are fully supported. The guidelines provide patterns for comprehensive mutation definitions, ensuring data integrity through validators and structured error management during transactional database operations.

When should I use internalMutation instead of a standard mutation in Convex?

You use internalMutation in Convex when you need mutation functions accessible only internally, bypassing public API exposure. This distinction is part of the registration workflow, ensuring proper access control alongside standard mutation definitions and scheduling.