{"data":{"slug":"discovered-9a7befbaf9aab3482b55f1d1fcb5815a60a53ac0468c537e","title":"Nj Safe Delete","summary":"Move files and folders to the operating system's recycle bin instead of permanently deleting them, ensuring they can be restored. This applies to all deletions, including build output, caches, and temporary files.","url":"https:\/\/skillshunter.net\/skills\/discovered-9a7befbaf9aab3482b55f1d1fcb5815a60a53ac0468c537e","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-9a7befbaf9aab3482b55f1d1fcb5815a60a53ac0468c537e","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-9a7befbaf9aab3482b55f1d1fcb5815a60a53ac0468c537e.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-9a7befbaf9aab3482b55f1d1fcb5815a60a53ac0468c537e\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Before using this tool, ensure the file or folder name does not contain percent-escaped characters (e.g., `QA%20Engineer`), as the recycle-bin API may fail to recognize them. If renaming is required, use `Rename-Item -LiteralPath` and verify the renamed path before proceeding.","instructions":"---\nname: nj-safe-delete\ndescription: 'Delete files and folders to the operating system''s recycle bin instead of destroying them, so anything removed can be restored. Use for every deletion: rm, Remove-Item, del, fs.rm, shutil.rmtree, cleanups, delete the stale artifacts, remove that folder.'\n---\n\n# Nothing is deleted permanently\n\n**Every deletion goes to the recycle bin.** Not `rm`, not `rm -rf`, not\n`Remove-Item`, not `shutil.rmtree`, not `fs.rmSync` \u2014 those destroy, and a\ndestroyed file that turns out to have been wanted is not a mistake that can be\napologised away.\n\n```bash\npython ~\/.claude\/skills\/nj-safe-delete\/scripts\/trash.py <path> [path...]\n```\n\nIt moves each path to the OS recycle bin and prints what it moved. On Windows it\nuses the Shell API, so the items appear in the Recycle Bin with **Restore**\navailable exactly as if a person had deleted them from Explorer.\n\n## When this applies\n\nAlways. Including \u2014 especially \u2014 the cases that feel safe:\n\n- build output, caches, intermediates, \"regenerable\" files\n- stale copies after a move or a rename\n- folders you created yourself earlier in the same session\n- anything described as \"temporary\", \"orphan\" or \"unused\"\n\n\"It can be regenerated\" is not a reason to destroy it. Regenerating costs\nminutes; the judgement that it *was* regenerable can be wrong, and then the cost\nis unbounded. 4.1 GB of video intermediates were destroyed on that reasoning\nbefore this rule existed.\n\n## The exceptions, and they are narrow\n\n- **Overwriting a file you are rewriting** \u2014 writing to a path is not deleting.\n- **Scratch files in the session's own temp directory**, created and discarded\n  within one task and never seen by the user.\n- **The user explicitly says to destroy it permanently**, in those terms.\n\nAnything else: recycle bin.\n\n## If the recycle bin is not available\n\nNetwork drives, some containers and most CI machines have none. Then **move the\npath aside instead of deleting it** \u2014 a sibling `.trash\/` directory with a\ntimestamp \u2014 and say so, so the user knows where it went and that it still\nexists:\n\n```bash\npython ~\/.claude\/skills\/nj-safe-delete\/scripts\/trash.py --fallback-dir .trash <path>\n```\n\n## A name with `%` in it, or \"nothing moved\"\n\nThe shell's recycle-bin API decodes percent-escapes, so a folder literally named\n`QA%20Engineer` is read as `QA Engineer` \u2014 a *different* folder \u2014 and the call\nrefuses (\"nothing moved\" \/ \"the specified path is invalid\"). Never retry with\nanother API that might succeed on the decoded name. Rename the item to a plain\nname first (`Rename-Item -LiteralPath`), check the renamed path holds what you\nexpect, then recycle that.\n\nIf the rename itself says access denied \/ in use while no file is locked, a\nprocess holds a directory handle (a watcher, not an open file). Find it before\nguessing: enumerate this user's handles and match the path (2026-10-16 it was\nPDFgear's `FileWatcher.exe`, which watches the folder of every PDF opened in\nPDFgear). Stop that process, then rename and recycle.\n\n## Say what you removed\n\nA deletion is reported like any other change: what was removed, how much of it,\nand where it can be recovered from. \"Cleaned up\" is not a report.\n","use_cases":["Deleting build output and caches","Removing stale or orphaned files","Deleting temporary files created during a session","Moving files to the recycle bin on Windows or other OS platforms"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/NJ-Burrito\/NJ-Kit\/blob\/2644ffdccb94c9eb0a65b23624abe9795e005faa\/nj-kit\/bundled\/nj-safe-delete\/SKILL.md","source_commit":"2644ffdccb94c9eb0a65b23624abe9795e005faa","license":null,"version":null,"listing_approved_at":"2026-11-29","created_at":"2026-11-28T18:51:24.000000Z","updated_at":"2026-11-29T10:53:27.000000Z","seo_title":"Nj Safe Delete - Secure File Removal to Recycle Bin","seo_description":"Use Nj Safe Delete to move files and folders to the recycle bin instead of permanently deleting them, ensuring safe and reversible deletions for all file types.","seo_keywords":["safe delete","recycle bin","file deletion","secure removal","nj-safe-delete"]}}