amariahak/atlarix-skills/acr-convex-cursorrules-prompt-file

Claude Code and agent skill by amariahak/atlarix-skills

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Install

npx vskill@latest install amariahak/atlarix-skills/acr-convex-cursorrules-prompt-file

SKILL.md

The same SKILL.md was published earlier as amariahak/atlarix-skills/acr-convex-cursorrules-prompt-file.

Cursor rules for Convex development with best practices

When to use this skill

Cursor rules for Convex development with best practices.

Source

Synced from https://github.com/PatrickJS/awesome-cursorrules/tree/main/rules/convex-cursorrules-prompt-file.mdc.

Convex guidelines

Function guidelines

New function syntax
  • ALWAYS use the new function syntax for Convex functions. For example:

``typescript import { query } from "./_generated/server"; import { v } from "convex/values"; export const f = query({ args: {}, returns: v.null(), handler: async (ctx, args) => { // Function body }, }); ``

Http endpoint syntax
  • HTTP endpoints are defined in convex/http.ts and require an httpAction decorator. For example:

``typescript import { httpRouter } from "convex/server"; import { httpAction } from "./_generated/server"; const http = httpRouter(); http.route({ path: "/echo", method: "POST", handler: httpAction(async (ctx, req) => { const body = await req.bytes(); return new Response(body, { status: 200 }); }), }); ``

  • HTTP endpoints are always registered at the exact path you specify in the path field. For example, if you specify /api/someRoute, the endpoint will be registered at /api/someRoute.
Validators
  • Below is an example of an array validator:

```typescript import { mutation } from "./_generated/server"; import { v } from "convex/values";

export default mutation({ args: { simpleArray: v.array(v.union(v.string(), v.number())), }, handler: async (ctx, args) => { //... }, }); ```

  • Below is an example of a schema with validators that codify a discriminated union type:

```typescript import { defineSchema, defineTable } from "convex/server"; import { v } from "convex/values";

export default defineSchema({ results: defineTable( v.union( v.object({ kind: v.literal("error"), errorMessage: v.string(), }), v.object({ kind: v.literal("success"), value: v.number(), }), ), ) }); ```

  • Always use the v.null() validator when returning a null value. Below is an example query that returns a null value:

```typescript import { query } from "./_generated/server"; import { v } from "convex/values";

export const exampleQuery = query({ args: {}, returns: v.null(), handler: async (ctx, args) => { console.log("This query returns a null value"); return null; }, }); ```

  • Here are the valid Convex types along with their respective validators:

Convex Type | TS/JS type | Example Usage | Validator for argument validation and schemas | Notes |

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Idstringdoc._idv.id(tableName)
Nullnullnullv.null()JavaScript's undefined is not a valid Convex value. Functions the return undefined or do not return will return null when called from a client. Use null instead.
Int64bigint3nv.int64()Int64s only support BigInts between -2^63 and 2^63-1. Convex supports bigints in most modern browsers.
Float64number3.1v.number()Convex supports all IEEE-754 double-precision floating point numbers (such as NaNs). Inf and NaN are JSON serialized as strings.
Booleanbooleantruev.boolean()
Stringstring"abc"v.string()Strings are stored as UTF-8 and must be valid Unicode sequences. Strings must be smaller than the 1MB total size limit when encoded as UTF-8.
BytesArrayBuffernew ArrayBuffer(8)v.bytes()Convex supports first class bytestrings, passed in as ArrayBuffers. Bytestrings must be smaller than the 1MB total size limit for Convex types.
ArrayArray][1, 3.2, "abc"]v.array(values)Arrays can have at most 8192 values.
ObjectObject{a: "abc"}v.object({property: value})Convex only supports "plain old JavaScript objects" (objects that do not have a custom prototype). Objects can have at most 1024 entries. Field names must be nonempty and not start with "$" or "_".
RecordRecord{"a": "1", "b": "2"}v.record(keys, values)Records are objects at runtime, but can have dynamic keys. Keys must be only ASCII characters, nonempty, and not start with "$" or "_".
Function registration
  • Use internalQuery, internalMutation, and internalAction to register internal functions. These functions are private and aren't part of an app's API. They can only be called by other Convex functions. These functions are always imported from ./_generated/server.
  • Use query, mutation, and action to register public functions. These functions are part of the public API and are exposed to the public Internet. Do NOT use query, mutation, or action to register sensitive internal functions that should be kept private.
  • You CANNOT register a function through the api or internal objects.
  • ALWAYS include argument and return validators for all Convex functions. This includes all of query, internalQuery, mutation, internalMutation, action, and internalAction. If a function doesn't return anything, include returns: v.null() as its output validator.
  • If the JavaScript implementation of a Convex function doesn't have a return value, it implicitly returns null.
Function calling
  • Use ctx.runQuery to call a query from a query, mutation, or action.
  • Use ctx.runMutation to call a mutation from a mutation or action.
  • Use ctx.runAction to call an action from an action.
  • ONLY call an action from another action if you need to cross runtimes (e.g. from V8 to Node). Otherwise, pull out the shared code into a helper async function and call that directly instead.
  • Try to use as few calls from actions to queries and mutations as possible. Queries and mutations are transactions, so splitting logic up into multiple calls introduces the risk of race conditions.
  • All of these calls take in a FunctionReference. Do NOT try to pass the callee function directly into one of these calls.
  • When using ctx.runQuery, ctx.runMutation, or ctx.runAction to call a function in the same file, specify a type annotation on the return value to work around TypeScript circularity limitations. For example,

``` export const f = query({ args: { name: v.string() }, returns: v.string(), handler: async (ctx, args) => { return "Hello " + args.name; }, });

export const g = query({ args: {}, returns: v.null(), handler: async (ctx, args) => { const result: string = await ctx.runQuery(api.example.f, { name: "Bob" }); return null; }, }); ```

Function references
  • Function references are pointers to registered Convex functions.
  • Use the api object defined by the framework in convex/_generated/api.ts to call public functions registered with query, mutation, or action.
  • Use the internal object defined by the framework in convex/_generated/api.ts to call internal (or private) functions registered with internalQuery, internalMutation, or internalAction.
  • Convex uses file-based routing, so a public function defined in convex/example.ts named f has a function reference of api.example.f.
  • A private function defined in convex/example.ts named g has a function reference of internal.example.g.
  • Functions can also registered within directories nested within the convex/ folder. For example, a public function h defined in convex/messages/access.ts has a function reference of api.messages.access.h.
Api design
  • Convex uses file-based routing, so thoughtfully organize files with public query, mutation, or action functions within the convex/ directory.
  • Use query, mutation, and action to define public functions.
  • Use internalQuery, internalMutation, and internalAction to define private, internal functions.
Pagination
  • Paginated queries are queries that return a list of results in incremental pages.
  • You can define pagination using the following syntax:

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
2
7-day trend score
10

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/amariahak/atlarix-skills/acr-convex-cursorrules-prompt-file/badge)](https://verified-skill.com/skills/amariahak/atlarix-skills/acr-convex-cursorrules-prompt-file)

Something wrong with this skill or its page? Tell us.