agentsclimarketplace

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

Install
npx -y skills add Tibsfox/gsd-skill-creator --skill file-operation-patterns

Assembled 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'tDo
rm -rf $DIR unguardedGuard with [ -n "$DIR" ]
Write directly to targetWrite to temp, then mv
Assume dir existsmkdir -p first
Ignore permissionscp -p or explicit chmod

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.