convex-suggest

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<!-- GENERATED from convex-agents content/capabilities/suggest.json — do not edit by hand. -->
<!-- 由 convex-agents content/capabilities/suggest.json 生成——请勿手动编辑。 -->

Proactively suggest the right Convex component

主动建议合适的 Convex 组件

When you see code or intent that duplicates what a Convex component already does, surface a targeted suggestion: ONE component, WHY (anchored in the user's own code or ask), and a concrete install hint. Never install without explicit consent. Never suggest more than one component at a time unless the user asks.
当你发现代码或意图重复实现了 Convex 组件已有的功能时,应提供有针对性的建议:一个组件、基于用户自身代码或需求的原因(WHY),以及具体的安装提示。未经明确同意,绝不安装。除非用户提出要求,否则绝不同时建议多个组件。

Workflow

工作流

  1. Observe the codeSnippets and userAsk passively — never block the current task to suggest.
  2. Match against the detector rules (see generators/suggest-detector.mjs): email/SMTP → resend; push notifications → expo-push; setInterval/cron → @convex-dev/crons; shared counter increments → @convex-dev/sharded-counter; .collect().length scans → @convex-dev/aggregate; multi-step/long-running actions → @convex-dev/workflow; bounded concurrency → @convex-dev/workpool; rate-limit counters in DB → @convex-dev/rate-limiter; fs.write/S3 uploads → Convex Storage; Elasticsearch/Algolia → built-in full-text search; presence/typing → @convex-dev/presence; Pinecone/external vector DB → @convex-dev/rag; collaborative editing → @convex-dev/prosemirror-sync.
  3. After finishing the current task, offer ONE suggestion: name the component, quote the specific code or phrase that triggered it, explain why the component fits better.
  4. If the user says yes: run
    /add <component>
    or follow the installHint from the detector.
  5. If the user says no or ignores it: drop it. Do not repeat the same suggestion.
  1. 被动观察 codeSnippets 和 userAsk——绝不能为了给出建议而中断当前任务。
  2. 根据检测器规则进行匹配(参见 generators/suggest-detector.mjs):email/SMTP → resend;推送通知 → expo-push;setInterval/cron → @convex-dev/crons;共享计数器递增 → @convex-dev/sharded-counter;
    .collect().length
    扫描 → @convex-dev/aggregate;多步骤或长时间运行的操作 → @convex-dev/workflow;有界并发 → @convex-dev/workpool;数据库中的限流计数器 → @convex-dev/rate-limiter;fs.write/S3 上传 → Convex Storage;Elasticsearch/Algolia → 内置全文搜索;presence/typing → @convex-dev/presence;Pinecone/外部向量数据库 → @convex-dev/rag;协作文档编辑 → @convex-dev/prosemirror-sync。
  3. 完成当前任务后,提供一个建议:指出组件名称,引用触发建议的具体代码或表述,并解释该组件为何更加合适。
  4. 如果用户回答“是”:运行
    /add <component>
    ,或按照检测器中的 installHint 执行。
  5. 如果用户回答“否”或忽略建议:放弃建议。不要重复相同的建议。

Rules

规则

  • Passive — never interrupt the current task; surface the suggestion AFTER completing what the user asked.
  • One at a time — pick the highest-priority match; do not dump a list of five components.
  • Cite WHY from the user's own code or ask — 'I noticed you wrote
    post.likes + 1
    in a mutation that many users call concurrently; that causes OCC conflicts at scale.'
  • Never install without explicit consent — suggest, explain, wait for a yes.
  • Do not suggest a component the user has already installed.
  • Do not fire on generic coding questions unrelated to Convex (sorting arrays, writing CSS, etc.).
  • 被动运行——绝不打断当前任务;完成用户请求后再提出建议。
  • 每次一个——选择优先级最高的匹配项;不要一次列出五个组件。
  • 引用用户自身代码或需求中的原因(WHY)——“我注意到你在一个会被许多用户并发调用的 mutation 中写了
    post.likes + 1
    ;在规模化运行时,这会导致 OCC 冲突。”
  • 未经明确同意绝不安装——先建议、解释并等待用户确认。
  • 不要建议用户已经安装的组件。
  • 不要对与 Convex 无关的通用编程问题触发建议,例如数组排序或编写 CSS。