File operation patterns
Skill Tibsfox/gsd-skill-creator/project-claude/skills/file-operation-patterns
Safe file operation patterns. Use when performing bulk file operations or writing deployment scripts.From its SKILL.md
npx -y skills add Tibsfox/gsd-skill-creator --skill file-operation-patternsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
1.0 KB, 205 tokens by cl100k_base, as published. Nobody here has run it
File Operation Patterns
Safe Patterns
# Create directory tree (idempotent)
mkdir -p path/to/nested/dir
# Copy preserving permissions
cp -rp src/ dst/
# Atomic write (prevents partial reads)
tmpfile=$(mktemp "${target}.XXXXXX")
echo "$content" > "$tmpfile"
mv "$tmpfile" "$target"
# Safe deletion (guard variables)
[ -n "$DIR" ] && [ "$DIR" != "/" ] && rm -rf "$DIR"
# Incremental sync
rsync -av src/ dst/
Anti-Patterns
| Don't | Do |
|---|---|
rm -rf $DIR unguarded | Guard with [ -n "$DIR" ] |
| Write directly to target | Write to temp, then mv |
| Assume dir exists | mkdir -p first |
| Ignore permissions | cp -p or explicit chmod |
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.