file-operation-safety

file-operation-safety is a skill for Claude Code from latestaiagents/agent-skills. It costs 68 tokens per session (2,791 once invoked), scanned C, original, MIT.

A safety guide for file operations that delete, move, or overwrite files. It defines risk levels and checks to perform before changing files.

In plain words
What is it for?
Use it when an agent needs to remove, move, copy over, or otherwise modify files and directories.
Why use it?
It reduces the chance of accidentally losing files, especially during recursive or bulk operations. It also makes the possible impact clear before the operation runs.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: positional $N argument.

Not installable: its command points at a path on the author’s own machine, so it runs nowhere else. The line is /Users/dev/myproject/node_modules.

Part of the safety plugin — 5 skills shipped together , and of ai-safety-guardrails, latestaiagents

Good fit Use it when an agent needs to remove, move, copy over, or otherwise modify files and directories.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add latestaiagents/agent-skills
Claude Code
/plugin install safety

Made for: Claude Code.

Or install safety, the plugin that ships this one along with the rest of its 5 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for file-operation-safety

README.md
[![agentmods](https://agentmods.dev/badge/skills/latestaiagents/agent-skills/file-operation-safety/github.svg)](https://agentmods.dev/skills/latestaiagents/agent-skills/file-operation-safety)
Your own site
<a href="https://agentmods.dev/skills/latestaiagents/agent-skills/file-operation-safety"><img src="https://agentmods.dev/badge/skills/latestaiagents/agent-skills/file-operation-safety/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for file-operation-safety

Your own site · 80×15
<a href="https://agentmods.dev/skills/latestaiagents/agent-skills/file-operation-safety"><img src="https://agentmods.dev/badge/skills/latestaiagents/agent-skills/file-operation-safety.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 68 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,791 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00068 $0.02791
Opus 5 $0.00034 $0.01396
Sonnet 5 $0.00014 $0.00558
Haiku 4.5 $0.00007 $0.00279

Measured 7d ago against content hash 76e3fceda761, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade C, and why

file-operation-safety scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

| ⛔ CRITICAL | `rm -rf`, recursive delete on directories | Full path verification + explicit confirmation |
skills/safety/ai-safety-guardrails/file-operation-safety/SKILL.md · 395 lines

How it starts

The opening of the file, as written. The whole thing — 395 lines — stays where its author put it; the contents beside it link to each section on GitHub.

File Operation Safety

CRITICAL: File deletions can be permanent. This skill prevents irreversible file loss.

Danger Levels

Level Operations Requires
⛔ CRITICAL rm -rf, recursive delete on directories Full path verification + explicit confirmation
🔴 HIGH rm multiple files, mv with overwrite List all files + confirmation
🟠 MEDIUM rm single file, cp with overwrite Verify file exists + confirm
🟢 LOW cp to new location, mkdir, touch Standard execution

Pre-Operation Protocol

Before ANY Deletion

Step 1: Verify the path

# ALWAYS expand and verify the path first
realpath /path/to/target
ls -la /path/to/target

# Check what's inside (for directories)
find /path/to/target -type f | wc -l  # Count files
du -sh /path/to/target                 # Check size

Step 2: Present impact to user

## File Deletion Impact Assessment

**Command:** rm -rf ./node_modules
**Resolved path:** /Users/dev/myproject/node_modules

**Contents:**
- Total files: 45,234
- Total directories: 8,901
- Total size: 234 MB
- Contains hidden files: Yes (.cache, .bin)

**Can be recreated:** Yes (via `npm install`)

Proceed with deletion? Type "yes, delete node_modules" to confirm.

For Critical Operations

rm -rf on Directory
⛔ **CRITICAL: RECURSIVE DELETE REQUESTED**

**Command:** rm -rf /var/www/myapp

**⚠️ FULL PATH CHECK:**
- Requested path: /var/www/myapp
- Resolved path: /var/www/myapp
- Parent directory: /var/www (contains 3 other directories)
- Is symlink: No

**Contents to be deleted:**
- Files: 1,234
- Directories: 89
- Size: 456 MB
- Includes:
  - Source code (*.js, *.ts): 234 files
  - Configuration (*.json, *.yml): 12 files
  - Environment files (.env): 1 file ⚠️
  - Uploaded files (uploads/): 567 files ⚠️

**Recovery:**
- Git repository: Yes (can recover source code)
- Uploads folder: NO GIT ⚠️ (not recoverable)
- .env file: NO GIT ⚠️ (not recoverable)

**Before deletion, I recommend:**
1. Backup uploads folder: `cp -r uploads /backup/uploads_$(date +%Y%m%d)`
2. Backup .env: `cp .env /backup/.env_$(date +%Y%m%d)`

Proceed with deletion after backup? Type "yes, delete /var/www/myapp after backup" to confirm.

Read the full file on GitHub · 395 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 395 lines · 68 tokens per session scan C 76e3fceda761

Subscribe to this mod's changes

file-operation-safety is a skill published in the GitHub repository latestaiagents/agent-skills (5 stars, last pushed 4mo ago), licensed MIT. It adds 68 tokens to every session and 2,791 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.