surshar / claude-code
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.
Built by Anthropic · github.com/anthropics
| 1 | --- |
| 2 | description: Enable or disable hookify rules interactively |
| 3 | allowed-tools: ["Glob", "Read", "Edit", "AskUserQuestion", "Skill"] |
| 4 | --- |
| 5 | |
| 6 | # Configure Hookify Rules |
| 7 | |
| 8 | **Load hookify:writing-rules skill first** to understand rule format. |
| 9 | |
| 10 | Enable or disable existing hookify rules using an interactive interface. |
| 11 | |
| 12 | ## Steps |
| 13 | |
| 14 | ### 1. Find Existing Rules |
| 15 | |
| 16 | Use Glob tool to find all hookify rule files: |
| 17 | ``` |
| 18 | pattern: ".claude/hookify.*.local.md" |
| 19 | ``` |
| 20 | |
| 21 | If no rules found, inform user: |
| 22 | ``` |
| 23 | No hookify rules configured yet. Use `/hookify` to create your first rule. |
| 24 | ``` |
| 25 | |
| 26 | ### 2. Read Current State |
| 27 | |
| 28 | For each rule file: |
| 29 | - Read the file |
| 30 | - Extract `name` and `enabled` fields from frontmatter |
| 31 | - Build list of rules with current state |
| 32 | |
| 33 | ### 3. Ask User Which Rules to Toggle |
| 34 | |
| 35 | Use AskUserQuestion to let user select rules: |
| 36 | |
| 37 | ```json |
| 38 | { |
| 39 | "questions": [ |
| 40 | { |
| 41 | "question": "Which rules would you like to enable or disable?", |
| 42 | "header": "Configure", |
| 43 | "multiSelect": true, |
| 44 | "options": [ |
| 45 | { |
| 46 | "label": "warn-dangerous-rm (currently enabled)", |
| 47 | "description": "Warns about rm -rf commands" |
| 48 | }, |
| 49 | { |
| 50 | "label": "warn-console-log (currently disabled)", |
| 51 | "description": "Warns about console.log in code" |
| 52 | }, |
| 53 | { |
| 54 | "label": "require-tests (currently enabled)", |
| 55 | "description": "Requires tests before stopping" |
| 56 | } |
| 57 | ] |
| 58 | } |
| 59 | ] |
| 60 | } |
| 61 | ``` |
| 62 | |
| 63 | **Option format:** |
| 64 | - Label: `{rule-name} (currently {enabled|disabled})` |
| 65 | - Description: Brief description from rule's message or pattern |
| 66 | |
| 67 | ### 4. Parse User Selection |
| 68 | |
| 69 | For each selected rule: |
| 70 | - Determine current state from label (enabled/disabled) |
| 71 | - Toggle state: enabled → disabled, disabled → enabled |
| 72 | |
| 73 | ### 5. Update Rule Files |
| 74 | |
| 75 | For each rule to toggle: |
| 76 | - Use Read tool to read current content |
| 77 | - Use Edit tool to change `enabled: true` to `enabled: false` (or vice versa) |
| 78 | - Handle both with and without quotes |
| 79 | |
| 80 | **Edit pattern for enabling:** |
| 81 | ``` |
| 82 | old_string: "enabled: false" |
| 83 | new_string: "enabled: true" |
| 84 | ``` |
| 85 | |
| 86 | **Edit pattern for disabling:** |
| 87 | ``` |
| 88 | old_string: "enabled: true" |
| 89 | new_string: "enabled: false" |
| 90 | ``` |
| 91 | |
| 92 | ### 6. Confirm Changes |
| 93 | |
| 94 | Show user what was changed: |
| 95 | |
| 96 | ``` |
| 97 | ## Hookify Rules Updated |
| 98 | |
| 99 | **Enabled:** |
| 100 | - warn-console-log |
| 101 | |
| 102 | **Disabled:** |
| 103 | - warn-dangerous-rm |
| 104 | |
| 105 | **Unchanged:** |
| 106 | - require-tests |
| 107 | |
| 108 | Changes apply immediately - no restart needed |
| 109 | ``` |
| 110 | |
| 111 | ## Important Notes |
| 112 | |
| 113 | - Changes take effect immediately on next tool use |
| 114 | - You can also manually edit .claude/hookify.*.local.md files |
| 115 | - To permanently remove a rule, delete its .local.md file |
| 116 | - Use `/hookify:list` to see all configured rules |
| 117 | |
| 118 | ## Edge Cases |
| 119 | |
| 120 | **No rules to configure:** |
| 121 | - Show message about using `/hookify` to create rules first |
| 122 | |
| 123 | **User selects no rules:** |
| 124 | - Inform that no changes were made |
| 125 | |
| 126 | **File read/write errors:** |
| 127 | - Inform user of specific error |
| 128 | - Suggest manual editing as fallback |