Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →All public functions must validate arguments and return types
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -6% | 0% |
| case-02 | ✗→✓ | ▲ Improved | -42% | 0% |
| case-03 | ✗→✓ | ▲ Improved | -42% | 0% |
| case-04 | ✗→✓ | ▲ Improved | -21% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 36% | 0% |
All public query, mutation, and action functions MUST define validators for both arguments and return types. This protects against malicious input and provides type safety.
Always use the args and returns fields:
typescriptexport const createTask = mutation({ args: { text: v.string(), userId: v.id("users"), priority: v.optional(v.union( v.literal("low"), v.literal("medium"), v.literal("high") )), }, returns: v.id("tasks"), handler: async (ctx, args) => { return await ctx.db.insert("tasks", { text: args.text, userId: args.userId, priority: args.priority ?? "medium", completed: false, }); }, });
Internal functions (from internal.*) can skip validators if they're only called by trusted backend code, but it's still recommended.
Enable the @convex-dev/require-argument-validators ESLint rule to enforce this automatically.
Other measured skills in the registry, with their headline benchmark lift.