safety-rm-rf-guard

Block destructive file deletion commands in Bash terminal sessions.

7|Updated May 28, 2026
One-click install
npx skills add https://github.com/zcaceres/skills --skill safety-rm-rf-guard
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: safety-rm-rf-guard
Source: https://github.com/zcaceres/skills/tree/main/skills/safety-rm-rf-guard
Command: npx skills add https://github.com/zcaceres/skills --skill safety-rm-rf-guard

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jq, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This skill prevents catastrophic data loss by intercepting and blocking destructive file deletion commands like rm, shred, and unlink within your AI agent's terminal environment.

Core Features & Use Cases

  • Proactive Protection: Automatically scans Bash commands for dangerous patterns before they execute.
  • Safe Alternatives: Redirects the agent to use the trash CLI, ensuring deleted files remain recoverable.
  • Use Case: If an AI agent attempts to run a command like rm -rf / or find . -delete, this skill blocks the execution and provides a helpful warning to use the trash command instead.

Quick Start

Install the safety guard and wire it into your configuration to ensure all future bash commands are protected from accidental deletion.

Frequently Asked Questions about safety-rm-rf-guard

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

FAQPage Schema
How do I prevent an AI agent from accidentally deleting files with rm -rf in the terminal?

To prevent accidental file deletion, you can intercept bash commands and block destructive patterns like rm, shred, and unlink before execution. This forces the AI agent to use the trash CLI for recoverable file removal instead of permanent deletion.

How does command interception protect against destructive bash commands in Claude Code?

Command interception works by scanning Bash tool inputs for dangerous deletion patterns using a PreToolUse hook. When it detects commands like find . -delete, it enforces a permission denial contract that stops execution and warns the agent to use safe alternatives.

Do I need to install jq and trash CLI to enable safe file removal for AI agents?

Yes, you need to install jq for idempotent configuration management and the trash CLI to enable recoverable file removal. These dependencies allow the safety guard to redirect blocked deletion commands to a recoverable trash bin.

What is the best way to block shred and unlink commands in automated AI workflows?

The best way to block shred and unlink commands is to wire a proactive protection skill into your configuration that scans terminal inputs. It automatically denies execution of dangerous patterns and provides a helpful warning to use trash instead.

Will blocking rm commands stop my AI agent from executing other standard bash operations?

No, blocking rm commands operates specifically by scanning for dangerous deletion patterns like rm, shred, and unlink. Standard bash operations proceed normally, while only destructive file deletion commands are intercepted and denied.

Can safety-rm-rf-guard protect against recursive directory deletion triggered by find . -delete?

Yes, safety-rm-rf-guard protects against recursive directory deletion by scanning bash commands for dangerous patterns like find . -delete. It blocks the execution and redirects the agent to use the trash CLI for safe, recoverable removal.