How this skill is triggered — by the user, by Claude, or both
Slash command
/command-guard:command-guardThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Manages the command-guard configuration at `.claude/command-guard.json`.
Manages the command-guard configuration at .claude/command-guard.json.
| Field | Required | Type | Description |
|---|---|---|---|
match | Yes | "command" | "file_path" | "tool_name" | What to match against |
pattern | Yes | string (regex) | Pattern to match |
message | Yes | string | Message shown when triggered |
severity | Yes | "error" | "warning" | error=block, warning=reminder |
case_sensitive | No | boolean | Default: false |
&&, ||, ;, | and normalized (absolute paths stripped, quoted strings removed).mcp__server__method.# OVERRIDE: <reason> (5+ chars).The safePatterns array contains regex patterns that bypass all blocking rules. Use for safe variants of otherwise dangerous commands.
When the user invokes this skill:
Read .claude/command-guard.json if it exists. If it doesn't, create it with {"rules": [], "safePatterns": []}.
Interpret the user's request in natural language. The user may say things like:
match: "command", severity: "error"match: "file_path", severity: "warning"match: "tool_name", severity: "error"Determine the rule fields:
match type based on what the user wants to guard against (a shell command, a file path, or a tool name).pattern as a regex. Use \\s+ for whitespace, escape special regex characters, and anchor with ^/$ only when appropriate.message that explains why it's blocked/warned and suggests an alternative if possible.severity: "error" (block) unless the user explicitly asks for a warning/reminder.Show the proposed rule as JSON and ask the user to confirm before writing. For example:
I'll add this rule:
{
"match": "command",
"pattern": "git\\s+reset\\s+--hard",
"message": "git reset --hard destroys uncommitted changes. Use git stash first.",
"severity": "error"
}
After confirmation, read the current file, add the rule to the rules array (or the pattern to safePatterns), and write it back.
For listing rules: show each rule with a short summary (index, match type, pattern, severity).
For removing or editing rules: identify the rule by index or pattern match, show what will change, confirm, then write.
npx claudepluginhub golergka/command-guard --plugin command-guardGuides creation of markdown-based Hookify rules to block dangerous bash commands, warn on risky file edits, and enforce behavioral guardrails in Claude Code.
Creates and configures Hookify rules (.md files with YAML frontmatter) for pattern matching and warnings on bash, file, prompt, and stop events. Includes regex guidance, condition syntax, and file organization.
Guides authoring Hookify rules to monitor bash commands, file edits, prompts with regex patterns and conditions; covers syntax, events, actions, examples.