
Convex Functions
Author Convex queries, mutations, actions, and HTTP actions with validation, error handling, and internal function patterns for a realtime backend.
Overview
Convex Functions is an agent skill for the Build phase that helps solo builders write validated Convex queries, mutations, actions, and HTTP actions with sound error handling.
Install
npx skills add https://github.com/waynesutton/convexskills --skill convex-functionsWhat is this skill?
- Covers Convex queries, mutations, actions, and HTTP actions in one skill surface
- Emphasizes argument validation and structured error handling on server functions
- Guidance for internal functions and appropriate public versus private entry points
- Fits Convex’s TypeScript-first backend model for solo full-stack builders
- Pairs with Convex hosting for realtime sync without自建 REST boilerplate
Adoption & trust: 2.6k installs on skills.sh; 402 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You are on Convex but your agent keeps generating server functions without proper validators, internal boundaries, or consistent error handling.
Who is it for?
Indie full-stack developers standardizing Convex backend code via Claude Code or Cursor while shipping a realtime SaaS or agent tool.
Skip if: Projects not using Convex, pure static sites with no backend, or teams wanting generic Express or Supabase patterns instead of Convex APIs.
When should I use this skill?
Writing or refactoring Convex queries, mutations, actions, or HTTP actions with validation and error handling.
What do I get? / Deliverables
You get Convex function implementations that follow platform conventions for validation, internal calls, and HTTP actions ready to wire from your React or agent client.
- Validated Convex query and mutation modules
- Action functions for external integrations
- HTTP action handlers where webhooks or REST ingress are required
Recommended Skills
Journey fit
Build phase is canonical because the skill helps implement server-side Convex logic that powers the product’s data layer. Backend subphase reflects writing database-backed functions rather than Convex dashboard ops or pure frontend hooks alone.
How it compares
Convex-specific function authoring skill—not a general REST controller generator or a hosted MCP database server.
Common Questions / FAQ
Who is convex-functions for?
It is for developers building on Convex who want their coding agent to produce queries, mutations, actions, and HTTP handlers that match Convex best practices.
When should I use convex-functions?
Use it during Build backend work when defining data access layers, adding validated mutations, wrapping external APIs in actions, or exposing HTTP endpoints—before Ship security review of public surfaces.
Is convex-functions safe to install?
It guides server code that can access your Convex deployment and secrets; review the Security Audits panel on this Prism page and audit generated functions for auth, validation, and least-privilege internal calls.
SKILL.md
READMESKILL.md - Convex Functions
interface: icon_small: "./assets/small-logo.svg" icon_large: "./assets/large-logo.png" <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <g clip-path="url(#clip0_3_23)"> <g clip-path="url(#clip1_3_23)"> <path d="M10.0643 12.5735C12.3769 12.3166 14.5572 11.0843 15.7577 9.02756C15.1892 14.1148 9.62646 17.3302 5.08583 15.356C4.66743 15.1746 4.30728 14.8728 4.06013 14.4848C3.03973 12.8825 2.7043 10.8437 3.18626 8.99344C4.56327 11.37 7.3632 12.8267 10.0643 12.5735Z" fill="#F3B01C"/> <path d="M3.1018 7.50072C2.16436 9.66714 2.12376 12.2034 3.27303 14.2907C-0.771507 11.2479 -0.72737 4.7362 3.2236 1.72378C3.58904 1.44535 4.02333 1.2801 4.47881 1.25494C6.3519 1.15614 8.25501 1.88006 9.58963 3.22909C6.87799 3.25604 4.23695 4.99308 3.1018 7.50072Z" fill="#8D2676"/> <path d="M10.8974 3.89562C9.52924 1.98794 7.38779 0.68921 5.04156 0.649695C9.57686 -1.40888 15.1555 1.92867 15.7629 6.86314C15.8194 7.32119 15.7452 7.78824 15.5421 8.20138C14.6948 9.92223 13.1236 11.2569 11.2876 11.7508C12.6328 9.25579 12.4668 6.20748 10.8974 3.89562Z" fill="#EE342F"/> </g> </g> <defs> <clipPath id="clip0_3_23"> <rect width="16" height="16" fill="white"/> </clipPath> <clipPath id="clip1_3_23"> <rect width="16" height="16" fill="white"/> </clipPath> </defs> </svg> --- name: convex-functions displayName: Convex Functions description: Writing queries, mutations, actions, and HTTP actions with proper argument validation, error handling, internal functions, and runtime considerations version: 1.0.0 author: Convex tags: [convex, functions, queries, mutations, actions, http] --- # Convex Functions Master Convex functions including queries, mutations, actions, and HTTP endpoints with proper validation, error handling, and runtime considerations. ## Code Quality All examples in this skill comply with @convex-dev/eslint-plugin rules: - Object syntax with `handler` property - Argument validators on all functions - Explicit table names in database operations See the Code Quality section in [convex-best-practices](../convex-best-practices/SKILL.md) for linting setup. ## Documentation Sources Before implementing, do not assume; fetch the latest documentation: - Primary: https://docs.convex.dev/functions - Query Functions: https://docs.convex.dev/functions/query-functions - Mutation Functions: https://docs.convex.dev/functions/mutation-functions - Actions: https://docs.convex.dev/functions/actions - HTTP Actions: https://docs.convex.dev/functions/http-actions - For broader context: https://docs.convex.dev/llms.txt ## Instructions ### Function Types Overview | Type | Database Access | External APIs | Caching | Use Case | | ----------- | ------------------------ | ------------- | ------------- | --------------------- | | Query | Read-only | No | Yes, reactive | Fetching data | | Mutation | Read/Write | No | No | Modifying data | | Action | Via runQuery/runMutation | Yes | No | External integrations | | HTTP Action | Via runQuery/runMutation | Yes | No | Webhooks, APIs | ### Queries Queries are reactive, cached, and read-only: ```typescript import { query } from "./_generated/server"; import { v } from "convex/values"; export const getUser = query({ args: { userId: v.id("users") }, returns: v.union( v.object({ _id: v.id("users"), _creationTime: v.number(), name: v.string(), email: v.string(), }), v.null(), ), handler: async (ctx, args) => { return await ctx.db.get("users", args.userId); }, }); // Query with index export const listUserTasks = query({ args: { userId: v.id("users") }, returns: v.array( v.object({ _id: v.id("tasks"), _creationTime: v.number(), title: v.string(), completed: v.boolean(), }), ), handler: async (ctx, args) => { return