destructive-command-guard

Block destructive terminal commands before execution using a Rust-based Claude Code hook.

14|5|Updated Jan 29, 2026
One-click install
npx skills add https://github.com/oakoss/agent-skills --skill destructive-command-guard
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: destructive-command-guard
Source: https://github.com/oakoss/agent-skills/tree/main/skills/destructive-command-guard
Command: npx skills add https://github.com/oakoss/agent-skills --skill destructive-command-guard

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill prevents AI agents from accidentally executing destructive commands in the terminal, safeguarding against data loss and system instability.

Core Features & Use Cases

  • Pre-execution Blocking: Intercepts and blocks dangerous commands like rm -rf, git reset --hard, and git push --force before they run.
  • Modular Security Packs: Supports granular control over blocked commands via configurable packs (e.g., git, database, Kubernetes, cloud).
  • Use Case: When an AI agent attempts to run rm -rf / or git reset --hard HEAD~5, this Skill will block the command, providing a clear explanation and preventing accidental data destruction.

Quick Start

Configure the destructive-command-guard skill to protect your terminal sessions from accidental data loss.

Frequently Asked Questions about destructive-command-guard

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I block destructive commands like rm -rf or git push --force before execution?

To block destructive commands before execution, you can use a Claude Code hook that intercepts dangerous CLI inputs like `rm -rf` or `git push --force` and prevents them from running, safeguarding against data loss.

What is the best way to prevent AI agents from accidentally running dangerous terminal commands?

The best way to prevent AI agents from running dangerous terminal commands is to configure a pre-execution blocking hook that intercepts inputs, applies sub-millisecond filtering, and stops execution with a clear explanation.

Can I configure which specific commands the guard blocks?

Yes, you can configure which specific commands are blocked using modular security packs, allowing granular control over terminal protection rules for different areas like git, databases, Kubernetes, and cloud platforms.

Does command blocking slow down terminal performance?

Command blocking does not slow down terminal performance because the filtering uses SIMD acceleration and Aho-Corasick algorithms to achieve sub-millisecond latency during command interception.

How do I set up guardrails for git reset --hard in my CLI?

To set up guardrails for `git reset --hard`, configure a Claude Code hook that intercepts the command before execution, utilizing security packs designed to block destructive git operations and prevent accidental data destruction.

When do I need a pre-execution hook to protect my filesystem?

You need a pre-execution hook to protect your filesystem when AI agents or automated processes have terminal access, risking accidental data loss from destructive commands like `rm -rf /` or forced git operations.