skills/vibe-rules/SKILL.md
Use when rules files change, when checking for duplicate or conflicting rules across ~/.claude/rules/common/, .claude/rules/, .agent/rules/, and CLAUDE.md, or when an agent has created new rules that may overlap with existing ones. Do not use for skill authoring or flow governance.
npx skillsauth add jacobcy/vibe-coding-control-center vibe-rulesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
维护 Claude Code rules 分层体系,检测重复和冲突,提供清理建议。
# Rules 分层体系(优先级从低到高)
tier_1_global:
path: ~/.claude/rules/common/
description: 全局规则(外部导入,如 ECC)
characteristics:
- 适用所有项目
- 项目中不应重复,除非项目规定不一致
priority: 基础层
tier_2_project:
path: .claude/rules/
description: 项目规则(可能由 agents 创建)
characteristics:
- 除非确有必要,否则应该清理
- 覆盖全局规则
priority: 中等
tier_3_claudemd:
path: CLAUDE.md
description: 项目最高标准
characteristics:
- 项目级硬规则和上下文
- 不应重复全局已规定的 rules
- 引用 .agent/rules/ 的权威来源
priority: 最高
tier_4_compressed:
path: .agent/rules/
description: 压缩规则(详细定义)
characteristics:
- 压缩 CLAUDE.md 不常驻的详细规则
- Agent 按需读取,通过引用
- 必须在 CLAUDE.md 中引用
priority: 详细定义层
/vibe-rules check
检查当前项目的 rules 冲突和重复。
/vibe-rules report
生成详细的 rules 分析报告,包括:
/vibe-rules clean [--dry-run]
自动清理重复和冲突的 rules。
--dry-run: 只显示将要执行的操作,不实际删除/vibe-rules fix
交互式修复配置冲突(如 pyproject.toml 与 rules 不一致)。
# 全局规则
ls ~/.claude/rules/common/*.md 2>/dev/null
# 项目规则
ls .claude/rules/*.md 2>/dev/null
# 项目压缩规则
ls .agent/rules/*.md 2>/dev/null
# CLAUDE.md 引用
grep -E '\.agent/rules/.*\.md|\.claude/rules/.*\.md' CLAUDE.md
检测同名文件:
comm -12 <(ls ~/.claude/rules/common/) <(ls .claude/rules/)
检测内容重复:
diff 对比同名文件grep 查找相似内容检查点:
验证方法:
# 对比 pyproject.toml 和 rules 中的配置
grep "line-length" pyproject.toml
grep "line-length" .agent/rules/python-standards.md
grep "mypy" pyproject.toml
grep "mypy" .agent/rules/python-standards.md
判断标准:
输出格式:
# Vibe Rules 分析报告
生成时间: {timestamp}
## 统计信息
| 层级 | 文件数 | 行数 | Token 估算 |
| -------- | ------ | ---- | ---------- |
| 全局规则 | {n} | {n} | {n} |
| 项目规则 | {n} | {n} | {n} |
| 压缩规则 | {n} | {n} | {n} |
| **总计** | {n} | {n} | {n} |
## 重复检测
### 1. 同名文件重复
| 文件名 | 全局 | 项目 | 建议 |
| --------------- | ---- | ---- | ---------------------- |
| coding-style.md | ✅ | ✅ | 删除项目规则,使用全局 |
### 2. 内容重复
| 项目文件 | 重复源 | 重复行数 | 建议 |
| ------------------------ | -------------------------------- | -------- | ------------------ |
| .claude/rules/testing.md | .agent/rules/python-standards.md | 39 行 | 删除,使用权威来源 |
## 配置冲突
### ⚠️ mypy 配置不一致
- `.agent/rules/python-standards.md`: `strict = true`
- `pyproject.toml`: 未设置 `strict`
- **建议**: 在 pyproject.toml 中添加 `strict = true`
## 清理建议
### 删除文件(节省 ~{n} tokens)
```bash
# 项目规则与全局重复
rm .claude/rules/coding-style.md
# 项目规则与压缩规则重复
rm .claude/rules/testing.md
rm .claude/rules/patterns.md
rm .claude/rules/hooks.md
```
# 更新 pyproject.toml
# 添加 strict = true 到 [tool.mypy]
清理后运行:
# 检查 mypy
uv run mypy src/vibe3
# 检查 black
uv run black --check src/
# 检查 ruff
uv run ruff check src/
## 清理策略
### 策略 A:完全删除重复(推荐)
**适用场景**:权威来源明确定义
**操作**:
1. 删除 `.claude/rules/` 中与 `.agent/rules/` 重复的文件
2. 删除 `.claude/rules/` 中与全局完全相同的文件
3. 保留项目特定的扩展(如 security.md)
**优点**:
- 单一事实来源
- 无维护负担
- 节省 token
### 策略 B:精简为引用(备选)
**适用场景**:需要快速提醒
**操作**:
```markdown
---
paths: ["**/*.py"]
---
# Python 编码提醒
详见权威标准:[.agent/rules/python-standards.md](../../.agent/rules/python-standards.md)
## 快速检查清单
- Python >= 3.10
- 类型注解必须完整
优点:
适用场景:项目有特殊要求
操作:
示例:
---
paths: ["**/*.py"]
---
# Python 项目特定要求
> 扩展 [.agent/rules/python-standards.md](../../.agent/rules/python-standards.md)
## 本项目特有
- 使用 direnv(不使用 dotenv)
- 使用 loguru(不使用 print)
- pre-commit 配置见 .pre-commit-config.yaml
保持分层清晰
单一事实来源
定期清理
/vibe-rules check配置一致性
不要重复
不要孤立规则
不要忽略冲突
不要过度维护
# .pre-commit-config.yaml
- repo: local
hooks:
- id: vibe-rules-check
name: Vibe Rules Check
entry: /vibe-rules check
language: system
pass_filenames: false
files: \.claude/rules/|\.agent/rules/|CLAUDE\.md$
# .github/workflows/rules-check.yml
name: Rules Consistency Check
on: [push, pull_request]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check rules consistency
run: |
# 检查同名文件
if comm -12 <(ls ~/.claude/rules/common/) <(ls .claude/rules/); then
echo "❌ Found duplicate rules files"
exit 1
fi
# 检查 CLAUDE.md 引用
if ! grep -q "\.agent/rules/python-standards\.md" CLAUDE.md; then
echo "❌ Missing reference to .agent/rules/python-standards.md"
exit 1
fi
# 使用 crontab 或 GitHub Actions schedule
# 每周一提醒检查 rules
/vibe-rules check --report > .agent/reports/rules-report.md
答:评估必要性:
答:项目规则优先级更高:
答:判断标准:
答:
.agent/rules/: 权威定义,详细标准,按需读取.claude/rules/: 快速提醒,项目特定扩展,常驻上下文理想情况:.claude/rules/ 只保留项目特定扩展,其他引用 .agent/rules/
development
Use after `vibe init` to verify project configuration completeness. Interactively prompts user to fill missing items. Orchestrates existing commands without adding Python code. Do not use for system-level installation issues (use vibe-onboard instead).
development
Use when the user wants a comprehensive review using the multi-agent team workflow. Applies to PRs, code changes, architecture decisions, and any task requiring team-based analysis.
development
Use when manager has signaled flow terminal state cleanup via handoff indicate. Reads cleanup instructions and executes FlowCleanupService. Do not use for code changes or PR creation.
testing
Use for handling blocked and RFC issues, making decisions that may form ADRs (Architecture Decision Records). Processes problem issues requiring human judgment, dependency resolution, and architectural decisions. Do not use for routine issue monitoring (use vibe-orchestra) or roadmap planning (use vibe-roadmap).