shell-script-safety

Enforce strict quoting, error handling, and variable hygiene in Bash scripts.

2|Updated Mar 17, 2026
One-click install
npx skills add https://github.com/buchananwill/ue-claude-scaffold --skill shell-script-safety
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: shell-script-safety
Source: https://github.com/buchananwill/ue-claude-scaffold/tree/main/skills/shell-script-safety
Command: npx skills add https://github.com/buchananwill/ue-claude-scaffold --skill shell-script-safety

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Bash scripting often suffers from unsafe quoting, inadequate error handling, and sloppy variable hygiene that lead to bugs and security vulnerabilities. This Skill provides practical, scalable guidelines and patterns to enforce safe scripting practices across projects.

Core Features & Use Cases

  • Strict mode guidance: recommends using set -euo pipefail and traps for cleanup to catch errors early.
  • Quoting discipline: demonstrates when and how to quote variables and arrays to prevent word splitting and glob expansion.
  • Injection prevention: advises on avoiding eval and constructing commands safely with arrays and proper parameter handling.
  • Real-world examples: shows common anti-patterns and their corrected forms.

Quick Start

Run a shell-script safety review across your Bash scripts to enforce best practices.

Frequently Asked Questions about shell-script-safety

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I make Bash scripts safe and prevent shell injection vulnerabilities?

To make Bash scripts safe, apply strict rules for quoting, error handling, and variable hygiene. Enabling set -euo pipefail and avoiding eval prevents common shell injection vulnerabilities.

What is set -euo pipefail used for in shell scripting?

Set -euo pipefail is a strict mode for shell scripting that catches errors early by treating unset variables as errors, exiting on failure, and failing pipelines correctly.

How do I handle word splitting and glob expansion when quoting variables in Bash?

Quoting variables in Bash prevents word splitting and glob expansion. Strict quoting discipline requires wrapping variables and arrays in double quotes to ensure predictable execution.

Can I use this to review existing shell scripts in my CI pipelines?

Yes, you can review existing shell scripts in CI pipelines to improve reliability. It enforces safe scripting practices, strict quoting, and proper error handling across deployment repositories.

Why does my Bash script fail on unbound variables and how do I fix it?

Your Bash script fails on unbound variables because strict variable hygiene requires initialization. Setting the -u option exits scripts when referencing unset variables, preventing unexpected deployment failures.