convex-functions

Implements Convex queries, mutations, actions, and HTTP endpoints with argument validation and error handling.

Updated May 28, 2026
One-click install
npx skills add https://github.com/mrisoli/pokerhouse --skill convex-functions-mrisoli
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: convex-functions
Source: https://github.com/mrisoli/pokerhouse/tree/main/.agents/skills/convex-functions
Command: npx skills add https://github.com/mrisoli/pokerhouse --skill convex-functions-mrisoli

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing Convex backend functions correctly requires knowing when to use queries versus mutations versus actions, how to validate arguments, and how to handle errors and internal-only logic. This Skill provides the patterns and code templates to implement Convex functions correctly the first time. ## 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: Enforces argument and return validators with convex/values and user-facing errors via ConvexError. - Internal Functions & Scheduling: Patterns for internal-only mutations and scheduled functions using ctx.scheduler. - Use Case: When building a chat feature, use this Skill to generate a messages.ts file with a paginated list query, a send mutation with validation, and an internal mutation that notifies subscribers. ## Quick Start Ask the AI to write a Convex mutation that creates a task with argument validation and a query that lists tasks by user using an index.

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 mutation with argument validation?▼

Define the mutation with the object syntax, providing an args object using validators from convex/values and a handler function. Always include a returns validator and throw ConvexError for user-facing validation failures.

When should I use a Convex action instead of a mutation?▼

Use actions only when calling external APIs, since actions have no direct database access and must use runQuery or runMutation. Use mutations for transactional database writes and queries for cached, reactive reads.

Can Convex queries call external APIs?▼

No, queries are read-only, cached, and reactive, so they cannot call external APIs. Move external calls into an action, which can then read or write data through runQuery and runMutation.

How do I handle webhooks with Convex HTTP actions?▼

Define routes in convex/http.ts using httpRouter and httpAction, then verify signatures such as the stripe-signature header before processing. Forward validated events to internal mutations via ctx.runMutation.

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

Actions using Node.js APIs require the "use node"; directive at the top of the file. Without it, the function runs in the default Convex runtime where Node built-ins are unavailable.