Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Keep query/mutation/action wrappers thin, put logic in TypeScript functions
.claude/skills/kunanonj-cursor-plugin-convex-rule-function-organization/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -25% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 112% | 0% |
| case-14 | ✗→✓ | ▲ Improved | -7% | 0% |
| case-15 | ✗→✓ | ▲ Improved | 50% | 0% |
| case-16 | ✗→✓ | ▲ Improved | -12% | 0% |
Most business logic should live in plain TypeScript functions. Keep query, mutation, and action wrappers thin—they should primarily handle arguments and call shared logic.
Bad:
typescriptexport const createPost = mutation({ args: { title: v.string(), content: v.string() }, handler: 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"); // ... 50 more lines of logic ... }, });
Good:
typescript// convex/lib/auth.ts export async function getCurrentUser(ctx: QueryCtx | MutationCtx) { 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"); return user; } // convex/posts.ts export const createPost = mutation({ args: { title: v.string(), content: v.string() }, handler: async (ctx, args) => { const user = await getCurrentUser(ctx); return await createPostInternal(ctx, user._id, args); }, }); async function createPostInternal( ctx: MutationCtx, userId: Id<"users">, args: { title: string; content: string } ) { // ... logic here ... return await ctx.db.insert("posts", { userId, title: args.title, content: args.content, createdAt: Date.now(), }); }
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 11,412 | 6,481 | -43% | 1 | 1 | 0% | 2,574 | 1,924 | -25% | 0 | 0 | — |
case-02 | pass→pass | 11,096 | 7,132 | -36% | 1 | 1 | 0% | 2,604 | 2,217 | -15% | 0 | 0 | — |
case-03 | pass→pass | 13,414 | 10,367 | -23% | 1 | 1 | 0% | 2,853 | 2,932 | +3% | 0 | 0 | — |
case-04 | pass→pass | 9,955 | 6,536 | -34% | 1 | 1 | 0% | 2,256 | 1,924 | -15% | 0 | 0 | — |
case-05 | pass→pass | 11,378 | 8,945 | -21% | 1 | 1 | 0% | 2,596 | 2,744 | +6% | 0 | 0 | — |
case-06 | fail→pass | 4,002 | 5,855 | +46% | 1 | 1 | 0% | 910 | 1,927 | +112% | 0 | 0 | — |
case-07 | pass→pass | 12,913 | 8,352 | -35% | 1 | 1 | 0% | 2,887 | 2,717 | -6% | 0 | 0 | — |
case-08 | pass→pass | 11,607 | 10,031 | -14% | 1 | 1 | 0% | 2,630 | 2,825 | +7% | 0 | 0 | — |
case-09 | pass→pass | 11,916 | 7,967 | -33% | 1 | 1 | 0% | 2,586 | 2,687 | +4% | 0 | 0 | — |
case-10 | pass→pass | 12,722 | 9,462 | -26% | 1 | 1 | 0% | 2,529 | 2,559 | +1% | 0 | 0 | — |
case-11 | pass→pass | 11,137 | 7,845 | -30% | 1 | 1 | 0% | 2,439 | 2,168 | -11% | 0 | 0 | — |
case-12 | pass→pass | 9,465 | 8,970 | -5% | 1 | 1 | 0% | 2,431 | 2,717 | +12% | 0 | 0 | — |
case-13 | pass→pass | 13,235 | 8,221 | -38% | 1 | 1 | 0% | 3,252 | 2,577 | -21% | 0 | 0 | — |
case-14 | fail→pass | 11,567 | 7,088 | -39% | 1 | 1 | 0% | 2,495 | 2,313 | -7% | 0 | 0 | — |
case-15 | fail→pass | 8,692 | 9,252 | +6% | 1 | 1 | 0% | 2,095 | 3,134 | +50% | 0 | 0 | — |
case-16 | fail→pass | 13,100 | 8,254 | -37% | 1 | 1 | 0% | 2,771 | 2,438 | -12% | 0 | 0 | — |
case-17 | pass→pass | 9,448 | 10,026 | +6% | 1 | 1 | 0% | 2,254 | 2,841 | +26% | 0 | 0 | — |
case-18 | pass→pass | 12,504 | 7,493 | -40% | 1 | 1 | 0% | 2,923 | 2,353 | -20% | 0 | 0 | — |
case-19 | pass→pass | 13,661 | 9,605 | -30% | 1 | 1 | 0% | 3,026 | 2,800 | -7% | 0 | 0 | — |
case-20 | pass→pass | 6,959 | 4,966 | -29% | 1 | 1 | 0% | 1,648 | 1,529 | -7% | 0 | 0 | — |
case-21 | pass→pass | 8,486 | 4,579 | -46% | 1 | 1 | 0% | 1,744 | 1,515 | -13% | 0 | 0 | — |
case-22 | pass→pass | 6,989 | 4,233 | -39% | 1 | 1 | 0% | 1,614 | 1,500 | -7% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +23 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.