
Convex Helpers Guide
Find and apply official convex-helpers patterns for relationships, filtering, sessions, and custom Convex functions instead of hand-rolling backend utilities.
Overview
Convex Helpers Guide is an agent skill for the Build phase that maps official convex-helpers utilities so you can implement relationships, filtering, sessions, and custom Convex functions without reinventing server patte
Install
npx skills add https://github.com/get-convex/agent-skills --skill convex-helpers-guideWhat is this skill?
- Maps official `convex-helpers` utilities with install line `npm install convex-helpers`
- Relationship helpers: `getOneFrom` and `getManyFrom` for typed cross-table loads
- Example query composes a task with user and related comments in one handler
- Covers filtering, sessions, custom functions, and additional helper categories in the full guide
- Positions helpers as battle-tested complements to core Convex APIs
- Install: npm install convex-helpers
- Relationship example uses getOneFrom and getManyFrom
Adoption & trust: 572 installs on skills.sh; 31 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your Convex handlers are growing verbose and error-prone because every feature reimplements joins, filters, and session glue by hand.
Who is it for?
Solo builders on Convex adding relational queries, shared server utilities, or session-aware functions to an existing backend.
Skip if: Greenfield projects with no Convex schema yet, or teams that need non-Convex databases without a Convex backend.
When should I use this skill?
You need pre-built Convex patterns from convex-helpers for relationships, filtering, sessions, custom functions, or more.
What do I get? / Deliverables
Handlers import the right convex-helpers modules with type-safe relationship and utility patterns aligned to Convex’s recommended approach.
- Convex handlers using convex-helpers imports
- Documented helper choice per feature (relationships, filters, sessions, etc.)
Recommended Skills
Journey fit
Convex backend logic is authored during product build; helpers accelerate queries, mutations, and shared server patterns. Guide targets server-side Convex handlers and npm-installed helper modules—the backend shelf for data and function design.
How it compares
Official-pattern guide for Convex server code—not a hosted MCP server or a frontend component library.
Common Questions / FAQ
Who is convex-helpers-guide for?
Indie developers and small teams building Convex backends who want pre-built, maintained utilities instead of custom relationship and filter code.
When should I use convex-helpers-guide?
During build/backend work when you need related-table queries, list filtering, session handling, or custom function wrappers on Convex.
Is convex-helpers-guide safe to install?
It documents npm dependencies and server patterns; review the Security Audits panel on this page and pin `convex-helpers` versions like any production dependency.
SKILL.md
READMESKILL.md - Convex Helpers Guide
# Convex Helpers Guide Use convex-helpers to add common patterns and utilities to your Convex backend without reinventing the wheel. ## What is convex-helpers? `convex-helpers` is the official collection of utilities that complement Convex. It provides battle-tested patterns for common backend needs. **Installation:** ```bash npm install convex-helpers ``` ## Available Helpers ### 1. Relationship Helpers Traverse relationships between tables in a readable, type-safe way. **Use when:** - Loading related data across tables - Following foreign key relationships - Building nested data structures **Example:** ```typescript import { getOneFrom, getManyFrom } from "convex-helpers/server/relationships"; export const getTaskWithUser = query({ args: { taskId: v.id("tasks") }, handler: async (ctx, args) => { const task = await ctx.db.get(args.taskId); if (!task) return null; // Get related user const user = await getOneFrom( ctx.db, "users", "by_id", task.userId, "_id" ); // Get related comments const comments = await getManyFrom( ctx.db, "comments", "by_task", task._id, "taskId" ); return { ...task, user, comments }; }, }); ``` **Key Functions:** - `getOneFrom` - Get single related document - `getManyFrom` - Get multiple related documents - `getManyVia` - Get many-to-many relationships through junction table ### 2. Custom Functions (Data Protection) - MOST IMPORTANT **This is Convex's alternative to Row Level Security (RLS).** Instead of database-level policies, use custom function wrappers to automatically add auth and access control to all queries and mutations. Create wrapped versions of query/mutation/action with custom behavior. **Use when:** - **Data protection and access control** (PRIMARY USE CASE) - Want to add auth logic to all functions - Multi-tenant applications - Role-based access control (RBAC) - Need to inject common data into ctx - Building internal-only functions - Adding logging/monitoring to all functions **Why this instead of RLS:** - TypeScript, not SQL policies - Full type safety - Easy to test and debug - More flexible than database policies - Works across your entire backend **Example: Custom Query with Auto-Auth** ```typescript // convex/lib/customFunctions.ts import { customQuery } from "convex-helpers/server/customFunctions"; import { query } from "../_generated/server"; export const authenticatedQuery = customQuery( query, { args: {}, // No additional args required input: async (ctx, args) => { const identity = await ctx.auth.getUserIdentity(); if (!identity) { throw new Error("Not authenticated"); } const user = await ctx.db .query("users") .withIndex("by_token", q => q.eq("tokenIdentifier", identity.tokenIdentifier) ) .unique(); if (!user) throw new Error("User not found"); // Add user to context return { ctx: { ...ctx, user }, args }; }, } ); // Usage in your functions export const getMyTasks = authenticatedQuery({ handler: async (ctx) => { // ctx.user is automatically available! return await ctx.db .query("tasks") .withIndex("by_user", q => q.eq("userId", ctx.user._id)) .collect(); }, }); ``` **Example: Multi-Tenant Data Protection** ```typescript import { customQuery } from "convex-helpers/server/customFunctions"; import { query } from "../_generated/server"; // Organization-scoped query - automatic access control export const orgQuery = customQuery(query, { args: { orgId: v.id("organizations") }, input: async (ctx, args) => { const user = await getCurrentUser(ctx); // Verify user is a member of this organization const mem