Back to list
brianmjohnson

safe-delete

by brianmjohnson

2🍴 0📅 Jan 22, 2026

SKILL.md


name: safe-delete description: Safely delete files by moving them to .deleted/ folder instead of permanent deletion. Use this when removing files, cleaning up code, or deleting unused components. Preserves files for recovery. allowed-tools: Bash, Read, Glob

Safe Delete Skill

Move files to .deleted/ folder instead of permanently deleting them, preserving the ability to recover.

When to Use

  • Removing unused files
  • Cleaning up deprecated code
  • Deleting old components
  • Any file deletion in the project

Instructions

NEVER permanently delete files. Always move them to .deleted/ to preserve for potential recovery.

Basic Usage

# Move file to .deleted/ preserving path structure
mkdir -p .deleted/$(dirname <filepath>)
git mv <filepath> .deleted/<filepath>

Script Helper

For convenience, use this pattern:

# Delete a single file
filepath="path/to/file.ts"
mkdir -p ".deleted/$(dirname "$filepath")"
git mv "$filepath" ".deleted/$filepath"

Examples

Delete a Component

filepath="components/unused-button.tsx"
mkdir -p ".deleted/$(dirname "$filepath")"
git mv "$filepath" ".deleted/$filepath"

Result: components/unused-button.tsx.deleted/components/unused-button.tsx

Delete Multiple Files

for file in components/old-*.tsx; do
  mkdir -p ".deleted/$(dirname "$file")"
  git mv "$file" ".deleted/$file"
done

Delete a Directory

dirpath="components/deprecated"
mkdir -p ".deleted/$dirpath"
git mv "$dirpath"/* ".deleted/$dirpath/"
rmdir "$dirpath"

Recovery

To recover a deleted file:

# Move back from .deleted/
git mv .deleted/path/to/file.ts path/to/file.ts

Cleanup

Periodically clean up .deleted/ folder after confirming files are not needed:

# List what's in .deleted/
find .deleted -type f

# Remove old deleted files (after reviewing)
git rm -r .deleted/

.gitignore Consideration

Decide whether to track .deleted/:

Track it (recommended for teams): Files remain recoverable from git history

# Don't ignore .deleted/

Ignore it (local only): Personal trash, not shared

.deleted/

Important Notes

  • The .deleted/ folder mirrors the original directory structure
  • Files in .deleted/ are still tracked by git (unless ignored)
  • This provides a "soft delete" before permanent removal
  • Clean up .deleted/ periodically to avoid bloat

Score

Total Score

65/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon