file-batch-safety
Skill1 starsChanged 2 months agoMITView on GitHub
Read before any batch file operation — moving, deleting, renaming, or deduping many files. Real file loss lives here.
In this repository39 other files it gives its agents.
- apple-native-motionSkill
- apple-ui-copySkill
- audit-macos-appSkill
- brain-wikiSkill
- catch-me-upSkill
- checkpointSkill
- claude-md-coachSkill
- claudeSkill
- codexSkill
- crash-debuggingSkill
- cut-memorySkill
- explaining-problemsSkill
- handoffSkill
- heads-downSkill
- hopper-mcpSkill
- icon-designSkill
- interface-integritySkill
- ios-defaultsSkill
- kitSkill
- macos-defaultsSkill
- mock-and-pickSkill
- obsess-heroSkill
- obsessSkill
- offline-archiveSkill
- os-workaroundsSkill
- paper-mcpSkill
- predictionSkill
- second-loopSkill
- session-auditSkill
- ship-macosSkill
- show-meSkill
- slice-and-reviewSkill
- slow-modeSkill
- spatial-interfacesSkill
- standupSkill
- synthetic-fixturesSkill
- transitional-interfacesSkill
- web-design-defaultsSkill
- window-captureSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
No recursive delete for cleanup: Never shutil.rmtree a directory you only assume is empty.
- Distinctive: line 15
Adversarial pass before running: Before a script touches many real files, trace 2–3 input shapes that could break the logic — not just the …
- Very specific: line 22
Case-insensitive paths: Default APFS/HFS+ is case-insensitive: Foo/ and foo/ can be the *same* file.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
file-batch-safety
These rules were learned through actual lost files. Read them before the first batch operation of a session, not after something goes wrong.
Policies (non-negotiable)
- Duplicates don't mean delete. Identical bytes don't mean the user wanted the copy gone — where a file sits carries intent. Report duplicates (paths, sizes, hashes); delete only with their explicit OK for that specific operation.
- Use one real recovery system. For clean files and symlinks already committed in Git, Git is the recovery system: make the reviewable change and do not create a second quarantine copy. Quarantine filesystem assets that Git does not protect—untracked or ignored files, user media, external archives, uncommitted unique content, and destructive cross-filesystem moves. Verify which case applies before touching anything.
- No recursive delete for cleanup. Never
shutil.rmtreea directory you only assume is empty. Useos.rmdir— it fails loudly if you're wrong. - Adversarial pass before running. Before a script touches many real files, trace 2–3 input shapes that could break the logic — not just the case that motivated the script. Ask the user about worst-case inputs when unsure.
- Recovery before batch, not duplicate backups. Establish and test one restoration route before mutation. Do not consume disk making a backup of exact bytes already recoverable from a verified Git commit or another user-designated source of truth.
- Read-only volumes. When the user names a disk or directory as a backup, an archive, or "real data" (their backup drives, Patreon archive content), treat it as read-only: no moves, no renames, no cleanup, no "helpful" reorganization. Reading is fine; extracting is done to a temp location outside it. This has come up on real backup disks where loss would be unrecoverable — when in doubt about a volume's status, ask before the first write, not after.
macOS traps
- NFD filenames. APFS/HFS+ returns decomposed Unicode (
ç=c+ combining cedilla); Python string literals are NFC. They print identically but compare unequal, so a naive.replace()or==silently misses. Normalize withunicodedata.normalize("NFD", name)(and strip combining marks if matching loosely) before comparing. - Case-insensitive paths. Default APFS/HFS+ is case-insensitive:
Foo/andfoo/can be the same file. Before renaming onto an existing name or deduping, confirm they're actually different files withos.path.samefile— an md5 match between two spellings of one file proves nothing. - Don't walk a tree you're moving into.
os.walkover a destination re-finds just-moved files and flags them as duplicates of themselves — a file gets deleted as its own copy. Collect all sources first, then move. Guardrealpath(src) == realpath(dst). Never auto-delete on an md5 match between what might be the same inode.
Preflight and reconciliation
Before a real batch, record a manifest: source roots, target roots, item count, total bytes, free space, symlinks, version-control status, and whether the move crosses filesystems. For Git recovery, confirm the exact paths are tracked, clean, and present in a reachable commit; a repository existing nearby is not enough. A cross-filesystem move is copy-then-delete rather than an atomic rename; verify the copy before removing the source. Cloud placeholders and offline files are not fully present merely because a directory entry exists.
Afterward, reconcile against that manifest: every source accounted for, expected target count and bytes, the selected recovery route still works, and no unexpected paths. Report counts and the undo command or location. A command exiting zero is not the reconciliation.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

