Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add JKHeadley/instar --skill command-guardgit clone --depth 1 https://github.com/JKHeadley/instarWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/jkheadley/instar/command-guard)<a href="https://agentmods.dev/skills/jkheadley/instar/command-guard"><img src="https://agentmods.dev/badge/skills/jkheadley/instar/command-guard/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/jkheadley/instar/command-guard"><img src="https://agentmods.dev/badge/skills/jkheadley/instar/command-guard.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.02017 |
| Opus 5.5 | $0.00000 | $0.00807 |
| Sonnet 5.5 | $0.00000 | $0.00403 |
| Haiku 4.5 | $0.00000 | $0.00202 |
Grade C, and why
command-guard scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
description: Set up a PreToolUse hook in .claude/settings.json that blocks dangerous commands — rm -rf, force push, database drops, and others — before they execute. Teaches the pattern of safety hooks for any Claude Cod Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
- Commands that `cat`, `echo`, or `curl` files containing `SECRET`, `KEY`, `TOKEN`, `PASSWORD` to stdout How it starts
The opening of the file, as written. The whole thing — 240 lines — stays where its author put it; the contents beside it link to each section on GitHub.
command-guard — Block Dangerous Commands Before They Execute
Claude Code runs shell commands, edits files, and manages infrastructure with real consequences. Without guardrails, a misunderstood instruction or a hallucinated flag can delete data, corrupt history, or expose credentials. This skill installs a PreToolUse hook that blocks the most dangerous operations before they run.
No external tools required — this uses Claude Code's built-in hook system.
What Gets Blocked
The guard intercepts Bash tool calls and checks the command against a blocklist before execution. By default it blocks:
Irreversible deletions
rm -rfon non-temporary pathsgit clean -f(untracked file deletion)
Git history destruction
git push --force/git push -f(without explicit user confirmation)git reset --hardon shared branchesgit rebaseon pushed branches
Database operations
DROP TABLE,DROP DATABASE,TRUNCATEin SQLdb:reset,db:dropnpm/prisma scripts
Credential exposure
- Commands that
cat,echo, orcurlfiles containingSECRET,KEY,TOKEN,PASSWORDto stdout
Installation
Step 1: Create the hook script
mkdir -p .claude/hooks
Create .claude/hooks/command-guard.py:
#!/usr/bin/env python3
"""
command-guard.py — PreToolUse hook that blocks dangerous Bash commands.
Claude Code calls this before executing any Bash tool call.
Exit code 2 = block the command and show the message.
Exit code 0 = allow the command.
"""
import sys
import json
import re
import os
# Load the tool call input from stdin
try:
payload = json.load(sys.stdin)
except Exception:
sys.exit(0) # Can't parse — allow (fail open)
tool_name = payload.get('tool_name', '')
tool_input = payload.get('tool_input', {})
# Only intercept Bash calls
if tool_name != 'Bash':
sys.exit(0)
command = tool_input.get('command', '')
# --- Blocklist rules ---
# Each rule: (regex pattern, reason shown to agent)
BLOCKED = [
# Irreversible deletions
(r'\brm\s+-[a-zA-Z]*r[a-zA-Z]*f\b', 'rm -rf is blocked. Use rm with explicit paths, or move to trash instead.'),
(r'\bgit\s+clean\s+-[a-zA-Z]*f\b', 'git clean -f is blocked. List untracked files with --dry-run first.'),
# Force push
(r'\bgit\s+push\s+.*--force\b', 'Force push is blocked. Confirm with the user before rewriting remote history.'),
(r'\bgit\s+push\s+.*-f\b(?!ile)', 'Force push (-f) is blocked. Confirm with the user before rewriting remote history.'),
# Hard reset
(r'\bgit\s+reset\s+--hard\b', 'git reset --hard is blocked. Use --soft or --mixed, or confirm with user first.'),
# Database destructive ops
(r'\b(DROP\s+(TABLE|DATABASE|SCHEMA)|TRUNCATE\s+TABLE)\b', 'Destructive SQL (DROP/TRUNCATE) is blocked. Confirm with the user before destroying data.', re.IGNORECASE),
(r'\b(db:reset|db:drop|prisma.*reset)\b', 'Database reset scripts are blocked. Confirm with the user — this destroys all data.'),
# Credential leakage to stdout (basic check)
(r'\b(cat|echo|curl|printf)\b.*\.(env|secret|secrets|pem|key)\b', 'Printing credential files to stdout is blocked. Use secure variable injection instead.'),
]
for rule in BLOCKED:
pattern = rule[0]
message = rule[1]
flags = rule[2] if len(rule) > 2 else 0
if re.search(pattern, command, flags):
print(json.dumps({
"decision": "block",
"reason": f"[command-guard] {message}\n\nBlocked command: {command[:200]}"
}))
sys.exit(2)
# All clear
sys.exit(0)
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 240 lines · 0 tokens per session scan C a2cc8ab468af
command-guard is a skill published in the GitHub repository JKHeadley/instar (84 stars, last pushed today), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,017 tokens. A static security scan graded it C with 2 findings (recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
phaser-pixi-2d-games
Use when building a 2D web game with Phaser (3.x/4.x) or PixiJS 8 in TypeScript - framework vs renderer, Phaser scenes/game objects/arcade physics/groups as pools/scale manager/loader, scene shutdown cleanup, PixiJS 8 async init, Assets bundles, ticker units and destroy, and keeping rules in plain TS modules.
node-typescript-security-pitfalls
Use when reviewing Node.js or TypeScript server code - Express/Fastify/Nest handlers, Next.js server actions and route handlers, childprocess, ORM raw queries, prototype pollution, template engines, JWT and outbound HTTP clients.
node-typescript-service
Use when building or extending a TypeScript service on Node.js - Fastify, NestJS, Express or Hono, runtime validation at the boundary, strict types, the repository's ORM and migrations, async error handling, graceful shutdown.
react-typescript-patterns
Use when writing React + TypeScript components - functional components, explicit typed props, derived state over effects, and no any/unsafe casts.
V3 CLI Modernization
CLI modernization and hooks system enhancement for claude-flow v3. Implements interactive prompts, command decomposition, enhanced hooks integration, and intelligent workflow automation.
V3 Core Implementation
Core module implementation for claude-flow v3. Implements DDD domains, clean architecture patterns, dependency injection, and modular TypeScript codebase with comprehensive testing.