enforce-rules-format
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseValidate that every rule in the project's instruction files has a proper enforcement classification, and fix any that are missing.
验证项目说明文件中的每一条规则都具备正确的执行分类,并修复所有缺失分类的规则。
Instructions
操作步骤
Step 1: Detect Format
步骤1:检测格式
Check which format the project uses:
v2 (spec-based): Look for or any files. If found, this is a v2 project — rules must use , , or .
CLAUDE.md.spec.ts*.spec.tsenforce()check()guidance()v1 (hand-written): Look for , , . If found without a spec file, this is a v1 project — rules need or annotations.
CLAUDE.mdAGENTS.md.cursorrules**Enforced by:****Guidance only**检查项目使用的格式:
v2(基于规范): 查找或任意文件。如果找到,则为v2项目——规则必须使用、或。
CLAUDE.md.spec.ts*.spec.tsenforce()check()guidance()v1(手写): 查找、、。如果找到这些文件但没有规范文件,则为v1项目——规则需要添加或注释。
CLAUDE.mdAGENTS.md.cursorrules**Enforced by:****Guidance only**Step 2: Validate
步骤2:验证
For v2 specs:
The TypeScript type system already prevents unannotated rules — you can't create a rule without calling , , or . So focus on:
enforce()check()guidance()- Do rules reference real linter rules? Run
enforce()to check.npx vigiles compile - Are there guidance rules that COULD be ? Check linter configs for matching rules.
enforce() - Are there assertions that could be delegated to a linter? Suggest
check()instead.enforce()
bash
npx vigiles compile
npx vigiles discoverFor v1 hand-written files:
Scan for headings. Each must have one of:
###- linter/rule-name``
**Enforced by:** \ **Guidance only** — reason<!-- vigiles-disable -->
Report missing annotations with a summary table.
针对v2规范:
TypeScript类型系统已阻止未添加注释的规则——不调用、或就无法创建规则。因此重点关注:
enforce()check()guidance()- 规则是否引用了真实的代码检查器规则?运行
enforce()进行检查。npx vigiles compile - 是否存在可以改为的guidance规则?检查代码检查器配置中是否有匹配的规则。
enforce() - 是否存在可以委托给代码检查器的断言?建议改用
check()。enforce()
bash
npx vigiles compile
npx vigiles discover针对v1手写文件:
扫描标题。每个标题必须包含以下内容之一:
###- linter/rule-name``
**Enforced by:** \ **Guidance only** — reason<!-- vigiles-disable -->
通过汇总表格报告缺失的注释。
Step 3: Fix Issues
步骤3:修复问题
For each issue found:
- Check the project's linter configuration for matching rules
- Suggest (v2) or
enforce("linter/rule")linter/rule`` (v1)**Enforced by:** \ - If no linter rule exists, suggest (v2) or
guidance()(v1)**Guidance only** - Ask the user before making changes
针对每个发现的问题:
- 检查项目的代码检查器配置中是否有匹配的规则
- 建议使用(v2)或
enforce("linter/rule")linter/rule``(v1)**Enforced by:** \ - 如果没有对应的代码检查器规则,建议使用(v2)或
guidance()(v1)**Guidance only** - 修改前请询问用户
Step 4: Suggest Migration
步骤4:建议迁移
If the project uses v1 format, suggest migrating to v2 specs for type safety:
Your rules could benefit from type-safe specs. Run theskill to convert your CLAUDE.md to a typed .spec.ts file.adopt-spec
如果项目使用v1格式,建议迁移到v2规范以获得类型安全:
您的规则可以从类型安全规范中受益。运行技能将您的CLAUDE.md转换为带类型的.spec.ts文件。adopt-spec
Step 5: Verify
步骤5:验证
Run the appropriate command:
bash
undefined运行相应的命令:
bash
undefinedv2
v2
npx vigiles compile && npx vigiles check
npx vigiles compile && npx vigiles check
validate
验证
npx vigiles check
Report the validation result.npx vigiles check
报告验证结果。