convex-functions

Write Convex queries, mutations, actions, and HTTP actions with validators and error handling.

1|Updated Feb 19, 2026
One-click install
npx skills add https://github.com/kausthubh-coder/kriyan-web --skill convex-functions-kausthubh-coder
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: convex-functions
Source: https://github.com/kausthubh-coder/kriyan-web/tree/main/.cursor/skills/convex-functions
Command: npx skills add https://github.com/kausthubh-coder/kriyan-web --skill convex-functions-kausthubh-coder

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing Convex backend functions correctly requires knowing when to use queries, mutations, actions, or HTTP actions, plus proper argument validation and error handling. This Skill provides patterns and examples so you avoid common mistakes like calling external APIs from queries or skipping return validators. ## Core Features & Use Cases - Function Type Guidance: Clear rules for choosing between reactive queries, transactional mutations, external-API actions, and HTTP webhook endpoints. - Validation & Error Handling: Examples using v argument/return validators and ConvexError for user-facing failures. - Internal Functions & Scheduling: Patterns for internal mutations, scheduled functions via ctx.scheduler, and Node.js actions with "use node". - Use Case: You need to build a Stripe webhook endpoint that verifies signatures, processes payments via an action, and updates user credits through an internal mutation. ## Quick Start Write a Convex mutation that creates a task with argument validation and throws a ConvexError if the user does not exist.

Frequently Asked Questions about convex-functions

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

FAQPage Schema
How do I write a Convex query with argument validation?▼

Define the query with the object syntax using a handler property, specify args with validators from convex/values like v.id("users"), and add a returns validator. Queries are read-only, cached, and reactive by default.

What is the difference between Convex queries, mutations, and actions?▼

Queries are read-only, cached, and reactive for fetching data. Mutations are transactional for database writes. Actions can call external APIs but access the database only through runQuery and runMutation.

Can Convex mutations call external APIs like Stripe?▼

No, mutations and queries cannot call external APIs. Use an action to call the external service, then invoke runMutation to persist results. Add "use node" at the top of the file when the action needs Node.js APIs.

How do I create an HTTP webhook endpoint in Convex?▼

Use httpRouter in convex/http.ts and register routes with httpAction handlers. Inside the handler, verify signatures from request headers, then call runMutation or runQuery to interact with the database before returning a Response.

When should I use internal functions in Convex?▼

Use internalMutation, internalQuery, and internalAction for sensitive operations that should not be publicly callable, such as updating user credits. Internal functions can only be invoked from other Convex functions via the internal API object.

Why does my Convex action fail when using Node.js APIs?▼

Convex actions run in a restricted runtime by default. Add the "use node" directive at the top of the file to enable the Node.js runtime, which is required for Node-specific APIs and many npm packages.