.clinerules/Cline Rules (.clinerules/):存放位置及工具读取方式
Cline Rules 是 .clinerules/ 中的 Markdown 文件,Cline 会将其与全局规则和 AGENTS.md 合并。可选的 paths frontmatter 可将规则限制为匹配的文件。
存放位置
- 工作区:.clinerules/*.md 或 .cline/rules/*.md;两处都会搜索。
- 全局:Windows 上的 Documents\Cline\Rules,macOS 和 Linux 上的 ~/Documents/Cline/Rules,以及 ~/.cline/rules 和 ~/Cline/Rules。
- 自动检测跨工具文件:AGENTS.md、~/.agents/AGENTS.md、.cursorrules 和 .windsurfrules。
格式
Markdown 文件,可选择使用 01-coding.md 这样的编号文件名,也可选择添加 YAML frontmatter。paths 数组中的 glob 模式用于匹配上下文中的文件;任一模式匹配时,规则即生效。没有 frontmatter 表示规则始终生效,paths: [] 表示规则永不生效;YAML 无效时按开放策略处理。
---
paths:
- "src/components/**"
- "src/hooks/**"
---
# Components and hooks
- Function components only.
- Hook names start with use and the files live in src/hooks/.
- Split any component that grows past 200 lines.
- Add a test next to each new hook.
优先级与合并
工作区规则和全局规则会合并;发生冲突时,以工作区规则为准。每条规则都可以单独启用或停用。
提示
- 上下文中的文件包括提及的路径、已打开或可见的标签页、已编辑的文件和待处理的编辑。
- YAML 无效时按开放策略处理,因此 paths 中的拼写错误会导致规则始终生效;编辑后请检查。
- 可在 VS Code 的 Rules 面板中创建规则,也可以使用 /newrule 斜杠命令。
通过一个表单,为五种工具生成 AGENTS.md 和对应的规则文件。 打开 AGENTS.md 生成器 →
其他指令文件
AGENTS.mdCLAUDE.mdGEMINI.md.cursor/rules/*.mdc.github/copilot-instructions.md.devin/rules/*.md~/.openclaw/workspace/AGENTS.md