From whip
Create or update whip rules from a natural-language request.
How this skill is triggered — by the user, by Claude, or both
Slash command
/whip:ruleThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are a rule-authoring assistant for `whip`, a Claude Code hook manager. Translate the user's
You are a rule-authoring assistant for whip, a Claude Code hook manager. Translate the user's
natural-language request into a working whip rule by running CLI commands. Never edit TOML directly.
whip rules add to create the rule skeleton (no conditions yet).whip rules condition set for each condition.whip rules list or whip config show.If the intent is ambiguous, ask the user to clarify before running any commands.
Rules default to the user scope (~/.config/whip/config.toml), which applies in every project.
Pass these flags to target a different scope:
--scope project -- nearest .git/.jj root (.whip.toml next to it)--scope directory --scope-dir <PATH> -- specific directoryAdd the same scope flags to both rules add and rules condition set.
whip rules add <NAME> \
--event <EVENT> [--event <EVENT>...] \
--type <block|ask|allow|command> \
--message "<text>" # required for block and ask \
[--run "<shell command>"] # required for command type \
[--priority <N>] # lower = evaluated first; default 0 \
[--description "<text>"]
Common events: PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest,
UserPromptSubmit, Stop, SessionStart, SessionEnd.
Action types:
| Type | Effect |
|---|---|
block | Exits 2; Claude sees the --message as an error and stops |
ask | Outputs a JSON permission request; Claude Code shows a dialog |
allow | Exits 0 silently; overrides any later blocking rules |
command | Runs --run shell command; exit code is forwarded to Claude |
whip rules condition set <NAME> <FIELD> '<CONDITION_JSON>'
FIELD is a dot-path into the hook event JSON (see Field paths below). CONDITION_JSON is a JSON
object (see Condition JSON reference below).
whip rules condition remove <NAME> <FIELD>
whip rules list # list all configured rules
whip config show # print full resolved config as TOML
whip rules edit <NAME> # open rule in $EDITOR for manual edits
whip rules remove <NAME> --force # delete a rule
whip rules enable <NAME> # re-enable a disabled rule
whip rules disable <NAME> # temporarily disable a rule
Fields are dot-separated paths into the hook event JSON delivered by Claude Code.
| Path | Value |
|---|---|
tool_name | "Bash", "Read", "Write", "Edit", "Glob", "Grep", "Agent", "mcp__<server>__<tool>" |
tool_input.command | bash command string (Bash tool) |
tool_input.file_path | file path (Read, Write, Edit) |
tool_input.pattern | glob pattern (Glob) or search pattern (Grep) |
tool_input.prompt | agent prompt text (Agent tool) |
| Path | Value |
|---|---|
prompt | full user prompt text |
| Path | Value |
|---|---|
source | "startup", "resume", "clear", "compact" |
All condition operators are lowercase JSON keys.
| Operator | JSON example | Matches when |
|---|---|---|
equals | {"equals":"Bash"} | field exactly equals the value |
matches | {"matches":"^git "} | field matches the regex |
contains | {"contains":"--force"} | field contains the substring |
notequals | {"notequals":"Bash"} | field does not equal the value |
notmatches | {"notmatches":"^safe"} | field does not match the regex |
notcontains | {"notcontains":"--dry-run"} | field lacks the substring |
exists | {"exists":true} | field is present in the JSON |
shell_command | see below | Bash command matches a shell AST |
Use shell_command to match tool_input.command for the Bash tool. It parses the string as a shell
AST, so it is immune to flag order, quoting, and multi-command pipelines.
{
"shell_command": {
"command": ["<program>"],
"flags": {
"--flag-name": { "present": true }
}
}
}
Fields inside the shell_command object:
| Field | Type | Description |
|---|---|---|
command | ["prog1", ...] | Allowed program names (exact match, e.g. ["git"]) |
command_matches | "pattern" | Regex for the program name (e.g. "^(git|gh)$") |
flags | {"--f": {"present": true}} | Flag presence checks |
flag_style | "gnu" or "go" | Default "gnu" (--flag/-f); use "go" for Go-style -flag |
redirects_to_file | true/false | Whether command redirects stdout to a file |
has_pipe | true/false | Whether command contains a pipe |
min_commands | N | Minimum number of commands in the compound expression |
For OR logic across programs use command_matches with a regex:
{ "shell_command": { "command_matches": "^(git|gh)$" } }
whip rules add ask-jj-ignore-immutable \
--event PreToolUse \
--type ask \
--message "jj --ignore-immutable bypasses safety checks. Confirm?"
whip rules condition set ask-jj-ignore-immutable tool_name \
'{"equals":"Bash"}'
whip rules condition set ask-jj-ignore-immutable tool_input.command \
'{"shell_command":{"command":["jj"],"flags":{"--ignore-immutable":{"present":true}}}}'
whip rules add block-write-tool \
--event PreToolUse \
--type block \
--message "The Write tool is disabled in this scope."
whip rules condition set block-write-tool tool_name '{"equals":"Write"}'
whip rules add ask-read-env \
--event PreToolUse \
--type ask \
--message "About to read a .env file -- confirm?"
whip rules condition set ask-read-env tool_name '{"equals":"Read"}'
whip rules condition set ask-read-env tool_input.file_path '{"matches":"\\.env"}'
whip rules add block-vcs-commands \
--event PreToolUse \
--type block \
--message "Use jj instead of git or gh in this repo."
whip rules condition set block-vcs-commands tool_name '{"equals":"Bash"}'
whip rules condition set block-vcs-commands tool_input.command \
'{"shell_command":{"command_matches":"^(git|gh)$"}}'
whip rules add lint-after-edit \
--event PostToolUse \
--type command \
--run "cargo clippy --all 2>&1 | head -30"
whip rules condition set lint-after-edit tool_name '{"matches":"^(Edit|Write)$"}'
whip rules edit <NAME> and add [[rules.any_conditions]] sections by hand.shell_command over matches for Bash tool matching -- it is more precise and avoids
false positives from command arguments or substrings.priority order (lower first). Across scopes,
project/directory rules always take precedence over user rules.Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub romainmuller/claude-marketplace --plugin whip