Individual skill
shell
Shell scripting best practices for writing safe, portable, and maintainable bash/sh scripts. Use when writing, reviewing, or refactoring shell scripts, Dockerfile RUN commands, Makefile recipes, CI pipeline scripts, cron jobs, or systemd ExecStart directives. Triggers on bash, sh, POSIX, ShellCheck, error handling, quoting, variables, set -euo pipefail.
skills/.experimental/shell/SKILL.md
Source commit cf93c57cac89d6fc3e4194686000411567f5caf3
What was checked
- Matches the observed repository HEAD
- Yes
- Scanner rules are current
- Yes
- Repository scan complete
- No
- Skill scan complete
- No
- Observed behavior
- Network or broad shell
- Last checked
- Nov 5, 2026
These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.
Install this skill
Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.
An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.
Repository context
- Repository stars (not skill ratings)
- 221
- Repository last updated
- Aug 15, 2026
- License
- MIT
Observed agent integration: codex
- writing Derived category
Files and excerpt
File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.
Browse files
AGENTS.mddoc · 9,427 bytesREADME.mddoc · 3,380 bytesSKILL.mdcore · 7,771 bytesSKILL.mdcore · 7,771 bytesSKILL.mdcore · 7,771 bytesassets/templates/_template.mddoc · 981 bytesmetadata.jsonasset · 1,042 bytesreferences/_sections.mddoc · 2,108 bytesreferences/err-check-commands.mddoc · 2,130 bytesreferences/err-debug-tracing.mddoc · 2,423 bytesreferences/err-exit-codes.mddoc · 1,775 bytesreferences/err-pipefail.mddoc · 2,061 bytesreferences/err-shellcheck.mddoc · 3,171 bytesreferences/err-stderr-messages.mddoc · 2,232 bytesreferences/err-strict-mode.mddoc · 2,755 bytesreferences/err-trap-cleanup.mddoc · 2,473 bytesreferences/func-avoid-aliases.mddoc · 2,821 bytesreferences/func-documentation.mddoc · 3,119 bytesreferences/func-main-pattern.mddoc · 2,560 bytesreferences/func-return-values.mddoc · 2,854 bytesreferences/func-single-purpose.mddoc · 2,892 bytesreferences/perf-avoid-subshells.mddoc · 2,927 bytesreferences/perf-batch-operations.mddoc · 3,099 bytesreferences/perf-builtins-over-external.mddoc · 2,786 bytesreferences/perf-parameter-expansion.mddoc · 3,455 bytesreferences/perf-process-substitution.mddoc · 3,273 bytesreferences/perf-read-files.mddoc · 2,992 bytesreferences/port-avoid-bashisms.mddoc · 1,779 bytesreferences/port-export-syntax.mddoc · 2,128 bytesreferences/port-printf-over-echo.mddoc · 1,860 bytesreferences/port-shebang-selection.mddoc · 1,829 bytesreferences/port-test-portability.mddoc · 1,719 bytesreferences/quote-always-quote-variables.mddoc · 2,074 bytesreferences/quote-brace-expansion.mddoc · 2,554 bytesreferences/quote-command-substitution.mddoc · 2,260 bytesreferences/quote-dollar-at.mddoc · 2,321 bytesreferences/quote-glob-safety.mddoc · 2,697 bytesreferences/quote-here-documents.mddoc · 2,917 bytesreferences/safety-absolute-paths.mddoc · 2,031 bytesreferences/safety-argument-injection.mddoc · 1,459 bytesreferences/safety-command-injection.mddoc · 1,590 bytesreferences/safety-eval-avoidance.mddoc · 1,506 bytesreferences/safety-suid-forbidden.mddoc · 1,694 bytesreferences/safety-temp-files.mddoc · 1,520 bytesreferences/style-comments.mddoc · 3,135 bytesreferences/style-file-structure.mddoc · 1,918 bytesreferences/style-indentation.mddoc · 2,295 bytesreferences/test-arithmetic.mddoc · 2,939 bytesreferences/test-case-patterns.mddoc · 3,100 bytesreferences/test-double-brackets.mddoc · 2,965 bytesreferences/test-explicit-empty.mddoc · 2,680 bytesreferences/test-file-operators.mddoc · 3,094 bytesreferences/var-default-values.mddoc · 2,427 bytesreferences/var-local-scope.mddoc · 2,255 bytesreferences/var-naming-conventions.mddoc · 2,316 bytesreferences/var-readonly-constants.mddoc · 2,186 bytesreferences/var-use-arrays.mddoc · 2,128 bytes
Read excerpt
# Shell Scripts Best Practices (Community)
Comprehensive best practices guide for shell scripting, designed for AI agents and LLMs. Contains 49 rules across 9 categories, prioritized by impact from critical (safety, portability) to incremental (style). Each rule includes detailed explanations, real-world examples comparing incorrect vs. correct implementations, and specific impact metrics.
## When to Apply
Reference these guidelines when:
- Writing new bash or POSIX shell scripts
- Reviewing shell scripts for security vulnerabilities
- Debugging scripts that fail silently or behave unexpectedly
- Porting scripts between Linux, macOS, and containers
- Optimizing shell script performance
- Setting up CI/CD pipelines with shell scripts