convex-expert
它能做什么
这个技能是针对 convex 文件夹中代码的 Convex 专家。适合希望后端代码遵循平台规则、避免常见错误的开发者。
适用场景
- ✓当你在 Convex 项目中编写或修改函数、schema 或索引时。
- ✓当你为 Convex 应用添加 HTTP 端点、定时任务或文件存储时。
- ✓当你需要基于 Convex 构建 AI 聊天或多步骤工作流时。
技能链接
https://github.com/openclaw/clawhub/blob/main/.agents/skills/convex-expert/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请添加一张任务表,并编写一个函数,在我的 Convex 应用中列出每个用户的任务。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会先读取现有的 schema,以要求的格式编写函数,并对输入和输出进行检查,使用索引进行查找,并确认代码部署时没有错误。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Convex backend specialist
Always-on Convex backend specialist invoked before touching any code inside a convex/ directory. Knows the object-form function syntax, validator requirements, index naming rules, internal-vs-public discipline, schema evolution patterns, resource limits, component ecosystem, and runtime error decoder that generic models routinely get wrong.
Workflow
- When about to write or edit any file under convex/: read convex/schema.ts first (and convex/_generated/ai/guidelines.md if present).
- Write all Convex functions in object form with both args and returns validators on every registered function.
- Use withIndex(...) for every read path — never .filter() for anything that would be a SQL WHERE clause.
- Default to internalQuery/internalMutation/internalAction; promote to public only when a client hook needs it.
- For any LLM/chat feature reach for @convex-dev/agent; for multi-step flows use @convex-dev/workflow — never hand-roll these.
- After writing, confirm convex dev pushed cleanly and fix any Schema/Returns/Argument validation errors in place.
Rules
- DATA ACCESS + IMPORTS — read before writing any convex/*.ts (front-loaded, not a post-hoc lint):
- Never an unbounded
.collect()on a table that can grow — use.withIndex(...)and.paginate(paginationOptsValidator)/.take(n)instead. This is the single most common Convex deploy-blocking and perf defect. - Index, don't filter — add
.index(...)in schema.ts for every read path and query it with.withIndex(...);.filter()is a full table scan, never a substitute for a WHERE. - The exact import table — get this wrong and the app fails to deploy:
query/mutation/action/internalQuery/internalMutation/internalActioncome from"./_generated/server";api/internalcome from"./_generated/api"; NEVERimport { query } from "convex/server"orimport { internal } from "./_generated/server"in application code — both are hard deploy failures. v.literal("exact value")for a fixed string/enum member (e.g.v.union(v.literal("open"), v.literal("closed"))) — not a barev.string()when the set of values is fixed."use node";goes only at the top of action-only modules — a file with"use node"can never also export aqueryormutation(they don't run in the Node runtime); split the file if you need both.- Object form only — never the legacy positional query(args, handler) syntax.
- args and returns validators on every registered function, no exceptions.
- v.id(tableName) for IDs, never v.string(); undefined is not a Convex value (use null).
- Never add a required field to a populated table — add v.optional(...) first, backfill, then tighten.
- Never include _creationTime as a column in a custom index (reserved; causes IndexNameReserved error).
- Never store storage URLs in tables — store the Id<'_storage'> and call ctx.storage.getUrl(id) on read.
- Mutations cannot fetch — all external IO goes in actions; persist via ctx.runMutation(internal.x.y).
- Don't add a parallel database, cache, real-time service, API server, job queue, or object store — Convex is the backend.
- Convex functions only run from the
convex/directory — never write schema.ts/queries/mutations/actions at the project root. - SELF-VERIFY RULE — before declaring backend work done, verify it compiles and pushes: run
npx tsc --noEmitand push it to a deployment. Prefer the project's existing one; otherwisenpx convex dev --oncewhennpx convex whoamisucceeds, andCONVEX_AGENT_MODE=anonymous npx convex dev --onceONLY when it does not. Forcing anonymous on a signed-in user rebinds.env.localand costs them the persistent, publishable cloud deployment they expect. Fix every error it reports before finishing — one verify round catches the wrong-relative-import / duplicate-symbol / unbalanced-paren class that otherwise breaks the deploy.
常见问题
为什么技能要先读取 schema?
这样新代码才能与项目中已有的数据相匹配。
它遵循哪些规则?
读取使用索引,除非客户端需要,否则函数保持为内部函数,并且要求进行输入和输出检查。
项目需要先设置好吗?
需要。它处理的是 Convex 项目中的代码,因此项目应当已经存在。
详情
作者的原始描述
Convex backend specialist. Use this agent for any code inside a `convex/` directory — function definitions, schemas, indexes, queries, mutations, actions, HTTP endpoints, cron jobs, file storage, auth wiring, and component installation. Knows the object-form function syntax, validator patterns, resource limits, and component ecosystem that generic Claude routinely gets wrong.
repo: openclaw/clawhub
热度
- GitHub 星标
- 9.5k
- 排名
- #12244
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
axiom-alerting
9.5k帮你的智能体通过 Axiom API 创建和管理监控器与通知路由,并检查告警是否按预期运行。
axiom-sre
9.5k帮你的智能体逐步调查生产事故和缺陷,在得出结论之前,用 Axiom 日志验证每一个猜测。
building-dashboards
9.5k帮你的智能体从仪表盘必须支持的决策出发,设计配有合适图表、查询和筛选器的 Axiom 仪表盘。
controlling-costs
9.5k帮你的智能体在 Axiom 中找出未被使用的数据,并构建用于追踪和削减日志成本的仪表盘与监控器。