damage-control
Install, configure, and manage Claude Code security hooks that block dangerous commands and protect sensitive files. Use when setting up security protection, blocking destructive commands (rm -rf, git reset --hard), protecting sensitive paths (.env, credentials), or managing PreToolUse hooks.
What this skill does
<objective> Defense-in-depth protection system for Claude Code. Uses PreToolUse hooks to intercept and validate tool calls before execution, blocking dangerous commands and protecting sensitive files. </objective> <protection_levels> | Level | Read | Write | Edit | Delete | Use Case | |-------|------|-------|------|--------|----------| | **zeroAccessPaths** | No | No | No | No | Secrets, credentials, .env files | | **readOnlyPaths** | Yes | No | No | No | System configs, lock files, build artifacts | | **noDeletePaths** | Yes | Yes | Yes | No | Important project files, .git/, LICENSE | </protection_levels> <how_it_works> PreToolUse hooks intercept tool calls at three points: 1. **Bash Hook** - Evaluates commands against regex patterns and path restrictions 2. **Edit Hook** - Validates file paths before modifications 3. **Write Hook** - Checks paths before file creation **Exit codes:** - `0` = Allow operation - `0` + JSON = Ask for confirmation (triggers dialog) - `2` = Block operation (stderr fed back to Claude) **Ask patterns:** Some operations trigger confirmation dialogs instead of blocking: - `git checkout -- .` (discards changes) - `git stash drop` (deletes stash) - `DELETE FROM table WHERE id=X` (SQL with specific ID) </how_it_works> <quick_start> **Interactive installation:** ``` /damage-control install ``` **Or ask Claude:** > "Install damage control security hooks" > "Set up protection for my project" </quick_start> <intake> What would you like to do? 1. **Install** - Set up damage control hooks (global, project, or personal) 2. **Modify** - Add/remove protected paths or blocked commands 3. **Test** - Validate hooks are working correctly 4. **List** - View all active protections across all levels **Wait for response before proceeding.** </intake> <routing> | Response | Workflow | |----------|----------| | 1, "install", "setup", "deploy" | [workflows/install.md](workflows/install.md) | | 2, "modify", "add", "remove", "change" | [workflows/modify.md](workflows/modify.md) | | 3, "test", "verify", "check" | [workflows/test.md](workflows/test.md) | | 4, "list", "view", "show" | [workflows/list.md](workflows/list.md) | **Direct command routing (skip menu):** - "add ~/.credentials to zero access" → Execute directly, then restart reminder - "block npm publish command" → Execute directly, then restart reminder - "protect /secrets folder" → Execute directly, then restart reminder **After reading the workflow, follow it exactly.** </routing> <blocked_commands_summary> **Destructive file operations:** - `rm -rf`, `rm --recursive`, `sudo rm` - `chmod 777`, `chown -R root` **Git destructive:** - `git reset --hard`, `git push --force` (not --force-with-lease) - `git clean -fd`, `git stash clear`, `git filter-branch` **Cloud destructive:** - AWS: `terminate-instances`, `delete-db-instance`, `delete-stack` - GCP: `projects delete`, `instances delete`, `clusters delete` - Docker: `system prune -a`, `volume rm` - Kubernetes: `delete namespace`, `delete all --all` **Database destructive:** - `DELETE FROM table;` (no WHERE clause) - `DROP TABLE`, `DROP DATABASE`, `TRUNCATE TABLE` - `redis-cli FLUSHALL`, `dropdb` See [scripts/patterns.yaml](scripts/patterns.yaml) for complete list. </blocked_commands_summary> <settings_locations> | Level | Settings Path | Hooks Path | Scope | |-------|--------------|------------|-------| | Global | `~/.claude/settings.json` | `~/.claude/hooks/damage-control/` | All projects | | Project | `.claude/settings.json` | `.claude/hooks/damage-control/` | Team-shared | | Personal | `.claude/settings.local.json` | `.claude/hooks/damage-control/` | Just you | </settings_locations> <runtime_requirements> **Python with UV (Recommended):** ```bash # macOS/Linux curl -LsSf https://astral.sh/uv/install.sh | sh # Windows powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" ``` **TypeScript with Bun (Alternative):** ```bash # macOS/Linux curl -fsSL https://bun.sh/install | bash && bun add yaml # Windows powershell -c "irm bun.sh/install.ps1 | iex" && bun add yaml ``` </runtime_requirements> <critical_reminder> **IMPORTANT:** After any installation or modification: > **Restart your agent for changes to take effect.** Hooks are only loaded at agent startup. Run `/hooks` after restart to verify. </critical_reminder> <workflows_index> | Workflow | Purpose | |----------|---------| | [workflows/install.md](workflows/install.md) | Interactive installation at any settings level | | [workflows/modify.md](workflows/modify.md) | Add/remove protected paths and blocked commands | | [workflows/test.md](workflows/test.md) | Validate all hooks are working correctly | | [workflows/list.md](workflows/list.md) | View all active protections | </workflows_index> <scripts_index> | Script | Purpose | |--------|---------| | [scripts/bash-tool-damage-control.py](scripts/bash-tool-damage-control.py) | PreToolUse hook for Bash commands | | [scripts/edit-tool-damage-control.py](scripts/edit-tool-damage-control.py) | PreToolUse hook for Edit tool | | [scripts/write-tool-damage-control.py](scripts/write-tool-damage-control.py) | PreToolUse hook for Write tool | | [scripts/test-damage-control.py](scripts/test-damage-control.py) | Test runner for hook validation | | [scripts/patterns.yaml](scripts/patterns.yaml) | Security patterns and protected paths | | [scripts/settings-template.json](scripts/settings-template.json) | Hook configuration template | </scripts_index> <success_criteria> A working damage-control installation has: - Hooks installed at chosen level (global/project/personal) - `patterns.yaml` copied alongside hook scripts - `settings.json` updated with PreToolUse hook configuration - UV (or Bun) runtime installed - Agent restarted to load hooks - Verified with `/hooks` command showing damage-control hooks - Tested with `rm -rf /tmp/test` (should be blocked) </success_criteria>
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.