Create, find, copy, move, rename and delete files inside your workspace with the agent's file tools or shell; plans destructive changes and asks before running them.
--- name: file-management-skill description: Creates, lists, finds, copies, moves, renames and deletes files and folders inside the user's workspace using the agent's own file tools or standard shell commands, with a plan-then-confirm step for anything that overwrites, moves or deletes. Use when asked to organise files, clean up a folder, rename in bulk, check whether a file exists, or create a directory structure. compatibility: Uses the host agent's file tools or a POSIX shell (ls, find, mkdir, cp, mv, rm). Paths outside the workspace the user named are out of scope. metadata: version: "1.0.0" category: "productivity" --- # File Management Skill There is no separate file API: carry out each operation with the agent's built-in file tools (read, write, edit, glob/search) or ordinary shell commands. Stay inside the workspace root the user gave you and confirm before destructive changes. ## Scope rules - **Workspace root.** Resolve every path (`realpath`, or `Path(p).resolve()` in Python) and refuse anything that resolves outside the root, including `..` segments and symlinks that point outside. - **Read-only first.** Listing, searching and existence checks need no confirmation. - **Confirm first** for: delete, overwrite, move/rename, recursive operations, more than 20 files at once, and hidden or version-control folders (`.git`, `.env`, `node_modules`). - Never touch system or home-level folders (`/`, `~`, `/etc`, `C:\Windows`) unless the user names that exact path and the operation is read-only. ## Operations | Need | Shell | Notes | |---|---|---| | Exists? | `test -e path && echo yes` | Distinguish file (`-f`) and directory (`-d`) | | List | `ls -la dir`, `find dir -maxdepth 2 -type f` | | | Find by pattern | `find . -name '*.log' -mtime +30 -type f` | Show the list before acting on it | | Create directory | `mkdir -p path/to/dir` | | | Create file | agent write tool, or `printf '%s\n' "text" > new.txt` only after checking it does not exist | `>` truncates existing files | | Copy | `cp -n src dst` / `cp -Rn srcdir dstdir` | `-n` will not overwrite | | Move/rename | `mv -n src dst` | `mv -n` can exit 0 even when it skips (macOS does); check that the destination did not already exist before you report success | | Delete file | `rm path` | Only after confirmation; prefer moving to a trash/archive folder if the user agrees | | Delete directory | `rm -r dir` | Show the files `find dir -type f` lists, with their count, first | ## Workflow 1. Restate the request as concrete operations with resolved absolute paths. 2. Run read-only checks: sources exist, destinations do not (or will be overwritten), count of affected files. 3. For changes, show a plan table (operation, source, destination, overwrite?) and wait for confirmation. For bulk renames include a before → after preview of every name. 4. Execute operation by operation; stop at the first error and report what was and was not done. 5. Verify by listing the resulting paths. ## Output format Plan table → confirmation → results table (operation, path, status: done/skipped/failed with reason) → final listing. ## Limitations - Deleted files are not recoverable by this skill; there is no undo unless the user has backups or version control. - Permissions, open file locks (Windows) and read-only mounts cause failures; report them, do not escalate with `sudo`. ## Example Request: "In ./reports, move every .csv older than 30 days into ./reports/archive." Good result: `find ./reports -maxdepth 1 -name '*.csv' -mtime +30 -type f` lists 3 files; `mkdir -p ./reports/archive`; the plan shows three moves with no name conflicts; after "yes", `mv -n` runs for each file, and a final `ls ./reports/archive` shows all three.
Generate a GitHub Actions (or other CI) pipeline from the repo's real scripts, with least-privilege permissions, caching, concurrency and a gated deploy.
Generate a compose.yaml for your app, database and cache with health-checked startup, named volumes and secrets in .env, validated with docker compose config.
Automate notifications and alerts
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
Content reviewed .
A reports folder has accumulated CSV exports, and old ones should be archived without losing anything.
In ./reports, move every .csv older than 30 days into ./reports/archive. Don't overwrite anything.
Paths are resolved inside the workspace. A read-only `find ./reports -maxdepth 1 -name '*.csv' -mtime +30 -type f` lists the old files (for example a.csv, b.csv, c.csv; new.csv is excluded) and `mkdir -p ./reports/archive` is planned. The plan table shows each move and flags any name already in archive/. After the user confirms, `mv -n` runs per file. Because `mv -n` can exit 0 even when it skips, a final listing of ./reports/archive is used to confirm each move.
AI Agent Skills are reusable workflow packages that extend your AI coding assistant with multi-step capabilities. Install File Management Skill by following these steps.
SKILL.md inside, in the location documented by your client. Do not assume every AI application reads the same directory.Requires an Agent Skills-compatible client; supported locations and activation vary by version. Read the SKILL.md setup guide. MCP connects tools and data and does not, by itself, install a skill.
Generate a GitHub Actions (or other CI) pipeline from the repo's real scripts, with least-privilege permissions, caching, concurrency and a gated deploy.
Generate a compose.yaml for your app, database and cache with health-checked startup, named volumes and secrets in .env, validated with docker compose config.
Automate notifications and alerts