Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Implement authentication checks in all public functions
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 7% | 0% |
| case-02 | ✗→✓ | ▲ Improved | -14% | 0% |
| case-18 | ✗→✓ | ▲ Improved | 48% | 0% |
| case-21 | ✓→✓ | = Same ✓ | -20% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 10% | 0% |
Every public function that accesses user data MUST verify authentication using ctx.auth.getUserIdentity().
typescriptexport const getMyTasks = query({ args: {}, handler: async (ctx) => { const identity = await ctx.auth.getUserIdentity(); if (!identity) { throw new Error("Not authenticated"); } const user = await getUserByIdentity(ctx, identity); return await ctx.db .query("tasks") .withIndex("by_user", q => q.eq("userId", user._id)) .collect(); }, });
typescriptexport const updateTask = mutation({ args: { taskId: v.id("tasks"), text: v.string() }, handler: async (ctx, args) => { const identity = await ctx.auth.getUserIdentity(); if (!identity) throw new Error("Not authenticated"); const task = await ctx.db.get(args.taskId); if (!task) throw new Error("Task not found"); const user = await getUserByIdentity(ctx, identity); if (task.userId !== user._id) { throw new Error("Unauthorized"); } await ctx.db.patch(args.taskId, { text: args.text }); }, });
Other measured skills in the registry, with their headline benchmark lift.