
safe-delete
by brianmjohnson
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
スコア
総合スコア
リポジトリの品質指標に基づく評価
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 100以上
3ヶ月以内に更新がある
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
レビュー
レビュー機能は近日公開予定です
