| name | safe-rm |
| description | MANDATORY: Use instead of rm -rf or rm -r to prevent shell session breakage |
Safe Remove Skill
Purpose: Prevent shell session breakage by verifying working directory before rm -rf operations.
Critical Issue
If you delete the directory you're currently in, all subsequent Bash commands will fail with "Exit code 1" and Claude Code must be restarted. This is unrecoverable without restart.
Mandatory Pre-Delete Checklist
BEFORE any rm -rf command:
pwd
cd /path/to/workspace
rm -rf /path/to/workspace/test
Safe Patterns
cd /path/to/workspace && rm -rf /path/to/workspace/test-dir
cd /path/to/workspace && rm -rf test-dir
pwd
rm -rf /path/to/workspace/test-dir
rm -rf /path/to/workspace/test-dir
rm -rf .
rm -rf /path/to/workspace/test-dir
Recovery
If shell breaks (all commands return "Exit code 1"):
- Restart Claude Code - this is the only fix
- The shell session cannot recover from a deleted working directory
Quick Reference
| Situation | Action |
|---|
| Deleting temp directory | pwd first, cd if needed |
| Cleaning up test files | Verify not inside target directory |
| Removing build artifacts | Use parent directory as working dir |
Any rm -rf operation | Always check pwd first |