ワンクリックで
bash-expert
Write reliable shell commands and scripts
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Write reliable shell commands and scripts
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | bash-expert |
| description | Write reliable shell commands and scripts |
Follow these steps when writing or executing shell commands:
Always use set -e at the top of multi-line scripts so the script exits on the first error rather than silently continuing.
Quote all variables with double quotes: "$var" not $var. Unquoted variables break on spaces and special characters.
Capture stderr alongside stdout when you need full output: use command 2>&1 or check both streams separately.
Check exit codes explicitly for commands where failure matters but doesn't abort the script:
if ! command; then
echo "command failed" >&2
exit 1
fi
Use mktemp for temporary files rather than hard-coded paths like /tmp/foo. This avoids collisions between concurrent runs.
Prefer find . -name '*.ts' -print0 | xargs -0 over for f in $(find ...) when filenames may contain spaces.
Use || true to suppress errors for optional commands (e.g. rm -f file || true).
Limit output when running commands that may produce large output: pipe through head -n 100 or slice with tail -n 50.
Explain what a command does in a comment above it when it is non-obvious — especially for pipes and compound expressions.
Test destructive commands (rm, overwrite) with echo or --dry-run first if supported by the tool.