Setup
On first use, read setup.md for integration guidelines.
When to Use
User is building, debugging, or scaling a Convex backend and needs reliable patterns for data modeling, queries, mutations, actions, auth, and deployments.
This skill focuses on implementation quality and operational safety, not generic framework tutorials.
Architecture
Memory lives in ~/convex/. See memory-template.md for structure and status fields.
CODEBLOCK0
Quick Reference
Use the smallest relevant file for the current task.
| Topic | File |
|---|
| Setup flow | INLINECODE3 |
| Memory template |
memory-template.md |
| Schema and indexes |
schema-and-indexes.md |
| Deploy and operations |
operations-playbook.md |
Requirements
- - No API keys or external credentials are required by this skill itself.
- TOKEN/KEY: Not required by this skill.
- If a project uses third-party integrations, treat those credentials as user-managed secrets and never persist raw values in memory files.
Data Storage
This skill stores reusable context only under ~/convex/:
- - memory file for durable project context and decisions
- schema notes for modeling and index rationale
- rollout notes for deployment and incident lessons
- auth notes for permission and boundary edge cases
Do not store secrets, access tokens, or personal data unless the user explicitly requests it.
Core Rules
1. Model Access Patterns Before Writing Schema
Define tables and indexes from real read paths first:
- - Which fields are filtered most often
- Which sort order is needed
- Which uniqueness guarantees are required
Do not rely on table scans in production paths.
2. Keep Function Boundaries Strict
Use each function type for its intended purpose:
- - Query: read-only and deterministic
- Mutation: validated state changes
- Action: external side effects and network calls
Do not mix external calls inside deterministic data paths.
3. Enforce Auth and Authorization at Every Entry Point
Treat every query, mutation, action, and HTTP entrypoint as untrusted input:
- - Resolve identity explicitly
- Check workspace or tenant boundaries
- Validate ownership before returning or mutating records
Never trust client-provided identifiers without server checks.
4. Design Indexes for Stability, Not Just Speed
Create indexes that match long-term product workflows:
- - Primary user lookup paths
- Admin and backoffice paths
- Background processing queues
Document index intent so future changes do not break critical queries.
5. Make Writes Idempotent for Retries
For webhooks and external callbacks:
- - Use stable idempotency keys
- Upsert safely when replayed
- Record processing status
A retry should not create duplicate side effects.
6. Ship with Safe Rollout Discipline
Before deploying schema or logic changes:
- - Verify backward compatibility for current clients
- Prepare migration steps for renamed fields or tables
- Confirm failure mode and rollback path
Never deploy unreviewed breaking data changes.
7. Preserve Debuggability in Production
When fixing incidents:
- - Capture a minimal reproduction query
- Keep structured logs around actor, function, and record ids
- Record final root cause and preventive rule in memory
Fast diagnosis compounds over time.
Common Traps
- - Building schema from entities only, not query paths -> slow reads and rework.
- Putting network side effects in deterministic logic -> nondeterministic failures.
- Treating auth as a UI concern -> cross-tenant data leaks.
- Adding indexes reactively during outages -> unstable rollout under pressure.
- Shipping breaking schema changes without migration staging -> runtime failures.
- Ignoring idempotency for callbacks -> duplicate writes and billing errors.
Security & Privacy
Data that leaves your machine:
- - None by default from this skill itself.
Data that stays local:
- - Convex project context and decisions under
~/convex/.
This skill does NOT:
- - Automatically call external services.
- Manage or store secrets outside user-approved files.
- Apply destructive schema changes without explicit confirmation.
- Modify files outside
~/convex/ for memory.
Related Skills
Install with
clawhub install <slug> if user confirms:
- -
backend - Service architecture and operational reliability patterns. - INLINECODE12 - Type-safe design and implementation for app and backend code.
- INLINECODE13 - Runtime behavior and language-level debugging workflows.
Feedback
- - If useful: INLINECODE14
- Stay updated: INLINECODE15
设置
首次使用时,请阅读 setup.md 了解集成指南。
使用时机
当用户正在构建、调试或扩展 Convex 后端,并需要数据建模、查询、变更、操作、身份验证和部署方面的可靠模式时使用。
本技能侧重于实现质量和操作安全性,而非通用框架教程。
架构
记忆文件存储在 ~/convex/ 目录下。有关结构和状态字段,请参阅 memory-template.md。
text
~/convex/
|- memory.md # 持久化项目上下文和技术决策
|- schema-notes.md # 表设计和索引原理
|- rollout-notes.md # 部署和事件经验
- - auth-notes.md # 身份验证模型和权限边界情况
快速参考
针对当前任务,使用最小相关文件。
memory-template.md |
| 模式和索引 | schema-and-indexes.md |
| 部署和运维 | operations-playbook.md |
要求
- - 本技能本身不需要任何 API 密钥或外部凭据。
- TOKEN/KEY:本技能不需要。
- 如果项目使用第三方集成,请将这些凭据视为用户管理的机密,切勿将原始值持久化存储在记忆文件中。
数据存储
本技能仅将可复用上下文存储在 ~/convex/ 目录下:
- - 用于持久化项目上下文和决策的记忆文件
- 用于建模和索引原理的模式说明
- 用于部署和事件教训的发布说明
- 用于权限和边界情况的身份验证说明
除非用户明确要求,否则不要存储机密、访问令牌或个人数据。
核心规则
1. 在编写模式之前先建模访问模式
首先根据实际读取路径定义表和索引:
- - 哪些字段最常被过滤
- 需要哪种排序顺序
- 需要哪些唯一性保证
不要在生产路径中依赖全表扫描。
2. 保持函数边界严格
每种函数类型用于其预期目的:
- - 查询:只读且确定性
- 变更:经过验证的状态更改
- 操作:外部副作用和网络调用
不要在确定性数据路径中混合外部调用。
3. 在每个入口点强制执行身份验证和授权
将每个查询、变更、操作和 HTTP 入口点视为不可信输入:
- - 显式解析身份
- 检查工作区或租户边界
- 在返回或修改记录前验证所有权
切勿信任未经服务器检查的客户端提供的标识符。
4. 为稳定性设计索引,而不仅仅是速度
创建与长期产品工作流匹配的索引:
记录索引意图,以便未来的更改不会破坏关键查询。
5. 使写入操作具有幂等性以支持重试
对于 Webhook 和外部回调:
- - 使用稳定的幂等键
- 在重放时安全地执行 upsert
- 记录处理状态
重试不应产生重复的副作用。
6. 以安全发布纪律进行交付
在部署模式或逻辑更改之前:
- - 验证当前客户端的向后兼容性
- 为重命名字段或表准备迁移步骤
- 确认故障模式和回滚路径
切勿部署未经审查的破坏性数据更改。
7. 在生产环境中保持可调试性
在修复事件时:
- - 捕获最小复现查询
- 围绕参与者、函数和记录 ID 保留结构化日志
- 在记忆中记录最终根本原因和预防规则
快速诊断能力会随时间累积。
常见陷阱
- - 仅从实体而非查询路径构建模式 -> 读取缓慢且需要返工。
- 在确定性逻辑中放置网络副作用 -> 非确定性故障。
- 将身份验证视为 UI 关注点 -> 跨租户数据泄露。
- 在中断期间被动添加索引 -> 压力下的不稳定发布。
- 未经迁移阶段即发布破坏性模式更改 -> 运行时故障。
- 忽略回调的幂等性 -> 重复写入和计费错误。
安全与隐私
离开您机器的数据:
保留在本地数据:
- - ~/convex/ 下的 Convex 项目上下文和决策。
本技能不会:
- - 自动调用外部服务。
- 管理或存储用户批准文件之外的机密。
- 未经明确确认应用破坏性模式更改。
- 修改 ~/convex/ 之外的记忆文件。
相关技能
如果用户确认,使用 clawhub install
安装:
- - backend - 服务架构和运维可靠性模式。
- typescript - 应用和后端代码的类型安全设计与实现。
- javascript - 运行时行为和语言级调试工作流。
反馈
- - 如果觉得有用:clawhub star convex
- 保持更新:clawhub sync