scripting-bash

scripting-bash is a skill for Claude Code, Codex from joaquimscosta/arkhe-claude-plugins. It costs 89 tokens per session (2,122 once invoked), scanned C, original, MIT.

A guide for writing defensive Bash shell scripts, which are scripts used to automate command-line tasks on systems such as Linux and macOS. It covers safer error handling, input checking, file operations, logging, testing, and CI/CD use.

In plain words
What is it for?
Use it when writing shell automation, system utilities, build scripts, or CI/CD scripts that need validation, cleanup, portability, and reliable failure handling.
Why use it?
It helps avoid scripts continuing after errors, mishandling files, or behaving differently across systems. It also provides practices for checking scripts and making them easier to test.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Use it when writing shell automation, system utilities, build scripts, or CI/CD scripts that need validation, cleanup, portability, and reliable failure handling.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/joaquimscosta/arkhe-claude-plugins/scripting-bash
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add joaquimscosta/arkhe-claude-plugins --skill scripting-bash
Clone the repo
git clone --depth 1 https://github.com/joaquimscosta/arkhe-claude-plugins

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for scripting-bash

README.md
[![agentmods](https://agentmods.dev/badge/skills/joaquimscosta/arkhe-claude-plugins/scripting-bash/github.svg)](https://agentmods.dev/skills/joaquimscosta/arkhe-claude-plugins/scripting-bash)
Your own site
<a href="https://agentmods.dev/skills/joaquimscosta/arkhe-claude-plugins/scripting-bash"><img src="https://agentmods.dev/badge/skills/joaquimscosta/arkhe-claude-plugins/scripting-bash/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for scripting-bash

Your own site · 80×15
<a href="https://agentmods.dev/skills/joaquimscosta/arkhe-claude-plugins/scripting-bash"><img src="https://agentmods.dev/badge/skills/joaquimscosta/arkhe-claude-plugins/scripting-bash.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 89 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,122 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00089 $0.02122
Opus 5.5 $0.00036 $0.00849
Sonnet 5.5 $0.00018 $0.00424
Haiku 4.5 $0.00009 $0.00212

Measured yesterday against content hash 2f6b2ed54d50, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

scripting-bash scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

[[ -n "${tmpdir:-}" ]] && rm -rf "$tmpdir"

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

for cmd in jq curl; do
plugins/lang/skills/scripting-bash/SKILL.md · 272 lines

How it starts

The opening of the file, as written. The whole thing — 272 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Bash Scripting Mastery

You are an expert in defensive Bash scripting for production environments. Create safe, portable, and testable shell scripts following modern best practices.

10 Focus Areas

  1. Defensive Programming - Strict error handling with proper exit codes and traps
  2. POSIX Compliance - Cross-platform portability (Linux, macOS, BSD variants)
  3. Safe Argument Parsing - Robust input validation and getopts usage
  4. Robust File Operations - Temporary resource management with cleanup traps
  5. Process Orchestration - Pipeline safety and subprocess management
  6. Production Logging - Structured logging with timestamps and verbosity levels
  7. Comprehensive Testing - bats-core/shellspec with TAP output
  8. Static Analysis - ShellCheck compliance and shfmt formatting
  9. Modern Bash 5.x - Latest features with version detection and fallbacks
  10. CI/CD Integration - Automation workflows and security scanning

Progressive Disclosure: For deep dives, see references/ directory.

Essential Defensive Patterns

1. Strict Mode Template

#!/usr/bin/env bash
set -Eeuo pipefail  # Exit on error, undefined vars, pipe failures
shopt -s inherit_errexit  # Bash 4.4+ better error propagation
IFS=$'\n\t'  # Prevent unwanted word splitting on spaces

# Error trap with context
trap 'echo "Error at line $LINENO: exit $?" >&2' ERR

# Cleanup trap for temporary resources
cleanup() {
  [[ -n "${tmpdir:-}" ]] && rm -rf "$tmpdir"
}
trap cleanup EXIT

2. Safe Variable Handling

# Quote all variable expansions
cp "$source_file" "$dest_dir"

# Required variables with error messages
: "${REQUIRED_VAR:?not set or empty}"

# Safe iteration over files (NEVER use for f in $(ls))
find . -name "*.txt" -print0 | while IFS= read -r -d '' file; do
  echo "Processing: $file"
done

# Binary-safe array population
readarray -d '' files < <(find . -print0)

3. Robust Argument Parsing

usage() {
  cat <<EOF
Usage: ${0##*/} [OPTIONS] <required-arg>

OPTIONS:
  -h, --help     Show this help message
  -v, --verbose  Enable verbose output
  -n, --dry-run  Dry run mode
EOF
}

# Parse arguments
while getopts "hvn-:" opt; do
  case "$opt" in
    h) usage; exit 0 ;;
    v) VERBOSE=1 ;;
    n) DRY_RUN=1 ;;
    -) # Long options
      case "$OPTARG" in
        help) usage; exit 0 ;;
        verbose) VERBOSE=1 ;;
        dry-run) DRY_RUN=1 ;;
        *) echo "Unknown option: --$OPTARG" >&2; exit 1 ;;
      esac
      ;;
    *) usage >&2; exit 1 ;;
  esac
done
shift $((OPTIND - 1))

Read the full file on GitHub · 272 lines

Files

What ships with it

6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 272 lines · 89 tokens per session scan C 2f6b2ed54d50

Subscribe to this mod's changes

scripting-bash is a skill published in the GitHub repository joaquimscosta/arkhe-claude-plugins (21 stars, last pushed yesterday), licensed MIT. It adds 89 tokens to every session and 2,122 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it C with 2 findings (recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-16.

Related

Other skills, from other repositories

test-writer

Generate comprehensive tests including unit, integration, and property-based tests.

kivo360/OmoiOS · 12 tokens

git-workflow

Git branching, commits, and PR workflow following GitFlow conventions.

kivo360/OmoiOS · 12 tokens

pm

Universal, project-agnostic PRODUCT MANAGER playbook — the scope-disciplined PM that plans a project, gates its launch, and says no. Five modes, one workflow each: prd (turn a spec or a user request into a build-ready PRD — objectives, in-scope, out-of-scope guards, an acceptance-criteria table mapping every success…

endorphin-ai/hasbrains-agent-kit · 310 tokens

forge-behavior

Manage dotforge v3 behavior governance — view status, toggle behaviors, adjust strictness. Use when the user asks about active behaviors, wants to disable one for the current session, or adjust escalation thresholds.

luiseiman/dotforge · 46 tokens

earnings-watch

Quick post-earnings analysis for portfolio holdings. Beat/miss, key metrics, thesis impact, estimate revision. Triggers on "earnings update", "quarterly results", "Q1/Q2/Q3/Q4 results", "post-earnings".

luiseiman/dotforge · 57 tokens

cross-cutting-checklist-generator

Detect when a concern is scattered across many places in a project (config keys, enums, translations, feature flags, API endpoints, doc references) and auto-generate a project-local checklist so that same concern is never partially updated again. Use whenever you add or change something that also exists in several…

Marcel-Bich/marcel-bich-claude-marketplace · 94 tokens