shell-scripting

Enforce standardized conventions for bash, sh, and zsh scripts.

1|Updated Jun 24, 2026
One-click install
npx skills add https://github.com/eric-sabe/engsys --skill shell-scripting-eric-sabe
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: shell-scripting
Source: https://github.com/eric-sabe/engsys/tree/main/stacks/lang/shell/skills/shell-scripting
Command: npx skills add https://github.com/eric-sabe/engsys --skill shell-scripting-eric-sabe

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Inconsistent shell scripts introduce bugs, security vulnerabilities, and maintenance overhead when multiple contributors write automation, testing, or Git hook scripts across the repository.

Core Features & Use Cases

  • Safety & Error Handling: Enforces set -euo pipefail, required parameter validation, temporary file cleanup with trap, and safe variable expansion to prevent common shell bugs and security risks.
  • Structured Data Parsing: Guides use of jq for JSON and yq for YAML instead of fragile ad-hoc grep/awk commands, ensuring reliable parsing of configuration files and command output.
  • Standardized Script Template: Provides a reusable, well-commented template with shebang, default values, reusable functions, and argument parsing to keep all shell scripts readable and maintainable.
  • Use Case: If you need to write a Git pre-commit hook that validates commit messages against a JSON allowlist, this skill ensures the script is secure, parses the config correctly, and follows the repo's standard structure.

Quick Start

Use the shell-scripting skill to write a new bash script for your repo that validates required input parameters and parses a YAML config file with yq, following all defined conventions.

Frequently Asked Questions about shell-scripting

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

FAQPage Schema
How do I write a safe bash script that prevents errors and security vulnerabilities?

Safe bash scripts require set -euo pipefail for error handling, parameter validation, safe variable expansion, and cleanup traps for temporary files. This prevents common shell bugs and security risks across development and automation workflows.

What's the best way to parse JSON and YAML in shell scripts?

Parsing JSON and YAML in shell scripts is best handled using jq and yq respectively. This ensures reliable structured data parsing for configuration files and command output, replacing fragile ad-hoc grep and awk commands.

Why does my shell script fail when a command returns an error?

Shell scripts fail on command errors when using set -euo pipefail, which enforces strict error handling. This mechanism stops execution immediately if a command fails, a variable is undefined, or a pipe breaks, preventing silent bugs.

Can I use a standard template for all bash and sh scripts in my repository?

You can use a standardized shell script template for all bash, sh, and zsh scripts in your repository. It provides a reusable structure with shebang, default values, reusable functions, and argument parsing to keep scripts readable and maintainable.

How do I create a Git pre-commit hook that validates commit messages?

Creating a Git pre-commit hook that validates commit messages involves writing a secure shell script that parses a JSON allowlist using jq. Following standard conventions ensures the hook is safe, parses configs correctly, and includes required parameter validation.

How do I manage temporary files safely in shell scripts?

Temporary files in shell scripts are managed safely using mktemp for creation and trap for cleanup. This combination ensures temporary files are removed reliably upon script exit, preventing leftover data and potential security issues.