bash-scripting

Enforce defensive, portable Bash patterns in CI/CD scripts.

Updated Oct 1, 2025
One-click install
npx skills add https://github.com/chmc/listall --skill bash-scripting-chmc
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bash-scripting
Source: https://github.com/chmc/listall/tree/main/.claude/skills/bash-scripting
Command: npx skills add https://github.com/chmc/listall --skill bash-scripting-chmc

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Bash scripting in CI/CD pipelines is frequently error-prone and hard to maintain; this Skill consolidates defensive patterns to improve reliability, readability, and portability of shell scripts.

Core Features & Use Cases

  • Strict mode: enable -euo pipefail to catch errors early and avoid silent failures.
  • Safe variable handling: always quote expansions and validate inputs to prevent word-splitting and surprises.
  • Portability and cleanup: provide cross-shell compatibility notes and traps for cleanup in error paths.
  • Use case: when writing deployment or test automation scripts, apply these patterns to reduce flaky builds and simplify debugging.

Quick Start

Audit your current Bash scripts and apply these defensive patterns to improve reliability in CI/CD pipelines.

Frequently Asked Questions about bash-scripting

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

FAQPage Schema
How do I make bash scripts in CI/CD pipelines fail safely instead of silently continuing?

To make bash scripts in CI/CD fail safely, enable strict mode using set -euo pipefail. This catches errors early, prevents silent failures, and stops execution when undefined variables appear or pipeline commands fail.

What is the best way to handle cleanup and errors in deployment shell scripts?

The best way to handle cleanup and errors in deployment shell scripts is using traps. Traps catch error paths and execute cleanup routines, ensuring robust error handling and maintaining safety during unexpected pipeline failures.

How do I prevent word-splitting and variable expansion issues in shell scripting?

To prevent word-splitting and variable expansion issues in shell scripting, always quote expansions and validate inputs. Safe variable handling avoids unexpected surprises and ensures readable, maintainable scripts across different environments.

Can I use these bash scripting patterns for cross-shell compatibility in test automation?

Yes, you can use these defensive bash scripting patterns for cross-shell compatibility in test automation. The guidelines provide portability notes to ensure your scripts run reliably across different shell environments during testing.

Why do my CI/CD builds fail intermittently despite no code changes?

Intermittent CI/CD build failures often stem from brittle bash scripts lacking defensive patterns. Applying strict mode, proper quoting, and robust error handling reduces flaky builds and simplifies debugging.

Do I need to install any dependencies to apply defensive bash scripting in my pipelines?

No dependencies are required to apply defensive bash scripting in your pipelines. The patterns rely on built-in shell features like strict mode, quoting, and traps, making them immediately applicable to existing deployment and test scripts.