Install any skill in seconds. Free to start, no credit card required.
Get Started Free →`x rule` 是 x-cmd 的质量治理框架。通过 YAML 规则集对代码和智能体输出进行质量检查、评分、修复和迭代。
.claude/skills/x-cmd-rule-rules-to-rule/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 33% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 198% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 865% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 57% | 0% |
| case-07 | ✗→✓ | ▲ Improved | -22% | 0% |
> 用规则统领代码与智能体输出质量
x rule 是 x-cmd 的质量治理框架。通过 YAML 规则集对代码和智能体输出进行质量检查、评分、修复和迭代。
| 命令 | 作用 | 场景 | |------|------|------| | x rule lint <file> | jq 静态验证 rule.yml 格式 | 提交前自检 | | x rule scan <target> | 贪心快筛,1-5 条最严重问题 | agent 内循环迭代 | | x rule check <target> | 全局合规检查,输出所有违规 | 修复前确认 | | x rule audit <target> | 逐条评分(0-100),出详细报告 | 最终验证 | | x rule fix <target> | 自主修复循环 | 自动合规化 | | x rule refine <report> | 根据报告精调规则 | 规则优化 | | x rule evolve <target> | 根据代码适配规则集 | 规则扩展 |
规则文件以 .rule.yml 结尾,每条规则包含:
yamlrule-id: name: rule-name # 可选,简短标签 apply: "shell files" # 可选,适用文件类型 level: error # error/must/warn/info/debug desc: # 必填,规则描述(列表) - 描述文字 tldr: # 可选,正确/错误示例 - wrong: 错误代码 right: 正确代码 memo: # 可选,补充说明 - 备注
bash# 验证规则文件格式 x rule lint lib/po6/local.rule.yml # 快筛代码问题 x rule scan src/ # 全量检查 x rule check -r lib/po6 src/ # 审计并出报告 x rule audit -o /tmp/report lib/ # 自主修复 x rule fix src/
x rule ls — 列出规则集x rule which — 显示规则集路径x rule preset ls — 列出预设规则集rule/
├── lib/
│ ├── *.rule.yml # 规则文件(*.rule.yml 结尾)
│ ├── jq/lint.jq # jq 静态验证过滤器
│ ├── scan|check|audit|fix|refine|evolve|lint # 子命令
│ └── preset-data/ # 内置预设规则集
└── adv/index.yml # 命令行补全配置/Users/l/.x-cmd.root/v/.repo/x-bash/rule/SKILL.md.x-cmd/story/ 目录下| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 6,728 | 5,758 | -14% | 1 | 1 | 0% | 978 | 1,304 | +33% | 0 | 0 | — |
case-02 | fail→pass | 4,103 | 4,049 | -1% | 1 | 1 | 0% | 400 | 1,192 | +198% | 0 | 0 | — |
case-03 | fail→pass | 4,739 | 7,640 | +61% | 1 | 1 | 0% | 193 | 1,862 | +865% | 0 | 0 | — |
case-04 | fail→pass | 6,207 | 4,115 | -34% | 1 | 1 | 0% | 809 | 1,274 | +57% | 0 | 0 | — |
case-05 | pass→pass | 22,043 | 4,985 | -77% | 1 | 1 | 0% | 927 | 1,438 | +55% | 0 | 0 | — |
case-06 | pass→fail | 7,582 | 7,580 | -0% | 1 | 1 | 0% | 1,232 | 1,754 | +42% | 0 | 0 | — |
case-07 | fail→pass | 11,045 | 4,196 | -62% | 1 | 1 | 0% | 1,654 | 1,298 | -22% | 0 | 0 | — |
case-08 | fail→pass | 16,413 | 2,680 | -84% | 1 | 1 | 0% | 2,669 | 1,048 | -61% | 0 | 0 | — |
case-09 | fail→pass | 42,279 | 2,530 | -94% | 1 | 1 | 0% | 8,082 | 1,037 | -87% | 0 | 0 | — |
case-10 | fail→pass | 21,200 | 3,763 | -82% | 1 | 1 | 0% | 3,498 | 1,066 | -70% | 0 | 0 | — |
case-11 | fail→pass | 24,351 | 3,137 | -87% | 1 | 1 | 0% | 4,006 | 1,061 | -74% | 0 | 0 | — |
case-12 | pass→pass | 15,193 | 3,209 | -79% | 1 | 1 | 0% | 2,255 | 1,078 | -52% | 0 | 0 | — |
case-13 | fail→pass | 7,259 | 2,705 | -63% | 1 | 1 | 0% | 1,061 | 1,014 | -4% | 0 | 0 | — |
case-14 | fail→pass | 18,709 | 14,821 | -21% | 1 | 1 | 0% | 3,071 | 1,084 | -65% | 0 | 0 | — |
case-15 | fail→pass | 9,693 | 2,608 | -73% | 1 | 1 | 0% | 1,558 | 945 | -39% | 0 | 0 | — |
case-16 | fail→pass | 29,201 | 3,743 | -87% | 1 | 1 | 0% | 5,453 | 1,090 | -80% | 0 | 0 | — |
case-17 | fail→pass | 12,384 | 2,955 | -76% | 1 | 1 | 0% | 1,880 | 1,010 | -46% | 0 | 0 | — |
case-18 | fail→pass | 13,650 | 3,567 | -74% | 1 | 1 | 0% | 1,846 | 1,055 | -43% | 0 | 0 | — |
case-19 | fail→pass | 59,460 | 2,762 | -95% | 1 | 1 | 0% | 3,070 | 1,081 | -65% | 0 | 0 | — |
case-20 | fail→pass | 18,213 | 4,280 | -77% | 1 | 1 | 0% | 3,215 | 1,122 | -65% | 0 | 0 | — |
case-21 | pass→pass | 12,058 | 2,288 | -81% | 1 | 1 | 0% | 1,923 | 945 | -51% | 0 | 0 | — |
case-22 | pass→pass | 14,355 | 2,334 | -84% | 1 | 1 | 0% | 1,977 | 904 | -54% | 0 | 0 | — |
case-23 | pass→pass | 11,293 | 4,195 | -63% | 1 | 1 | 0% | 1,764 | 1,216 | -31% | 0 | 0 | — |
case-24 | pass→pass | 10,363 | 3,252 | -69% | 1 | 1 | 0% | 1,458 | 1,059 | -27% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 24 cases were attempted, and 22 counted toward the lift figure. The other 2 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +67 percentage points is the difference between those two pass rates over the 22 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.