后端与数据库

convex-functions

waynesutton/bui…r-skills

Writes Convex queries, mutations, actions, and internal functions in the object form with args and returns validators, correct ctx usage, runtime boundaries, and error handling. Use when adding or changing anything in convex/*.ts that exports a function, or when deciding between query, mutation, and action.

  • 3101 次安装
  • 405 星标
  • 收录于

安装命令

npx skills add https://github.com/waynesutton/builder-skills --skill convex-functions

SKILL.md

Convex functions

Every exported function in convex/ uses the object form with args and returns validators. Pick the type by what the handler touches: queries read, mutations write, actions call out.

Pick the function type

Type Database External calls Callable by Use for
query Read No Clients, other functions Reads. Cached and reactive.
mutation Read and write No Clients, other functions Writes. One transaction.
action Only via runQuery and runMutation Yes Clients, scheduler, other actions fetch, third party SDKs, Node APIs
internalQuery, internalMutation, internalAction Same as the public form Same Only other Convex functions Scheduled work, crons, privileged writes
httpAction Only via runQuery and runMutation Yes HTTP requests in convex/http.ts Webhooks, REST endpoints

Default to query or mutation. Reach for an action only when the handler must talk to something outside Convex.

The object form

Declare args and returns on every function. A function that returns nothing declares returns: v.null() and returns null. Hoist a shared document validator when several functions return the same shape.