用途:该技能用于创建或修复 .claude/rules/ 目录下的规则文件,把项目约定按文件范围模块化管理。规则与 CLAUDE.md 同级自动加载,可用于组织项目专属规范,或把 Cursor 规则迁移为 Claude 格式。
主要能力与写法:按路径生效的规则在 frontmatter 中使用 paths 字段,支持列表或单一模式,例如 paths 列出 "src/api//*.ts" 与 "tests//.test.ts",或写成 paths: src/**/.{ts,tsx}。全局规则直接省略 frontmatter,适用于所有文件。目录支持递归发现与子目录组织,如 .claude/rules/ 下放 testing.md、typescript.md 及 frontend/react.md。常见 glob 模式包括 /*.ts、src//、.md、/*.{ts,tsx}、{src,lib}//*.ts 等。
限制与常见错误:Claude 使用 paths,Cursor 使用 globs,不要混用;alwaysApply 属于 Cursor 专用字段,全局规则应通过省略 paths 实现;glob 模式需要加引号。description 字段未在 Claude 中记录。参考文档见 https://code.claude.com/docs/en/memory#modular-rules-with-claude/rules/。