bash-pro

Enforce defensive Bash scripting safety and portability with ShellCheck, shfmt, and Bats.

17|4|Updated Feb 4, 2026
One-click install
npx skills add https://github.com/sawrus/agent-guides --skill bash-pro
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bash-pro
Source: https://github.com/sawrus/agent-guides/tree/main/skills/bash-pro
Command: npx skills add https://github.com/sawrus/agent-guides --skill bash-pro

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Defensive Bash scripting is essential for production automation to prevent crashes, security flaws, and portability issues. This skill provides a proven foundation for writing safe, robust Bash scripts that are easy to audit and maintain.

Core Features & Use Cases

  • Defensive patterns: strict mode, safe argument parsing, robust error handling, and safe file operations
  • Testing and linting: comprehensive tests with Bats and static analysis with ShellCheck and shfmt to maintain quality
  • Use Case: Harden a CI script that deploys a service to multiple Linux distros while rejecting unsafe inputs

Quick Start

  • Use the bash-pro skill to harden a Bash script by enabling strict mode, adding input validation, and wiring in tests with Bats and ShellCheck

Frequently Asked Questions about bash-pro

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

FAQPage Schema
How do I write defensive Bash scripts for safe CI/CD automation?

You can harden CI/CD pipelines by enabling strict mode, adding input validation, and rejecting unsafe inputs in your Bash scripts. This prevents crashes and security flaws during automated deployment tasks across multiple Linux distros.

What is defensive scripting in Bash and why is it needed?

Defensive scripting in Bash is the practice of enforcing strict error handling and safe argument parsing to prevent crashes and security flaws. It is needed to ensure robust, portable automation across POSIX and Bash environments.

Do I need ShellCheck and Bats to test portable shell scripts?

Yes, you need ShellCheck and Bats to test portable shell scripts. ShellCheck provides static analysis and Bats delivers comprehensive testing to maintain quality and verify deterministic execution in Bash environments.

Does this defensive scripting approach support both POSIX and Bash environments?

Yes, this defensive scripting approach supports both POSIX and Bash environments. It enforces portability across different shell environments while requiring Bash 4+ features for its internal parsing and safety checks.

What's the best way to harden a Bash script that deploys to multiple Linux distros?

The best way to harden a deployment Bash script is to enable strict mode, add safe argument parsing, and wire in tests with Bats and ShellCheck. This rejects unsafe inputs and ensures safe, portable automation across distros.