rule-opensource

A set of Cursor rules describing development constraints and configuration standards, including model settings, environment variables, network fallback, and workflow requirements.

In plain words
What is it for?
Use it to guide model configuration, secret handling, network retries, streaming responses, requirements documents, and approval steps.
Why use it?
It gives an AI coding assistant consistent instructions for handling configuration, planning, approvals, and changes.

Cursor rule

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/itshen/xs_vibe_rules/rule-opensource
Clone the repo
git clone --depth 1 https://github.com/itshen/xs_vibe_rules
Per session 7,204 This file is loaded in full into every session.
When invoked 7,204 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.07204 $0.07204
Opus 5 $0.03602 $0.03602
Sonnet 5 $0.01441 $0.01441
Haiku 4.5 $0.00720 $0.00720

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

Security

Grade A, and why

rule-opensource 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.

rule-opensource.mdc · 623 lines

How it starts

The opening of the file, as written. The whole thing — 623 lines — stays where its author put it; the contents beside it link to each section on GitHub.

开发约束与配置规范

以下是用户重要的约束,请务必严格遵循。

一、模型配置

API Key、调用示例和凭据配置见 secrets.mdc(不上传 git)。 所有 Key 通过环境变量注入,参见项目根目录 .env.example 获取变量名清单。

1.1 默认对话模型

  • 模型:qwen3.6-plus
  • API 服务商:阿里云百炼(DashScope)
  • 环境变量:DASHSCOPE_API_KEY
  • 配置要求:必须关闭 Reasoning 功能(参数 enable_thinking: false

1.2 图像生成模型

  • 主选:gemini-3.1-flash-image-preview(Google AI),环境变量 GOOGLE_API_KEY
  • 备选:任意 OpenAI 兼容的图像生成网关(如 GPT Image 2),环境变量 GATEWAY_API_KEY
  • ⚠️ 超时:图像生成耗时较长,HTTP 客户端须设置 至少 120–180 秒 超时

1.3 Embedding 模型

  • 模型:google/gemini-embedding-001

1.4 网络搜索

  • 按需选择搜索 API 服务商(如 Tavily、SerpAPI 等)
  • 环境变量:按服务商配置
  • 触发条件: 需要了解最新资讯、查找外部文档、核实实时信息时,AI 应主动调用搜索接口

1.5 网络不通时的代理回退(强制要求)

  • ⚠️ 当网络请求失败时,必须尝试挂代理重试
  • 代理地址通过环境变量或本地配置(默认 127.0.0.1:7890
  • 代理重试仍失败后,再向用户报告网络问题,不可跳过代理直接报错

1.6 大模型服务规范

  • 前端可见的所有大模型响应必须使用流式返回(Streaming)
  • 后端内部调用可以使用非流式

【极其重要】二、需求处理与开发流程

2.1 首次需求处理流程(必须严格遵守)

  1. 主动思考并提问

    • 收到新需求后,先进行思考分析
    • 针对不明确的部分向你提问
  2. 复述需求

    • 用自己的理解复述完整需求
    • 确保理解一致
  3. 编写 XX PRD.md

    • 将需求整理成 PRD 文档
    • 包含完整的流程图(使用 Mermaid)
  4. 等待许可

    • 必须得到你的明确许可后才能开始编码
  5. 开始开发

2.2 需求变更流程

  • 所有后续改动必须先更新对应的 PRD.md
  • 更新 PRD 后再进行编码
  • 保持文档与代码同步

2.3 批量修改确认机制(强制要求)

  • ⚠️ 修改超过 3 个文件时,必须先列出修改计划并等待用户确认后再动手
  • 修改计划需包含:要改哪些文件、每个文件改什么、改动之间的依赖关系
  • 防止连续改一串文件后发现思路有误,回滚成本过高

2.4 新增功能前的重复检测(强制要求)

  • ⚠️ 新增功能前,必须先搜索项目中是否已有类似实现
  • 搜索范围:相关目录的函数名、类名、工具方法
  • 禁止在不知情的情况下重复造轮子
  • ✅ 找到已有实现时,优先复用或扩展,而非重写

三、PlayGround 组件页规范

3.1 组件 PlayGround 要求

何时需要创建 PlayGround:

  • 涉及页面动效时,必须先创建静态页面 PlayGround
  • 用于自由调整和测试组件

PlayGround 必须包含:

  • 基础组件页
  • 每个 UI 元素的独立 demo
  • 便于单独调试和调整样式

3.2 PlayGround 维护规则

  • 需求变化后必须同步更新 PlayGround
  • demo 组件只增改,不删除
  • ⚠️ 即使某个功能的需求取消了,对应的 demo 也要保留

3.3 AI 对话 PlayGround 特殊要求

如果项目涉及 AI 对话功能:

  • PlayGround 中必须实现简单的对话测试页面
  • 必须列出所有用到的提示词(Prompts)
  • 方便调试和调整提示词

四、文档与设计规范

4.1 PRD 文档要求

  • 所有流程图必须使用 Mermaid 语法表示
  • 确保流程图清晰、逻辑完整
  • PRD 文件名:PRD.md

4.2 UI/UX 设计规范

严格禁止的设计:

  • ❌ 不允许在色块左侧添加竖线颜色的设计
  • ❌ 不允许使用 emoji 作为按钮图标

Read the full file on GitHub · 623 lines

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 · 623 lines · 7,204 tokens per session scan A 9da05e6b2c61

Subscribe to this mod's changes

rule-opensource is a cursor rule published in the GitHub repository itshen/xs_vibe_rules (42 stars, last pushed 2mo ago), licensed MIT. It adds 7,204 tokens to every session, about $0.0360 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-30.