スキル一覧に戻る
IgorWarzocha

convex-core

by IgorWarzocha

An ever evolving repository of Opencode workflow examples that might enhance your experience with it. I only left the stuff that actually works. YMMV.

51🍴 6📅 2026年1月22日
GitHubで見るManusで実行

SKILL.md


name: convex-core description: |- Build Convex schemas, queries, mutations, actions, and client usage with strict validators and indexes. Use for data modeling, function authoring, argument/return validation, and performance guidance. Use proactively when work touches convex/schema.ts, functions, or api.* references.

Examples:

  • user: "Design tables for multi-tenant app" → defineSchema/defineTable with indexes
  • user: "Write a mutation" → args/returns validators + auth checks
  • user: "Optimize query" → add index and withIndex range expression
  • user: "Use useQuery" → show generated hook usage

Schema Rules

  • You MUST define all tables in convex/schema.ts with defineSchema / defineTable.
  • System Fields: _id (v.id(tableName)) and _creationTime (v.number()) are added automatically.
  • You MUST use v.* validators for every field; SHOULD avoid v.any() unless necessary.
  • Index naming: include all fields in the name, e.g., "by_field1_and_field2".
  • Index rules:
    • You MUST use .index(name, [fields...]).
    • Field order matters; range expressions MUST follow index order.
    • Limits: 16 fields per index, 32 indexes per table.

Function Rules

  • You MUST use new function syntax with args, returns, and handler.
  • You MUST always validate args and returns (HTTP actions excluded).
  • Use query for reads, mutation for writes, and action for external/long-running.
  • Actions MUST NOT access ctx.db; You MUST use ctx.runQuery / ctx.runMutation.
  • Circular Dependencies: When calling a function in the same file via ctx.run*, You MUST add explicit return type annotations to the receiver variable.

Database Operations

  • You MUST provide the explicit table name as the first argument to ctx.db.get, ctx.db.patch, ctx.db.replace, and ctx.db.delete.
  • Replacement: Use ctx.db.replace for full document replacement (throws if missing).
  • Patching: Use ctx.db.patch for shallow merge updates (throws if missing).
  • Deletion: Convex queries do NOT support .delete(). You MUST .collect() results and iterate to call ctx.db.delete(id).
  • Unique: Use .unique() for single document results; it MUST throw if multiple documents match.
  • You MUST NOT use filter in production queries; use indexes and .withIndex.

TypeScript Best Practices

  • You MUST use as const for string literals in discriminated unions.
  • You MUST define arrays as const array: Array<T> = [...] and records as const record: Record<K, V> = {...}.
  • You MUST prefer Id<"table"> over string for all document identifiers.

Query Performance

  • You SHOULD prefer .withIndex over .filter on large tables.
  • If using .withIndex without a range, You MUST pair it with take, first, unique, or paginate.
  • Search limits: collect() throws if >1024 docs; You SHOULD use take(n), paginate(), or for await iteration for large sets.
  • Async iteration: Use for await (const row of query) instead of .collect() for streaming large result sets.

Pagination

  • You MUST use paginationOptsValidator in args.
  • .paginate() returns { page, isDone, continueCursor }.
  • Pages are reactive; size MAY change.
  • You SHOULD avoid strict returns validators for the full .paginate() result object; validate page or use v.any().

Client Patterns

  • You MUST use api.* references from convex/_generated/api.
  • React hooks: useQuery, useMutation, useAction, usePaginatedQuery.
  • You MUST NOT call mutations or actions during render.

Safety

  • You MUST enforce auth per function; check identity via ctx.auth helpers.
  • You MUST NOT expose sensitive logic in public functions; MUST use internal ones.

スコア

総合スコア

60/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です