amirrudd avatar

convex-utility

Skill for standardizing and accelerating Convex backend development with boilerplate generation and

提供方 amirrudd|开源

Convex Utility Skill

This skill enforces FlyerBoard's backend patterns for Convex mutations and queries.

Core Patterns

1. Authentication Check

All mutations must verify the user's identity.

const userId = await getDescopeUserId(ctx);
if (!userId) throw new Error("Must be logged in");

2. Soft Delete Filter

All queries fetching "active" flyers must filter out deleted records.

.filter(q => q.neq(q.field("isDeleted"), true))

3. Ownership Verification

Modifying a resource requires checking the userId.

const resource = await ctx.db.get(args.id);
if (resource.userId !== userId) throw new Error("Unauthorized");

Scripts

generate-mutation (via prompt instructions)

When asked to create a new Convex mutation, follow the template in examples/mutation-template.ts.

Examples

standard-mutation.ts

See examples/standard-mutation.ts for a complete implementation of a compliant mutation.

Quality Standards

  • No hard deletes.
  • Always use v.id("tableName") for ID arguments.
  • Return meaningful errors (e.g., "Not found", "Unauthorized").
convex-utility - 适用于 Claude Code 与 Cursor 的 AI 智能体 Skill | Agent Skills