shell-scripting

shell-scripting is a skill for Claude Code, Codex from tmj-90/gaffer. It costs 121 tokens per session (2,160 once invoked), scanned C, original, Apache-2.0.

A guide to writing safer shell scripts, which are command files used for automation on systems such as macOS and Linux. It covers failure handling, quoted arguments, temporary-file cleanup, portability, and shell checking.

In plain words
What is it for?
Use it when adding or changing Bash automation, CI steps, installation or release scripts, Git hooks, or Makefile recipes.
Why use it?
Shell scripts can fail quietly or corrupt data when variables are empty, filenames contain spaces, or commands differ between operating systems. These practices make failures visible and behaviour more consistent.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when adding or changing Bash automation, CI steps, installation or release scripts, Git hooks, or Makefile recipes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tmj-90/gaffer/shell-scripting
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 tmj-90/gaffer --skill shell-scripting
Clone the repo
git clone --depth 1 https://github.com/tmj-90/gaffer

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 shell-scripting

README.md
[![agentmods](https://agentmods.dev/badge/skills/tmj-90/gaffer/shell-scripting/github.svg)](https://agentmods.dev/skills/tmj-90/gaffer/shell-scripting)
Your own site
<a href="https://agentmods.dev/skills/tmj-90/gaffer/shell-scripting"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/shell-scripting/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 shell-scripting

Your own site · 80×15
<a href="https://agentmods.dev/skills/tmj-90/gaffer/shell-scripting"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/shell-scripting.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 121 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,160 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.00121 $0.02160
Opus 5.5 $0.00048 $0.00864
Sonnet 5.5 $0.00024 $0.00432
Haiku 4.5 $0.00012 $0.00216

Measured 16d ago against content hash ab5232d752b3, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

shell-scripting 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 16d ago.

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.

`rm -rf`: put such logic inside the script or its test file and run that.

Makes network callslowCapability

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

`cd "$dir" || exit`; `curl -fsSL` so HTTP errors fail.
runner/skills/shell-scripting/SKILL.md · 121 lines

How it starts

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

Write safe, portable shell

Shell is where quiet failures live: an unset variable expands to nothing, a failed command inside a condition is ignored, a filename with a space becomes two arguments, and two runs share one temp file. For the builder and the reviewer of a shell diff; the repo's existing scripts win over it.

Procedure

  1. Discover the repo's conventions first. Call search_lore and read the existing scripts: the shebang (#!/usr/bin/env bash vs POSIX #!/bin/sh), the strict-mode line, sourced helper libraries, logging helpers, .shellcheckrc, .editorconfig (shfmt reads indentation from it), the test harness (bats, or the repo's test/*.test.sh pattern) and which OSes CI runs. macOS ships bash 3.2: no associative arrays, mapfile, ${var,,}, and "${arr[@]}" on an empty array fails under set -u before bash 4.4. Match the repo; do not introduce a second style.
  2. Decide it should be shell at all. Google's guide: past ~100 lines, or with non-trivial data structures, write it in the repo's main language instead.
  3. Write the change with the idioms below, then walk the failure section for every pipeline, condition, temp file and background job.
  4. Test each acceptance criterion's own behaviour. Run the script against a fixture directory and assert exit code, output and side effects, including one failure case (missing input, failing dependency) that must exit non-zero. If the script can run concurrently (CI jobs, cron, hooks), start two copies at once and assert neither corrupts the other's output.
  5. Verify, then stop. Done when: bash -n passes, shellcheck -x is clean at the repo's severity (each disable has a code and reason), shfmt shows no diff if the repo uses it, the tests pass, and every AC has a test. Record the output with the record-evidence skill; the runner submits the work.

Commands

  • Syntax: bash -n script.sh (sh -n for POSIX scripts).
  • Lint: shellcheck -x script.sh (add -S warning or the repo's severity; -s sh for POSIX).
  • Format: shfmt -d . when the repo uses shfmt.
  • Tests: bats test/ or the repo's bash runner/test/x.test.sh pattern.
  • In your own Bash tool calls (not the script), the safety hook blocks $(…) or backticks combined with a read tool (grep, cat, sort, head, cp…) and any rm -rf: put such logic inside the script or its test file and run that.

Read the full file on GitHub · 121 lines

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. 16d ago Changed · +53 lines · +31 tokens per session scan A → C ab5232d752b3
  2. 19d ago First seen · 68 lines · 90 tokens per session scan A 349374d43ba4

Subscribe to this mod's changes

shell-scripting is a skill published in the GitHub repository tmj-90/gaffer (2 stars, last pushed 17d ago), licensed Apache-2.0. It adds 121 tokens to every session and 2,160 once invoked, about $0.0005 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-09-28.

Related

Other skills, from other repositories

agent-github-modes

Agent skill for github-modes - invoke with $agent-github-modes.

ruvnet/ruflo · 21 tokens

release-engineering

Plan and verify software releases with versioning, changelogs, release branches, feature flags, canaries, migration gates, rollback, deployment checks, and release readiness. Use when preparing a release, shipping a risky PR, coordinating app/backend/database rollout, recovering from a bad deploy, or defining release…

majiayu000/spellbook · 69 tokens

land-and-deploy

Merge PR, wait for CI, verify deploy, run canary. The complete landing pipeline.

FlorianBruniaux/claude-code-ultimate-guide · 24 tokens

ci-cd-pipeline-authoring

Use when a repository needs CI/CD - author GitHub Actions workflows so TaskTrooper's pipeline auto-detects your validate/build/test jobs and stage/preprod/prod deploys, and so a dispatch delivery profile can dispatch the production deploy.

makifbaysal/tasktrooper · 56 tokens

pipeline-digest

Daily release-pipeline digest with a change gate — reports which plugins are pending release, whether main's CI is green, and which branches went stale, and notifies the operator only when that state actually moved since the last run. Use when the operator asks "what moved in the pipeline", "anything to ship"…

gtapps/hermitd · 99 tokens

ci-cd-ops

CI/CD pipeline patterns with GitHub Actions, release automation, and testing strategies. Use for: github actions, workflow, CI, CD, pipeline, deploy, release, semantic release, changesets, goreleaser, matrix, cache, secrets, environment, artifact, reusable workflow, composite action.

0xDarkMatter/claude-mods · 66 tokens