best-practice

A set of working rules for handling complex or uncertain tasks in ordered steps. It also describes using current official documentation when code depends on a specific library or version.

In plain words
What is it for?
Use it for open-ended analysis, changing requirements, multi-step coding tasks, and questions about version-specific APIs or frameworks.
Why use it?
It gives the agent a way to split difficult work into smaller decisions, compare alternatives, and revise earlier steps. Current documentation helps avoid relying on outdated programming examples.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/kelisiwu123/cursor-rules-wizard/best-practice
Clone the repo
git clone --depth 1 https://github.com/kelisiWu123/cursor-rules-wizard

Made for: Cursor.

Per session 823 This file is loaded in full into every session.
When invoked 823 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00823 $0.00823
Opus 5 $0.00411 $0.00411
Sonnet 5 $0.00165 $0.00165
Haiku 4.5 $0.00082 $0.00082

Measured 2d ago against content hash cfb75b304dcf, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

best-practice scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/best-practice.mdc · 69 lines

What it actually says

最佳实践

Sequential Thinking (逐步思考工具)

使用 @Sequential Thinking 工具,以结构化的思维方式处理复杂、开放性问题。

  • 将任务拆解为若干 思维步骤 (thought steps)

  • 每一步应包括:

    1. 明确当前目标或假设 (如: “分析登录方案”, “优化状态管理结构”)。
    2. 调用合适的 MCP 工具 (如 search_docscode_generatorerror_explainer),用于执行文档检索、生成代码或解释错误等操作。Sequential Thinking 本身不产出代码,而是协调过程。
    3. 清晰记录本步骤的结果与输出
    4. 确定下一步目标或是否分支,并继续流程。
  • 在面对不确定或模糊任务时:

    • 使用“分支思考”探索多种方案。
    • 比较不同路径的优劣,必要时回滚或修改已完成的步骤。
  • 每个步骤可带有如下结构化元数据:

    • thought:当前思考内容
    • thoughtNumber:当前步骤编号
    • totalThoughts:预估总步骤数
    • nextThoughtNeededneedsMoreThoughts:是否需要继续思考
    • isRevisionrevisesThought:是否为修订行为,及其修订对象
    • branchFromThoughtbranchId:分支起点编号及标识
  • 推荐在以下场景使用:

    • 问题范围模糊或随需求变化
    • 需要不断迭代、修订、探索多解
    • 跨步骤上下文保持一致性为重要
    • 需要过滤不相关或干扰性信息

Context7 (最新文档集成工具)

使用 @Context7 工具获取特定版本的最新官方文档与代码示例,用于提升生成代码的准确性与当前性。

  • 目的:解决模型知识过时问题,避免生成已废弃或错误的 API 用法。

  • 使用方式

    1. 调用方式:在提示词中加入 use context7 触发文档检索。
    2. 获取文档:Context7 会拉取当前使用框架/库的相关文档片段。
    3. 集成内容:将获取的示例与说明合理集成到你的代码生成或分析中。
  • 按需使用仅在需要时调用 Context7,例如遇到 API 模糊、版本差异大或用户请求查阅官方用法。避免不必要的调用,以节省 token 并提高响应效率。

  • 集成方式

    • 支持 Cursor、Claude Desktop、Windsurf 等 MCP 客户端。
    • 通过配置服务端集成 Context7,即可在上下文中获取最新参考资料。
  • 优势

    • 提升代码准确性,减少因知识过时造成的幻觉与报错。
    • 避免依赖训练时已过期的框架信息。
    • 提供明确、权威的技术参考材料。

沟通规范

  • 所有内容必须使用 中文 交流 (包括代码注释)。
  • 遇到不清楚的内容应立即向用户提问。
  • 表达清晰、简洁、技术准确。
  • 在代码中应添加必要的注释解释关键逻辑。
  • 无论何时你想提问,总是调用 MCP interactive_feedback
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 69 lines · 823 tokens per session scan A cfb75b304dcf

Subscribe to this mod's changes

best-practice is a cursor rule published in the GitHub repository kelisiWu123/cursor-rules-wizard (7 stars, last pushed 1y ago), licensed MIT. It adds 823 tokens to every session, about $0.0041 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.