AgentSkillsCN

rule-catalog

创建 hookify 规则——基于 Markdown 的行为规则,用于预防不当操作。 创建 hookify 规则、行为规则、预防行为、阻止命令 当您需要预防危险命令、阻止调试提交、强化规范约束时,可优先选用此技能。 切勿在以下情况下使用:钩子范围(抽象:钩子范围指南)、SDK 钩子(抽象:钩子创作)、评估钩子(抽象:钩子评估)

SKILL.md
--- frontmatter
name: rule-catalog
description: This skill provides the catalog and guides installation. Use when looking
  for ready-made hookify rules, installing standard rules, browsing available rule
  categories. Do not use when writing custom rules - use hookify:writing-rules instead.
version: 1.4.0
category: hook-development
tags:
- hookify
- rules
- catalog
- install
- templates
dependencies: []
estimated_tokens: 1500
complexity: beginner
provides:
  patterns:
  - rule-installation
  - rule-browsing
  infrastructure:
  - rule-catalog
usage_patterns:
- browsing-rules
- installing-rules

Table of Contents

Hookify Rule Catalog

Pre-built rules for common scenarios. Install directly or use as templates.

Quick Install

bash
# Install a specific rule
Skill(hookify:rule-catalog) then install git:block-force-push

# Or use the Python installer for bulk operations
python3 plugins/hookify/scripts/install_rule.py git:block-force-push
python3 plugins/hookify/scripts/install_rule.py --category git
python3 plugins/hookify/scripts/install_rule.py --all

Verification: Run python --version to verify Python environment.

Available Rules

git/ - Git Safety

RuleActionDefaultDescription
block-force-pushblockenabledPrevent force push to main/master
block-destructive-gitblockenabledBlock reset --hard, checkout -- ., clean -fd, etc.
warn-risky-gitwarnenabledWarn about rebase -i, soft reset, etc.
warn-large-commitswarnenabledWarn about large binary files

python/ - Python Quality

RuleActionDefaultDescription
block-dynamic-codeblockenabledBlock dangerous dynamic code execution
warn-print-statementswarnenabledEncourage logging over print()

security/ - Security Gates

RuleActionDefaultDescription
require-security-reviewblockenabledRequire review for auth code

workflow/ - Workflow Enforcement

RuleActionDefaultDescription
enforce-scope-guardwarnenabledAnti-overengineering (imbue)
require-spec-before-codeblockdisabledSpec-first development

performance/ - Resource Management

RuleActionDefaultDescription
warn-large-file-opswarnenabledWatch large file writes

Installation Instructions

Method 1: Claude-Assisted (Recommended)

When you invoke this skill, tell Claude which rule(s) to install:

code
**Verification:** Run `git status` to confirm working tree state.
Install git:block-force-push

Verification: Run the command with --help flag to verify availability.

Claude will:

  1. Read the rule from skills/rule-catalog/rules/git/block-force-push.md
  2. Write it to .claude/hookify.block-force-push.local.md
  3. Confirm installation

Method 2: Python Script

For bulk operations or automation:

bash
# Install single rule
python3 plugins/hookify/scripts/install_rule.py git:block-force-push

# Install all rules in category
python3 plugins/hookify/scripts/install_rule.py --category python

# Install all rules
python3 plugins/hookify/scripts/install_rule.py --all

# List available rules
python3 plugins/hookify/scripts/install_rule.py --list

# Install to custom directory
python3 plugins/hookify/scripts/install_rule.py git:block-force-push --target /path/to/.claude

Verification: Run the command with --help flag to verify availability.

Method 3: Manual Copy

  1. Find rule in plugins/hookify/skills/rule-catalog/rules/<category>/<rule>.md
  2. Copy to .claude/hookify.<rule-name>.local.md
  3. Edit enabled: true/false as needed

Rule File Locations

Rules are stored relative to this skill:

code
**Verification:** Run the command with `--help` flag to verify availability.
skills/rule-catalog/
├── SKILL.md (this file)
└── rules/
    ├── git/
    │   ├── block-force-push.md
    │   ├── block-destructive-git.md
    │   ├── warn-risky-git.md
    │   └── warn-large-commits.md
    ├── python/
    │   ├── block-dynamic-code.md
    │   └── warn-print-statements.md
    ├── security/
    │   └── require-security-review.md
    ├── workflow/
    │   ├── enforce-scope-guard.md
    │   └── require-spec-before-code.md
    └── performance/
        └── warn-large-file-ops.md

Verification: Run the command with --help flag to verify availability.

Customizing Rules

After installation, edit the rule in .claude/:

yaml
# Change action from warn to block
action: block

# Disable temporarily
enabled: false

# Modify pattern
pattern: your-custom-pattern

Verification: Run the command with --help flag to verify availability.

Creating Pull Requests for New Rules

To add rules to the catalog:

  1. Create rule file in appropriate category
  2. Follow naming convention: kebab-case.md
  3. Include detailed message with alternatives
  4. Test thoroughly before submitting
  5. Update this SKILL.md catalog table

Related

  • Skill(hookify:writing-rules) - Create custom rules
  • /hookify:list - Show installed rules
  • /hookify:configure - Manage installed rules

Troubleshooting

Common Issues

Command not found Ensure all dependencies are installed and in PATH

Permission errors Check file permissions and run with appropriate privileges

Unexpected behavior Enable verbose logging with --verbose flag