[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ADXBNDARX3RDTEXAVPXAC2":3,"skill-same:01M7ADXBNDARX3RDTEXAVPXAC2":45},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7ADXBNDARX3RDTEXAVPXAC2","shell-safe",null,"Leostruka\u002Fdevin-bundle","Leostruka","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F81370685?v=4","01M7AD8MAK63VDNAWRDRRRW04N","leandro ostruka","01M7AD8MBS65YDS1KMMV7YPM07",0,"MIT","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Fskills\u002Fshell-safe\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: shell-safe\ndescription: Use whenever running shell commands or writing .sh\u002F.bash scripts. Prevents blanked files, wrong-directory deletes, and silent failures: same-file redirect truncation, empty-variable rm -rf, unquoted expansion, pipe exit-code swallowing, cd-then-delete traps, sed -i portability, tarbombs, verify-after-write discipline.\ntriggers: [user, model]\nallowed-tools: [read, exec, write, edit, grep]\n---\n\n# Shell Safe\n\nSibling of `powershell-safe`: same class of disaster, other shell. The exec tool runs bash (Git Bash on Windows), so most commands pass through here.\n\n## Rule zero: file content does not go through the shell\n\nUse `write`\u002F`edit` tools for real files. Never:\n\n- `cat \u003C\u003C EOF > file.py` for project files.\n- `echo \"...\" > config.json`.\n- `sed -i` \u002F `awk > file` for edits the `edit` tool does better.\n\nRedirect only for disposable output (logs, dumps).\n\n## Same file, read and written\n\n```bash\ncat config.txt | sed 's\u002Fa\u002Fb\u002F' > config.txt   # config.txt BLANKED\ngrep foo app.log > app.log                    # app.log BLANKED\n```\n\nThe shell opens `config.txt` for write (truncating) before `cat` runs. Safe patterns:\n\n```bash\n# 1. Temp + move\nsed 's\u002Fa\u002Fb\u002F' config.txt > config.txt.tmp && mv config.txt.tmp config.txt\n\n# 2. Read first (small files)\nc=$(cat config.txt); printf '%s' \"${c\u002F\u002Fa\u002Fb}\" > config.txt\n\n# 3. sponge (moreutils) if available\nsed 's\u002Fa\u002Fb\u002F' config.txt | sponge config.txt\n```\n\nNote the `&&`: if `sed` fails, `mv` does not run and the original survives. With `;` it would overwrite with nothing.\n\n## rm -rf with empty variable\n\n```bash\nrm -rf \"$DIR\u002F\"      # DIR empty -> rm -rf \u002F\nrm -rf $DIR\u002F*       # DIR empty -> rm -rf \u002F*\n```\n\nMandatory defenses:\n\n```bash\n: \"${DIR:?DIR empty, aborting}\" && rm -rf \"$DIR\"\n# or\n[ -n \"$DIR\" ] && [ -d \"$DIR\" ] || exit 1\n```\n\n- Always `\"$VAR\"` double-quoted (unquoted, spaces split into args and empties vanish silently).\n- In scripts: `set -u` makes undefined variables an error, not \"\".\n\n## cd then delete: order matters\n\n```bash\ncd build; rm -rf *        # if cd fails, rm runs in CURRENT dir\ncd build && rm -rf *      # correct: rm only runs if cd worked\n```\n\nBetter: do not depend on cwd. `rm -rf build\u002F*` or `find build -mindepth 1 -delete`.\n\n## Pipe swallows exit codes\n\n```bash\nfailing_cmd | tee log.txt ; echo $?   # 0 (exit of tee!)\n```\n\n- `$?` in a pipe is the LAST command's exit.\n- `set -o pipefail` makes the pipe return the first error.\n- `cmd1 | cmd2 && next` without pipefail continues even with cmd1 dead.\n\n## Scripts: minimum boilerplate\n\n```bash\n#!\u002Fusr\u002Fbin\u002Fenv bash\nset -euo pipefail    # -e stop on first error, -u undefined var = error,\n                     # pipefail = pipes propagate failures\n```\n\nWithout it, a script continues after errors and later steps run on broken state.\n\n## Treacherous globbing\n\n```bash\nfor f in *.txt; do ...    # no match: iterates the literal string \"*.txt\"\n```\n\nIn delete\u002Fprocess loops, a literal `*.txt` reaches later steps as a nonexistent file. Defense: `shopt -s nullglob` or `[ -e \"$f\" ] || continue`.\n\n## Silent overwrite\n\n- `mv a b` overwrites `b` without asking; `cp` too. Use `-n` (no-clobber) or `-i`.\n- `>` truncates; `>>` appends. Wrong operator = blanked file or duplicated log.\n- `>` follows symlinks: redirecting to a symlink overwrites its target.\n\n## find -delete \u002F xargs rm: look before destroying\n\n```bash\nfind . -name \"*.tmp\" -delete          # blind\nfind . -name \"*.tmp\" -print -delete   # delete showing what matched\n```\n\n`xargs` without `-0` breaks on names with spaces: `find . -print0 | xargs -0 rm`.\n\n## chmod\u002Fchown and sudo\n\n- `chmod -R 777` never: it masks the real problem (usually ownership or umask).\n- `sudo` does not work in the exec tool (no TTY for password). If root is needed, ask the user to run it.\n- `kill -9` first kills without cleanup. `kill` (TERM) first, `-9` only if it survives.\n\n## Extraction and copy\n\n- `tar -xzf pkg.tar.gz` may be a tarbomb (files into cwd root). `tar -tzf pkg.tar.gz | head` first.\n- `rsync a\u002F b\u002F` != `rsync a b\u002F`: trailing slash changes semantics. `--dry-run` before destructive rsync (`--delete`).\n- `scp`\u002F`ssh host cmd`: quoting passes through TWO shells (local and remote). Print destructive ssh commands before running.\n\n## Portability\n\n- `sed -i` differs: GNU `sed -i 's\u002Fa\u002Fb\u002F' f` vs BSD\u002FmacOS `sed -i '' 's\u002Fa\u002Fb\u002F' f`. Portable: `sed -i.bak 's\u002Fa\u002Fb\u002F' f` (works on both, creates .bak).\n- `date`, `stat`, `readlink -f` also differ GNU vs BSD.\n- CRLF\u002FLF: Windows-originated `\\r\\n` breaks shebang (`bad interpreter`). `file script.sh` shows it; `sed -i 's\u002F\\r$\u002F\u002F'` fixes it.\n\n## Post-operation verification\n\n- After redirect writes: `wc -l file` + `head`.\n- After delete\u002Fmove: `ls` the directory.\n- After a script: check real exit code (`echo $?` immediately, before another command overwrites it).\n\n## Checklist\n\n1. Real file content? -> `write`\u002F`edit` tool, not shell.\n2. Same file on both ends of the pipe? -> temp+move.\n3. Variable in rm\u002Fmv\u002Fcd checked non-empty? Double quotes?\n4. `cd` followed by destructive op uses `&&`?\n5. Script has `set -euo pipefail`?\n6. Blind delete? `-print`\u002Fdry-run first.\n7. Wrote? Read it back (`wc -l`, `head`)?\n\n## Cascade\n\n- `powershell-safe`: sibling skill, same concepts, other syntax.\n- `edge-cases` before operations on real data\u002Fstate.\n","# Shell Safe\n\nSibling of `powershell-safe`: same class of disaster, other shell. The exec tool runs bash (Git Bash on Windows), so most commands pass through here.\n\n## Rule zero: file content does not go through the shell\n\nUse `write`\u002F`edit` tools for real files. Never:\n\n- `cat \u003C\u003C EOF > file.py` for project files.\n- `echo \"...\" > config.json`.\n- `sed -i` \u002F `awk > file` for edits the `edit` tool does better.\n\nRedirect only for disposable output (logs, dumps).\n\n## Same file, read and written\n\n```bash\ncat config.txt | sed 's\u002Fa\u002Fb\u002F' > config.txt   # config.txt BLANKED\ngrep foo app.log > app.log                    # app.log BLANKED\n```\n\nThe shell opens `config.txt` for write (truncating) before `cat` runs. Safe patterns:\n\n```bash\n# 1. Temp + move\nsed 's\u002Fa\u002Fb\u002F' config.txt > config.txt.tmp && mv config.txt.tmp config.txt\n\n# 2. Read first (small files)\nc=$(cat config.txt); printf '%s' \"${c\u002F\u002Fa\u002Fb}\" > config.txt\n\n# 3. sponge (moreutils) if available\nsed 's\u002Fa\u002Fb\u002F' config.txt | sponge config.txt\n```\n\nNote the `&&`: if `sed` fails, `mv` does not run and the original survives. With `;` it would overwrite with nothing.\n\n## rm -rf with empty variable\n\n```bash\nrm -rf \"$DIR\u002F\"      # DIR empty -> rm -rf \u002F\nrm -rf $DIR\u002F*       # DIR empty -> rm -rf \u002F*\n```\n\nMandatory defenses:\n\n```bash\n: \"${DIR:?DIR empty, aborting}\" && rm -rf \"$DIR\"\n# or\n[ -n \"$DIR\" ] && [ -d \"$DIR\" ] || exit 1\n```\n\n- Always `\"$VAR\"` double-quoted (unquoted, spaces split into args and empties vanish silently).\n- In scripts: `set -u` makes undefined variables an error, not \"\".\n\n## cd then delete: order matters\n\n```bash\ncd build; rm -rf *        # if cd fails, rm runs in CURRENT dir\ncd build && rm -rf *      # correct: rm only runs if cd worked\n```\n\nBetter: do not depend on cwd. `rm -rf build\u002F*` or `find build -mindepth 1 -delete`.\n\n## Pipe swallows exit codes\n\n```bash\nfailing_cmd | tee log.txt ; echo $?   # 0 (exit of tee!)\n```\n\n- `$?` in a pipe is the LAST command's exit.\n- `set -o pipefail` makes the pipe return the first error.\n- `cmd1 | cmd2 && next` without pipefail continues even with cmd1 dead.\n\n## Scripts: minimum boilerplate\n\n```bash\n#!\u002Fusr\u002Fbin\u002Fenv bash\nset -euo pipefail    # -e stop on first error, -u undefined var = error,\n                     # pipefail = pipes propagate failures\n```\n\nWithout it, a script continues after errors and later steps run on broken state.\n\n## Treacherous globbing\n\n```bash\nfor f in *.txt; do ...    # no match: iterates the literal string \"*.txt\"\n```\n\nIn delete\u002Fprocess loops, a literal `*.txt` reaches later steps as a nonexistent file. Defense: `shopt -s nullglob` or `[ -e \"$f\" ] || continue`.\n\n## Silent overwrite\n\n- `mv a b` overwrites `b` without asking; `cp` too. Use `-n` (no-clobber) or `-i`.\n- `>` truncates; `>>` appends. Wrong operator = blanked file or duplicated log.\n- `>` follows symlinks: redirecting to a symlink overwrites its target.\n\n## find -delete \u002F xargs rm: look before destroying\n\n```bash\nfind . -name \"*.tmp\" -delete          # blind\nfind . -name \"*.tmp\" -print -delete   # delete showing what matched\n```\n\n`xargs` without `-0` breaks on names with spaces: `find . -print0 | xargs -0 rm`.\n\n## chmod\u002Fchown and sudo\n\n- `chmod -R 777` never: it masks the real problem (usually ownership or umask).\n- `sudo` does not work in the exec tool (no TTY for password). If root is needed, ask the user to run it.\n- `kill -9` first kills without cleanup. `kill` (TERM) first, `-9` only if it survives.\n\n## Extraction and copy\n\n- `tar -xzf pkg.tar.gz` may be a tarbomb (files into cwd root). `tar -tzf pkg.tar.gz | head` first.\n- `rsync a\u002F b\u002F` != `rsync a b\u002F`: trailing slash changes semantics. `--dry-run` before destructive rsync (`--delete`).\n- `scp`\u002F`ssh host cmd`: quoting passes through TWO shells (local and remote). Print destructive ssh commands before running.\n\n## Portability\n\n- `sed -i` differs: GNU `sed -i 's\u002Fa\u002Fb\u002F' f` vs BSD\u002FmacOS `sed -i '' 's\u002Fa\u002Fb\u002F' f`. Portable: `sed -i.bak 's\u002Fa\u002Fb\u002F' f` (works on both, creates .bak).\n- `date`, `stat`, `readlink -f` also differ GNU vs BSD.\n- CRLF\u002FLF: Windows-originated `\\r\\n` breaks shebang (`bad interpreter`). `file script.sh` shows it; `sed -i 's\u002F\\r$\u002F\u002F'` fixes it.\n\n## Post-operation verification\n\n- After redirect writes: `wc -l file` + `head`.\n- After delete\u002Fmove: `ls` the directory.\n- After a script: check real exit code (`echo $?` immediately, before another command overwrites it).\n\n## Checklist\n\n1. Real file content? -> `write`\u002F`edit` tool, not shell.\n2. Same file on both ends of the pipe? -> temp+move.\n3. Variable in rm\u002Fmv\u002Fcd checked non-empty? Double quotes?\n4. `cd` followed by destructive op uses `&&`?\n5. Script has `set -euo pipefail`?\n6. Blind delete? `-print`\u002Fdry-run first.\n7. Wrote? Read it back (`wc -l`, `head`)?\n\n## Cascade\n\n- `powershell-safe`: sibling skill, same concepts, other syntax.\n- `edge-cases` before operations on real data\u002Fstate.\n",{},"main","02b95ddb62959a00b3c31442c2046aca0d19563c","skills\u002Fshell-safe",1,"https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle","https:\u002F\u002Fleostruka.github.io\u002Fdevin-bundle\u002F","https:\u002F\u002Fgithub.com\u002FLeostruka","2026-11-15 05:19:58",{"source":7,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add Leostruka\u002Fdevin-bundle --skill shell-safe",{"tool":37,"command":38},"bunx","bunx skills add Leostruka\u002Fdevin-bundle --skill shell-safe",{"tool":40,"command":41},"pnpm","pnpm dlx skills add Leostruka\u002Fdevin-bundle --skill shell-safe","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Fskills\u002Fshell-safe\u002FSKILL.md",true,[],[46,53,60,67,74,81],{"skillNo":47,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":50,"categories":51,"keywords":52,"publishedAt":18},"01M7E0K3MG2XC4FSRV0MK6SFR1","montador-de-ideias","Use when assembling, expanding, or elevating a raw project idea or initial prompt into an ultra-detailed, first-principles dossier and compiled master prompt with journalistic OSINT market research, Tech Lead and Staff Architect justifications, atomic and modular hardening\u002Foptimization, and high-impact contact surfaces.","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Fskills\u002Fmontador-de-ideias\u002FSKILL.md",[],[],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":18},"01M7E0J7JJWZ8QMK01RZ3B3C9Z","git-github-adaptive-engineering","Use when any task touches git history, GitHub issues\u002FPRs\u002Freleases\u002FCI, repo governance, or branch and merge decisions. Runs the Fase Zero situational-awareness battery, picks one of five delivery flows via the adaptive decision engine, and enforces commit\u002FPR information-density standards. Orchestrates the gh, git-workflows, github-actions, pr, and debug\u002Ffinish skills.","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Fskills\u002Fgit-github-adaptive-engineering\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":18},"01M7E0GJFRPFEVQQMXEM58EWDM","adaptive-agenda-calendar-routine-engine","Use when planning or executing work across hours, days, weeks, or sprints. Turns the calendar into a strict time-blocked agenda (HH:MM-HH:MM blocks carrying a routine profile, expected inputs, and a handoff output artifact), runs the 5-stage cognitive flow (Radar and Hunt -> Triage plus Steve Jobs conception -> workbench manifest -> >=32-cycle loop -> Close plus Open-Minded Scrum), and unfolds macro calendar milestones into micro agenda blocks through extensions\u002Fgcal\u002Fwrapper.py.","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Fskills\u002Fadaptive-agenda-calendar-routine-engine\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":18},"01M7AE2K9FTY0BVS48N0A9JFKF","demo","Use when demonstrating a skill in a fixture project.","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fdevin-config\u002Fproject\u002F.devin\u002Fskills\u002Fdemo\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":18},"01M7AE2G3DP38PTV3B1N7MW5TS","duplicate-skill","Use when testing duplicate skill name detection.","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fdevin-config\u002Fproject\u002F.devin\u002Fskills\u002Fbeta\u002FSKILL.md",[],[],{"skillNo":82,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":18},"01M7AE2DBR8ZHT6T875MJ392GK","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fdevin-config\u002Fproject\u002F.devin\u002Fskills\u002Falpha\u002FSKILL.md",[],[]]