language-bash

Generate strict-mode Bash scripts with safe quoting, arrays, and trap cleanup.

2|8|Updated Apr 20, 2026
One-click install
npx skills add https://github.com/lugassawan/swe-workbench --skill language-bash
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: language-bash
Source: https://github.com/lugassawan/swe-workbench/tree/main/skills/language-bash
Command: npx skills add https://github.com/lugassawan/swe-workbench --skill language-bash

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents common Bash production failures by guiding you to write strict-mode, correctly quoted, idempotent scripts that fail safely and behave predictably.

Core Features & Use Cases

  • Strict-mode correctness: applies robust defaults like set -euo pipefail, safe IFS, and predictable pipeline failures to reduce silent errors.
  • Quoting and word-splitting discipline: enforces safe parameter expansion practices and array iteration patterns to avoid broken filenames and injection-like bugs.
  • Operational safety patterns: covers trap-based cleanup, signal handling, idempotency via sentinels/atomic rewrites, and heredocs (literal vs interpolated) for reliable automation.
  • Portability guardrails: distinguishes Bash-only features from POSIX sh and points to shellcheck-compatible practices for enforceable contracts.
  • Use Case: When maintaining a deployment or migration script that may be re-run, use this Skill to make it resilient to partial execution, handle interrupts cleanly, and avoid breaking on edge-case inputs like spaces.

Quick Start

Ask the skill to show how to restructure your Bash script with strict mode, correct quoting/arrays, and an idempotency sentinel while using trap cleanup for safe re-runs.

Frequently Asked Questions about language-bash

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

FAQPage Schema
How do I write a Bash script that fails safely on errors and interrupts?

To write a Bash script that fails safely, apply strict mode using set -euo pipefail, configure safe IFS, and implement trap-based cleanup for signal handling to ensure predictable pipeline failures and clean exits on interrupts.

What's the best way to make a deployment shell script idempotent?

The best way to make a deployment shell script idempotent is using sentinels and atomic rewrites, combined with trap-based cleanup patterns to handle partial execution safely and allow reliable re-runs without side effects.

Why does my Bash script break when processing filenames with spaces?

Your Bash script breaks on filenames with spaces due to improper quoting and word-splitting. Enforce safe parameter expansion practices and use array iteration patterns to avoid broken filenames and injection-like bugs.

How do I ensure my Bash automation script is portable across POSIX sh?

To ensure Bash automation script portability across POSIX sh, distinguish Bash-only features from POSIX sh and apply shellcheck-compatible practices to maintain enforceable portability contracts and avoid non-compliant syntax.

When do I need to use trap cleanup in shell scripting?

You need trap cleanup in shell scripting when writing deployment or migration scripts that may be re-run, requiring resilient handling of partial execution, clean interrupt processing, and safe recovery from edge-case inputs.

How do heredocs work in Bash scripts for reliable automation?

Heredocs in Bash scripts work by providing literal or interpolated string blocks for reliable automation. Distinguishing between literal and interpolated heredocs ensures correct variable expansion and prevents command injection during script execution.