agentleFS
frostneyfrostney/known-good-route/convex-conventions/SKILL.md

convex-conventions

Skill0 starsChanged 31 days agoUnlicenseView on GitHub

Applies the user's Convex backend conventions while deferring mechanics to upstream Convex skills and current APIs to the live Convex docs. Use when scaffolding, reviewing, or refactoring Convex functions, schemas, or auth.

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 6 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Verify each touched API against live Convex docs and the installed version.

    line 21
  2. Distinctive:

    Read release notes before a major or minor upgrade.

    line 22
  3. Very specific:

    Keep convex/ at root and never edit _generated/.

    line 27
  4. Distinctive:

    Keep one module each for reusable table validators, semantic validation, auth helpers, and rate-limit configuration.

    line 30
  5. Very specific:

    Add crons.ts and http.ts only when used.

    line 32
  6. Very specific:

    Every public function authenticates at the top and declares both args and returns validators.

    line 41
  7. Distinctive:

    Use internal functions for scheduling, sensitive side effects, and cross-function reuse that must not be public.

    line 43
  8. Distinctive:

    Keep structural validation in validators and semantic checks such as date correctness, length caps, and sanitization in the handler.

    line 45
  9. Distinctive:

    Prefer official Convex components for existing capabilities and verify each component README.

    line 79
  10. Very specific:

    No public function lacks auth, args, or returns.

    line 89

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Convex conventions

These are house-style defaults, not a Convex manual. Use current official Convex skills, when installed, for scaffolding, auth, migrations, performance work, components, and API mechanics; this skill adds project policy. Apply only what the requested change touches.

Authority

Verify each touched API against live Convex docs and the installed version. Read release notes before a major or minor upgrade. Live docs win over this skill; memory and prior turns do not establish current API behavior.

Layout and shared shapes

  • Keep convex/ at root and never edit _generated/.
  • schema.ts owns defineSchema and table declarations.
  • auth.config.ts owns the Clerk JWT provider.
  • Keep one module each for reusable table validators, semantic validation, auth helpers, and rate-limit configuration.
  • Add crons.ts and http.ts only when used.
  • Public feature surfaces and their tests are co-located.
  • Define table validators once and compose them into schema, args, and returns; do not redeclare an existing shape inline.

Auth and public functions

  • Clerk is the identity provider. Server code derives identity from ctx.auth.getUserIdentity() through one helper; clients never submit userId.
  • Every public function authenticates at the top and declares both args and returns validators.
  • Use internal functions for scheduling, sensitive side effects, and cross-function reuse that must not be public.
  • Keep structural validation in validators and semantic checks such as date correctness, length caps, and sanitization in the handler.

Reads, writes, and effects

  • Indexes narrow candidates; further filtering happens in code. Give indexes semantic names and avoid redundant ones.
  • Cap every otherwise unbounded query with .take(); comment only when the cap is load-bearing.
  • Queries are pure and deterministic: no Date.now() inside them.
  • Mutations write. Actions call external systems. An action persists through an internal mutation rather than mixing the roles.
  • Rate-limit every public mutation with the current @convex-dev/rate-limiter API. Token bucket suits high-frequency operations; fixed window suits low-frequency operations.

Stored data

  • User-created rows use soft deletion with optional numeric deletedAt; public mutations do not hard-delete them.
  • Audit trails are append-only records.
  • Server metadata such as identity and timestamps comes from handler context, never client args.
  • Data-at-rest schema changes use widen, migrate, then narrow through the official migration workflow.
  • Aggregate additions include a backfill. Aggregate synchronization failure must not block the primary write.

Client types and components

  • Derive client types from generated Doc<...> and Id<...>.
  • One dedicated module re-exports semantic client aliases; app code imports there, never directly from convex/_generated, and never manually copies table shapes.
  • Prefer official Convex components for existing capabilities and verify each component README. Use the official component workflow when authoring a new reusable component.

Completion

  • Codegen and typecheck pass.
  • Relevant function tests and the project gate pass.
  • Any schema migration ran against the development deployment and its result is recorded.
  • No public function lacks auth, args, or returns; no public mutation lacks rate limiting; no unbounded query lacks a cap.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.