Install any skill in seconds. Free to start, no credit card required.
Get Started Free →waynesutton/convex-functions
Writing queries, mutations, actions, and HTTP actions with proper argument validation, error handling, internal functions, and runtime considerations
Passed 21 of 22 test cases with the skill, and 6 of 22 without it.
and 14 more in the full report
15 fixed6 passed either way1 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
This benchmark measured an earlier version of the skill.
A newer attempt on gemini-3.6-flash on 10/3/2026 did not produce a publishable comparison (not comparable). The snapshot above is the previously measured run.
One of 15 test cases the skill fixed. Same model, same prompt, with and without the skill.
I need a backend function in Convex to fetch a single user profile by their user ID. If the user isn't found, return null. Keep it simple and idiomatic.
| Checked | Without skill | With skill |
|---|---|---|
| The query function includes a returns validator. | Missed | Passed |
| The return validator specifies a union with v.null(). | Missed | Passed |
| The database lookup passes "users" as the table name argument to ctx.db.get. | Missed | Passed |
The instructions your model reads when the skill loads.
Every exported function in convex/ uses the object form with args and returns validators. Pick the type by what the handler touches: queries read, mutations write, actions call out.
| Type | Database | External calls | Callable by | Use for |
|---|---|---|---|---|
query | Read | No | Clients, other functions | Reads. Cached and reactive. |
mutation | Read and write | No | Clients, other functions | Writes. One transaction. |
action | Only via runQuery and runMutation | Yes | Clients, scheduler, other actions | fetch, third party SDKs, Node APIs |
internalQuery, internalMutation, internalAction | Same as the public form | Same | Only other Convex functions | Scheduled work, crons, privileged writes |
httpAction | Only via runQuery and runMutation | Yes | HTTP requests in convex/http.ts | Webhooks, REST endpoints |
Default to query or mutation. Reach for an action only when the handler must talk to something outside Convex.
Declare args and returns on every function. A function that returns nothing declares returns: v.null() and returns null. Hoist a shared document validator when several functions return the same shape.
// convex/tasks.ts
import { query, mutation } from "./_generated/server";
import { v } from "convex/values";
const taskValidator = v.object({
_id: v.id("tasks"),
_creationTime: v.number(),
userId: v.id("users"),
title: v.string(),
completed: v.boolean(),
});
export const get = query({
args: { taskId: v.id("tasks") },
returns: v.union(taskValidator, v.null()),
handler: async (ctx, args) => {
return await ctx.db.get(args.taskId);
},
});
test cases passed, vs 6 / 22 without
Published skills whose descriptions closely match this one, with their headline benchmark lift.
More skills from the same source and nearby in the registry, with their headline benchmark lift.