← 返回 Skills 市场
dachunggan

Rule Toolkit

作者 Sexy Coder · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ⚠ suspicious
66
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install rule-toolkit
功能描述
Scan constraint files (CLAUDE.md, agents.md, soul.md, tools.md, bootstrap.md, .cursorrules) across AI coding platforms, identify rules enforceable by tools,...
使用说明 (SKILL.md)

Rule Toolkit

Convert hand-written constraint files into automated tooling. Rules in prompt files are forgotten when context grows long. Rules compiled into linters, hooks, and validators are enforced 100% of the time, at zero token cost.

Platform Detection

Detect which platform(s) are present, then scan the corresponding constraint files.

test -f CLAUDE.md && echo "CLAUDE_CODE"
test -f openclaw.json && echo "OPENCLAW"
test -f .cursorrules && echo "CURSOR"
test -f .github/copilot-instructions.md && echo "COPILOT"

Claude Code: CLAUDE.md (monolithic), .claude/commands/*.md OpenClaw: agents.md (priority 10), soul.md (20), identity.md (30), user.md (40), tools.md (50), bootstrap.md (60), memory.md (70). Skip SAFETY.md (hardcoded, read-only). Cursor: .cursorrules Copilot: .github/copilot-instructions.md Generic: AGENT.md, SOUL.md, README.md conventions sections

Read ALL found files. Extract every rule, convention, and constraint.

Rule Classification

Classify each extracted rule into one of two buckets.

Auto-Toolable

Category Example Rule Target Tool
code-style "2 spaces, no semicolons, single quotes" .prettierrc
naming "Files kebab-case, components PascalCase" ESLint custom rule
import "No default exports" / "Use @/ alias" ESLint no-restricted-paths
api-format "Responses use { code, data, msg }" Wrapper function + lint
type-safety "No any, no as" tsconfig strict
security "No innerHTML" / "Validate user input" ESLint + zod
testing "Every module needs a test file" Test existence checker
git "Conventional commits" / "Lint before commit" commitlint + husky
dependency "No new deps without approval" dependency-check script
performance "No lodash, use lodash-es" ESLint no-restricted-imports

Prompt-Only (cannot automate)

Category Example Rule Why
architecture "Use repository pattern" Semantic understanding needed
business-logic "Prices in cents, not dollars" Domain-specific
design "Composition over inheritance" Judgment call
communication "Explain in Chinese" Behavioral
workflow "Ask before deleting" Human-in-the-loop

Tech Stack Detection

Before generating tools, detect the project stack:

package.json → Node.js    | tsconfig.json → TypeScript
.eslintrc* → ESLint exists | .prettierrc* → Prettier exists
.husky/ → Husky exists     | pyproject.toml → Python
Cargo.toml → Rust          | go.mod → Go

Code Generation

For each auto-toolable rule, generate the appropriate tool. See references/tool-patterns.md for detailed generation patterns covering:

  • ESLint rules (no-restricted-syntax, custom naming rules, import restrictions)
  • Prettier config (.prettierrc)
  • TypeScript strict config (tsconfig.json)
  • Git hooks (husky + lint-staged + commitlint)
  • Wrapper functions (API response format)
  • Validation scripts (custom checkers)
  • Python tooling (ruff, mypy)
  • Rust tooling (clippy)

For OpenClaw-specific hooks, see references/openclaw-hooks.md.

Reporting

After generation, produce a report:

## Rule Toolkit Report

### Platform: Claude Code / OpenClaw / Cursor / Copilot

### Scanned Files
- CLAUDE.md (45 rules)
- soul.md (8 rules)

### Converted to Tools (38 rules)

| Rule | Source | Tool | Status |
|------|--------|------|--------|
| "Use 2-space indent" | CLAUDE.md | .prettierrc | Created |
| "No semicolons" | soul.md | .prettierrc | Created |
| "Conventional commits" | bootstrap.md | commitlint | Created |

### Remaining in Prompt (15 rules)

| Rule | Source | Reason |
|------|--------|--------|
| "Use repository pattern" | CLAUDE.md | Architectural judgment |
| "Ask before deleting" | tools.md | Human-in-the-loop |

### Summary
- N% rules automatically enforced
- M% remain in prompt
- Token savings: ~X tokens/conversation

Cleanup Constraint Files

Remove toolified rules from source files to save tokens.

Claude Code — replace removed rules in CLAUDE.md:

## Rules
Automated rules enforced by tooling. Run `npm run lint` to check.
See `.eslintrc.cjs`, `.prettierrc`, `scripts/check-rules.js`.

OpenClaw — replace removed rules in each file (e.g. tools.md):

## Tool Rules
Automated: linting (`npx eslint .`), type check (`npx tsc --noEmit`).
API format: use `ok()`/`fail()` from `src/utils/response.ts`.
Remaining rules below require human judgment.

Safety Rules

  • NEVER modify existing tool configs without showing a diff first
  • ALWAYS preserve existing rules, only add new ones
  • ALWAYS create wrapper functions in a new file
  • ALWAYS run generated configs to verify they parse correctly
  • If a rule is ambiguous, ASK the user before generating
  • OpenClaw SAFETY.md is hardcoded — skip it
  • Show the user what will change before writing files
安全使用建议
Install only if you want an agent to generate enforcement tooling for project rules. Before using it, require a reviewed diff for any edits to CLAUDE.md, agents.md, soul.md, tools.md, bootstrap.md, or similar policy files, and do not allow rule removal unless you have confirmed the generated tools fully preserve the intended behavior. Treat generated hooks as code that runs automatically: restrict file patterns, avoid broad write commands, and review every command before enabling it.
能力评估
Purpose & Capability
The stated purpose is to convert project prompt rules into linters, hooks, validators, and wrapper functions, and the requested Read/Write/Edit/Bash capabilities fit that purpose.
Instruction Scope
The cleanup section directs removal or replacement of rules in files such as CLAUDE.md and OpenClaw context files, while the safety section also says to preserve existing rules; this creates real ambiguity for governance files.
Install Mechanism
The package is a skill artifact with markdown guidance and one dry-run shell script; no dependency install, persistence mechanism, or hidden installer was found.
Credentials
Generating lint configs and hooks is proportionate, but server-side hooks that run commands like eslint --fix and prettier --write can mutate project files automatically and need clearer opt-in and scoping.
Persistence & Privilege
The skill does not install a daemon or background service, but generated hooks and edits to agent context files can persistently change future project behavior.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install rule-toolkit
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /rule-toolkit 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
Restructure repo to match mainstream skill layout
v1.0.0
rule-toolkit 1.0.0 – Initial Release - Scans CLAUDE.md, agents.md, soul.md, tools.md, bootstrap.md, .cursorrules, and related constraint files across multiple AI coding platforms. - Automatically identifies which rules are enforceable by tooling and generates suitable linters, git hooks, validators, and wrapper functions. - Supports Node.js/TypeScript (ESLint, Prettier, Husky, commitlint), Python (ruff), Rust (clippy), and Go (go vet) stacks. - Produces clear reports of converted (toolified) vs. prompt-only (non-automatable) rules. - Offers safe, guided updating of project files and recommends updates to constraint documents for better token efficiency.
元数据
Slug rule-toolkit
版本 1.0.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

Rule Toolkit 是什么?

Scan constraint files (CLAUDE.md, agents.md, soul.md, tools.md, bootstrap.md, .cursorrules) across AI coding platforms, identify rules enforceable by tools,... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 66 次。

如何安装 Rule Toolkit?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install rule-toolkit」即可一键安装,无需额外配置。

Rule Toolkit 是免费的吗?

是的,Rule Toolkit 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Rule Toolkit 支持哪些平台?

Rule Toolkit 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Rule Toolkit?

由 Sexy Coder(@dachunggan)开发并维护,当前版本 v1.0.1。

💬 留言讨论