writing-hookify-rules
यह क्या करती है
यह आपके एजेंट को hookify नियम लिखने के सिंटैक्स और पैटर्न देती है। ये छोटी फ़ाइलें कुछ खास कामों पर चेतावनी देती हैं या उन्हें रोकती हैं। यह उन डेवलपर्स के लिए है जो Claude Code में सुरक्षा के नियम चाहते हैं।
कब इस्तेमाल करें
- ✓जब आपको ऐसा नियम चाहिए जो किसी खास कमांड या बदलाव पर चेतावनी दे।
- ✓जब आपको ऐसा नियम चाहिए जो किसी जोखिम भरे काम को चलने से रोके।
- ✓जब किसी मौजूदा hookify नियम फ़ाइल को ठीक करना या समझना हो।
Skill का लिंक
https://github.com/anthropics/claude-plugins-official/blob/main/plugins/hookify/skills/writing-rules/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“क्या आप ऐसा hookify नियम लिख सकते हैं जो rm से फ़ाइलें मिटाने वाले किसी भी कमांड से पहले मुझे चेतावनी दे?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट एक नियम फ़ाइल लिखता है, जिसमें नाम, चालू या बंद करने की सेटिंग, वह इवेंट जिस पर नज़र रखनी है, और मिलान का पैटर्न होता है। आपकी ज़रूरत के हिसाब से वह कार्रवाई चेतावनी या रोक सेट करता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Writing Hookify Rules
Overview
Hookify rules are markdown files with YAML frontmatter that define patterns to watch for and messages to show when those patterns match. Rules are stored in .claude/hookify.{rule-name}.local.md files.
Rule File Format
Basic Structure
---
name: rule-identifier
enabled: true
event: bash|file|stop|prompt|all
pattern: regex-pattern-here
---
Message to show Claude when this rule triggers.
Can include markdown formatting, warnings, suggestions, etc.
Frontmatter Fields
name (required): Unique identifier for the rule
- Use kebab-case:
warn-dangerous-rm,block-console-log - Be descriptive and action-oriented
- Start with verb: warn, prevent, block, require, check
enabled (required): Boolean to activate/deactivate
true: Rule is activefalse: Rule is disabled (won't trigger)- Can toggle without deleting rule
event (required): Which hook event to trigger on
bash: Bash tool commandsfile: Edit, Write, MultiEdit toolsstop: When agent wants to stopprompt: When user submits a promptall: All events
action (optional): What to do when rule matches
warn: Show message but allow operation (default)block: Prevent operation (PreToolUse) or stop session (Stop events)- If omitted, defaults to
warn
pattern (simple format): Regex pattern to match
- Used for simple single-condition rules
- Matches against command (bash) or new_text (file)
- Python regex syntax
Example:
event: bash
pattern: rm\s+-rf
Advanced Format (Multiple Conditions)
For complex rules with multiple conditions:
---
name: warn-env-file-edits
enabled: true
event: file
conditions:
- field: file_path
operator: regex_match
pattern: \.env$
- field: new_text
operator: contains
pattern: API_KEY
---
You're adding an API key to a .env file. Ensure this file is in .gitignore!
Condition fields:
field: Which field to check- For bash:
command - For file:
file_path,new_text,old_text,content
- For bash:
operator: How to matchregex_match: Regex pattern matchingcontains: Substring checkequals: Exact matchnot_contains: Substring must NOT be presentstarts_with: Prefix checkends_with: Suffix check
pattern: Pattern or string to match
All conditions must match for rule to trigger.
Message Body
The markdown content after frontmatter is shown to Claude when the rule triggers.
Good messages:
- Explain what was detected
- Explain why it's problematic
- Suggest alternatives or best practices
- Use formatting for clarity (bold, lists, etc.)
Example:
⚠️ **Console.log detected!**
You're adding console.log to production code.
**Why this matters:**
- Debug logs shouldn't ship to production
- Console.log can expose sensitive data
- Impacts browser performance
**Alternatives:**
- Use a proper logging library
- Remove before committing
- Use conditional debug builds
Event Type Guide
bash Events
Match Bash command patterns:
---
event: bash
pattern: sudo\s+|rm\s+-rf|chmod\s+777
---
Dangerous command detected!
Common patterns:
- Dangerous commands:
rm\s+-rf,dd\s+if=,mkfs - Privilege escalation:
sudo\s+,su\s+ - Permission issues:
chmod\s+777,chown\s+root
file Events
Match Edit/Write/MultiEdit operations:
---
event: file
pattern: console\.log\(|eval\(|innerHTML\s*=
---
Potentially problematic code pattern detected!
Match on different fields:
---
event: file
conditions:
- field: file_path
operator: regex_match
pattern: \.tsx?$
- field: new_text
operator: regex_match
pattern: console\.log\(
---
Console.log in TypeScript file!
Common patterns:
- Debug code:
console\.log\(,debugger,print\( - Security risks:
eval\(,innerHTML\s*=,dangerouslySetInnerHTML - Sensitive files:
\.env$,credentials,\.pem$ - Generated files:
node_modules/,dist/,build/
stop Events
Match when agent wants to stop (completion checks):
---
event: stop
pattern: .*
---
Before stopping, verify:
- [ ] Tests were run
- [ ] Build succeeded
- [ ] Documentation updated
Use for:
- Reminders about required steps
- Completion checklists
- Process enforcement
prompt Events
Match user prompt content (advanced):
---
event: prompt
conditions:
- field: user_prompt
अक्सर पूछे जाने वाले सवाल
नियम कहाँ सेव होते हैं?
स्किल के अनुसार वे प्रोजेक्ट के .claude फ़ोल्डर में लोकल markdown फ़ाइलों के रूप में रहते हैं।
कौन-से इवेंट पर नियम नज़र रख सकता है?
स्किल में bash कमांड, फ़ाइल बदलाव, stop इवेंट, उपयोगकर्ता के प्रॉम्प्ट और सभी इवेंट शामिल हैं।
क्या मैं नियम हटाए बिना उसे बंद कर सकता हूँ?
हाँ। हर नियम में एक enabled सेटिंग होती है, जिसे बंद किया जा सकता है।
जानकारी
लेखक का मूल विवरण
This skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
लोकप्रियता
- GitHub स्टार
- 46k
- रैंकिंग में स्थान
- #6336
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
access
46kयह Discord चैनल पर कौन आपके सहायक को मैसेज कर सकता है, यह मैनेज करने में मदद करती है, जिसमें पेयरिंग और अनुमति सूची शामिल हैं।
configure
46kबॉट टोकन सेव करके और देखकर कि कौन पहुँच सकता है, आपके सहायक के लिए Discord चैनल सेट करती है।
access
46kयह iMessage चैनल पर कौन आपके सहायक को मैसेज कर सकता है, इसे मैनेज करने में मदद करती है, जिसमें मंज़ूरी और अनुमति सूची शामिल है।
configure
46kFull Disk Access सहित आपके iMessage चैनल का सेटअप जाँचती है, और बताती है कि आपके सहायक तक कौन पहुँच सकता है।
मिलती-जुलती skills
diffs
394kयह आपके एजेंट को बदलावों का असली diff बनाने देती है, जिसे व्यूअर लिंक या इमेज फ़ाइल के रूप में साझा किया जा सकता है, हाथ से लिखे सारांश के बजाय।
coding-agent
394kयह आपके एजेंट को बड़े कोडिंग काम Codex, Claude Code या OpenCode को बैकग्राउंड वर्कर के रूप में सौंपने, फिर उसकी प्रगति जांचने में मदद करती है।
gh-issues
394kयह आपके एजेंट को GitHub issues खोजने, उनमें से काम करने लायक चुनने, और सुधार के साथ pull requests खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।