safe-delete

Block dangerous rm patterns and convert safe removals into recoverable trash operations.

2|Updated Jan 14, 2026
One-click install
npx skills add https://github.com/zot24/skills --skill safe-delete
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: safe-delete
Source: https://github.com/zot24/skills/tree/main/skills/safe-delete/skills/safe-delete
Command: npx skills add https://github.com/zot24/skills --skill safe-delete

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevent catastrophic file deletion by intercepting unsafe rm invocations, blocking high-risk patterns, and turning recoverable removals into trash operations to enable easy recovery.

Core Features & Use Cases

  • Blocks dangerous patterns including rm -rf /, rm -rf ~, sudo rm -rf, and other root- or wildcard-level deletions.
  • Transforms safe rm to trash so deleted files are moved to the system Trash/Recycle Bin and can be restored.
  • PreToolUse hook integration intercepts Bash commands before execution and supports per-project and global configuration.
  • Configurable and auditable with customizable blocked patterns, allow-lists, and logging of decisions for compliance and debugging.
  • Use case: A developer who accidentally types rm -rf ./node_modules will have the command converted to a trash invocation instead of permanently removing files.

Quick Start

Use the safe-delete skill to convert the command rm -rf ./dist into a recoverable trash invocation.

Frequently Asked Questions about safe-delete

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

FAQPage Schema
How do I prevent accidental permanent file deletion when using the rm command in a shell?

To prevent accidental permanent file deletion, you can intercept risky rm commands and transform them into recoverable trash operations. This ensures deleted files are moved to the system Trash instead of being permanently removed, enabling easy recovery.

Can I block dangerous rm -rf commands like root or home directory deletions automatically?

Yes, you can block dangerous rm -rf commands automatically by detecting high-risk patterns like rm -rf /, rm -rf ~, and sudo rm -rf. These catastrophic invocations are intercepted and blocked before execution to protect critical directories.

Does PreToolUse hook integration work for intercepting Bash commands before execution?

PreToolUse hook integration does work for intercepting Bash commands before execution. It applies to interactive shell sessions and per-project Claude plugin environments, transforming safe rm invocations into trash equivalents and blocking dangerous patterns.

What is the best way to convert rm commands to trash operations for recoverable file removal?

The best way to convert rm commands to trash operations is by applying command transformation rules that route safe invocations to system trash utilities. This approach supports configurable allow-lists and logs decisions for compliance and debugging.

Are blocked deletion patterns customizable for specific project environments?

Blocked deletion patterns are customizable for specific project environments. You can configure blocked patterns, set allow-lists, and enable logging of decisions to support both per-project and global configuration setups for compliance auditing.