# safe file cleanup

> Systematic file cleanup that uses native recycling bins and preserves reusable scripts instead of permanent deletion.

safe file cleanup is a free AI agent skill on Agensi by Nuclear0709, in Workflow Automation. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Nuclear0709](https://www.agensi.io/creators/nuclear0709)
- Category: [Workflow Automation](https://www.agensi.io/skills/workflow-automation)
- Version: 1.0
- Last updated: 2026-11-18
- Security: scan passed (2026-11-18); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/safe-file-cleanup
- Tags: automation, devops, powershell, bash, python

## About this skill

Stop losing local work or accidentally purging critical scripts during routine cleanup tasks. This skill replaces dangerous `rm -rf` and `del` commands with a systematic, platform-aware recovery process. It ensures that temporary files, test artifacts, and generated scripts are handled based on their actual value rather than just their file extension.

### What it does
- **Platform-aware recovery** uses native system trash/recycle bins on Windows, macOS, and Linux instead of permanent deletion.
- **Script preservation** analyzes tool-generated scripts for reusable logic before removal.
- **Protected hold zones** moves items to `.scratch/scripts/` or `.cleanup-hold/` when immediate deletion is risky.
- **Safety verification** confirms absolute paths and mount points to prevent following symlinks to unintended locations.
- **Granular reporting** provides detailed status updates for every item, distinguishing between recycled, moved, or retained files.

### How it works
1. **Target Identification** involves listing absolute paths and verifying file counts before any action.
2. **Reuse Analysis** evaluates generated scripts for potential value, offering options to extract or refine logic.
3. **Environment Selection** detects the OS and filesystem to choose the correct recycling tool (e.g., `IFileOperation`, `trashItem`, or `gio trash`).
4. **Execution and Validation** performs the move and verifies the presence of the item in the system trash or hold area.

### Frameworks & tools
This skill interfaces with Windows Shell APIs, .NET FileSystem methods, macOS Foundation's FileManager, and freedesktop.org Trash specifications for Linux. It works with PowerShell, Bash, and Python environments.

### Why this beats prompting it yourself
Generic prompts often lead to irreversible `rm` commands or ignore the context of generated scripts. This skill enforces a multi-step safety protocol that prevents data loss in containers and remote environments where standard trash bins are missing.

### Use cases
- **Post-test cleanup** of binary artifacts and log files after a build pipeline.
- **Script refinement** by saving and de-hardcoding temporary automation scripts.
- **Directory decluttering** by moving ambiguous files to a hold zone for later review.
- **Container maintenance** providing manual cleanup paths when native trash is unavailable.

### Known limitations
Does not support text-only deletion inside files. Permanent deletion requires explicit manual authorization if system recycling fails or is unsupported by the filesystem.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the safe file cleanup skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### What does safe file cleanup do?

Systematic file cleanup that uses native recycling bins and preserves reusable scripts instead of permanent deletion.

### Which AI agents support safe file cleanup?

This skill uses the open SKILL.md standard. Use it through an MCP-compatible agent connected to Agensi, and check the compatibility information on this page for confirmed agents and required capabilities.

### How do I use safe file cleanup?

Connect your AI agent to Agensi through MCP, then ask it to use safe file cleanup on your task. Your agent loads the latest approved version each time. Paid skills require a purchase or active subscription. Skill files are not available for download; your licence does not allow you to save, copy or export any part of a skill.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
