Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

shell

FreeNo executable scriptsNot checked

Shell scripting best practices for writing safe, portable, and maintainable bash/sh scripts. Use when writing, reviewing, or refactoring shell scripts…

pproencaby pproenca★ 231 GitHub stars

About this skill

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

Rule Categories by Priority

Priority Category Impact Prefix Rules
1 Safety & Security CRITICAL safety- 6
2 Portability CRITICAL port- 5
3 Error Handling HIGH err- 8
4 Variables & Data HIGH var- 5
5 Quoting & Expansion MEDIUM-HIGH quote- 6
6 Functions & Structure MEDIUM func- 5
7 Testing & Conditionals MEDIUM test- 5
8 Performance LOW-MEDIUM perf- 6
9 Style & Formatting LOW style- 3

Quick Reference

1. Safety & Security (CRITICAL)

2. Portability (CRITICAL)

3. Error Handling (HIGH)

4. Variables & Data (HIGH)

5. Quoting & Expansion (MEDIUM-HIGH)

6. Functions & Structure (MEDIUM)

7. Testing & Conditionals (MEDIUM)

  • [`t
Full SKILL.md on GitHub

Install shell in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

AGENTS.mdREADME.mdassets/templates/_template.mdmetadata.jsonreferences/_sections.mdreferences/err-check-commands.mdreferences/err-debug-tracing.mdreferences/err-exit-codes.mdreferences/err-pipefail.mdreferences/err-shellcheck.mdreferences/err-stderr-messages.mdreferences/err-strict-mode.mdreferences/err-trap-cleanup.mdreferences/func-avoid-aliases.mdreferences/func-documentation.mdreferences/func-main-pattern.mdreferences/func-return-values.mdreferences/func-single-purpose.mdreferences/perf-avoid-subshells.mdreferences/perf-batch-operations.mdreferences/perf-builtins-over-external.mdreferences/perf-parameter-expansion.mdreferences/perf-process-substitution.mdreferences/perf-read-files.mdreferences/port-avoid-bashisms.mdreferences/port-export-syntax.mdreferences/port-printf-over-echo.mdreferences/port-shebang-selection.mdreferences/port-test-portability.mdreferences/quote-always-quote-variables.mdreferences/quote-brace-expansion.mdreferences/quote-command-substitution.mdreferences/quote-dollar-at.mdreferences/quote-glob-safety.mdreferences/quote-here-documents.mdreferences/safety-absolute-paths.mdreferences/safety-argument-injection.mdreferences/safety-command-injection.mdreferences/safety-eval-avoidance.mdreferences/safety-suid-forbidden.md

FAQ

What does the shell skill do?

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.

How do I install the shell skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the shell skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare shell with