safe-rm

Verify the current working directory before executing rm -rf operations.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill prevents shell session breakage by verifying the working directory before rm -rf operations and guiding safe deletion practices.

Core Features & Use Cases

  • Pre-delete checklist: Ensures the current directory is safe before any rm -rf or rm -r command.
  • Safe patterns: Provides safe usage patterns like changing to a parent directory or using absolute paths after confirming pwd.
  • Recovery guidance: Clear steps if a shell session breaks and how to minimize risk during automated tasks.

Quick Start

Before running any delete, review the checklist and execute commands in the safe order:

  • Check current directory with pwd
  • Ensure you are not inside the target directory
  • Change directory if needed
  • Run rm -rf with full path or after safe cd

Frequently Asked Questions about safe-rm

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

FAQPage Schema
How do I prevent deleting the current working directory when using rm -rf in bash?

Prevent shell session breakage during rm -rf by running pwd first to verify the current directory. Change to a parent directory or use absolute paths after confirming your location to ensure you never delete the active working directory.

Why does my shell session break after running a recursive delete command?

Shell sessions break when rm -rf deletes the current working directory or its ancestor. Avoid this by running pwd to verify your location and changing to a safe parent directory before executing the recursive delete command.

What is the safe pattern for executing rm -rf in shell scripts?

The safe pattern for rm -rf in shell scripts requires a pre-delete checklist: check pwd, ensure the script is not inside the target directory, and execute the delete using explicit absolute paths to prevent accidental working directory removal.

Can I use safe-rm to protect my filesystem during interactive shell operations?

Yes, safe-rm protects filesystems during interactive shell operations by enforcing a mandatory pre-delete checklist. It verifies the working directory before rm -rf operations to ensure deletes happen only from safe locations with explicit path references.

What should I do if my shell session breaks after an accidental rm -rf?

If your shell session breaks after an accidental rm -rf, follow recovery guidance to restore the session. The skill provides clear recovery steps and outlines how to minimize risk during future automated tasks using safe patterns.