linux-bash-scripting

linux-bash-scripting is a skill for Claude Code, Codex from iliaal/ai-skills. It costs 44 tokens per session (3,172 once invoked), scanned C, original, MIT.

A set of instructions for writing defensive Bash scripts on Linux. Bash is a command-line scripting language; ShellCheck checks scripts for common problems, and shfmt checks their formatting.

In plain words
What is it for?
Use it when creating Linux Bash scripts, scheduled cron jobs, or command-line tools, including argument parsing and production scripts.
Why use it?
It helps avoid unsafe shell behavior, unreliable file paths, weak error handling, and script-quality warnings.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/iliaal/ai-skills/linux-bash-scripting
Any agent
npx skills add iliaal/ai-skills --skill linux-bash-scripting
Clone the repo
git clone --depth 1 https://github.com/iliaal/ai-skills

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 linux-bash-scripting

README.md
[![agentmods](https://agentmods.dev/badge/skills/iliaal/ai-skills/linux-bash-scripting.svg)](https://agentmods.dev/skills/iliaal/ai-skills/linux-bash-scripting)
Your own site
<a href="https://agentmods.dev/skills/iliaal/ai-skills/linux-bash-scripting"><img src="https://agentmods.dev/badge/skills/iliaal/ai-skills/linux-bash-scripting.svg" alt="Measured on agentmods" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,172 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 2 findings. Scan, not verified.
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 $0.00044 $0.03172
Opus 5 $0.00022 $0.01586
Sonnet 5 $0.00009 $0.00634
Haiku 4.5 $0.00004 $0.00317

Measured 4d ago against content hash ecc2540b1a44, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

linux-bash-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 4d 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.

trap 'rm -rf -- "${_tmpdir:-}"' EXIT

Makes network callslowCapability

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

require jq; require curl
skills/linux-bash-scripting/SKILL.md · 197 lines

How it starts

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

Linux Bash Scripting

Produce bash scripts that pass shellcheck --enable=all and shfmt -d with zero warnings.

Target: GNU Bash 4.4+ on Linux. No macOS/BSD workarounds, no Windows paths, no POSIX-only restrictions.

Script Foundation

#!/usr/bin/env bash
set -Eeuo pipefail
shopt -s inherit_errexit

readonly SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"

trap 'printf "Error at %s:%d\n" "${BASH_SOURCE[0]}" "$LINENO" >&2' ERR
trap 'rm -rf -- "${_tmpdir:-}"' EXIT
  • -E propagates ERR traps into functions
  • inherit_errexit propagates errexit into $() command substitutions
  • Resolve the script's own data files against SCRIPT_DIR, never the caller's cwd or git rev-parse --show-toplevel. A shared linter invoked from another project's git hook, a cron job, or a wrapper runs with someone else's cwd, so a caller-relative rules path resolves to a file that does not exist: the rule set loads empty, zero violations are found, exit 0. It is a silent no-op, not an error, and running it from inside its own repo passes for the wrong reason. Exercise it once from a scratch directory that is not the script's own tree
  • Always create temp dirs under the EXIT trap: _tmpdir=$(mktemp -d)
  • Wrap body in main() { ... } with source guard: [[ "${BASH_SOURCE[0]}" == "$0" ]] && main "$@" -- enables sourcing for testing

Core Rules

  • Quote every expansion: "$var", "$(cmd)", "${array[@]}"
  • local for function variables, local -r for function constants, readonly for script constants
  • printf '%s\n' over echo -- predictable behavior, no flag interpretation
  • [[ ]] for conditionals; (( )) for arithmetic; $() over backticks
  • End options with --: rm -rf -- "$path", grep -- "$pattern" "$file"
  • Require env vars: : "${VAR:?must be set}"
  • Never eval user input; build commands as arrays: cmd=("grep" "--" "$pat" "$f"); "${cmd[@]}"
  • Keep untrusted/derived bytes off the command line: never build a heredoc body or an sh -c string from external data. An unquoted <<EOF command-substitutes $(...)/backticks in the content, and even a quoted <<'EOF' breaks if a content line equals the delimiter (the heredoc ends early and the rest runs as shell). Write the data to a file with a non-shell writer and have the consumer read the file
  • Allowlisting a command? Match the whole command against an anchored pattern (^…$), never inspect individual arguments — shell operators (;, &&, |, #, newline) smuggle a second command past a per-argument check (rm -rf node_modules; rm -rf /). Unrecognized syntax must fail closed to deny/ask
  • Validate a numeric before it reaches (( )) or $(( )) when it came from a file, env var, or command output rather than a literal. Two distinct failures: (1) command execution -- arithmetic evaluates an array subscript, so a value of a[$(cmd)] runs cmd (a bare $(cmd) is only a syntax error, so testing that form will wrongly suggest the trap isn't real); (2) octal abort -- a leading zero makes 08 base-8 and $(( v + 1 )) dies with value too great for base, taking the script down under set -e. Gate on [[ "$v" =~ ^-?[0-9]+$ ]] first, then force base 10 with $(( 10#$v )) for zero-padded input
  • Separate local from assignment to preserve exit codes: local val; val=$(cmd)
  • Debug tracing: PS4='+${BASH_SOURCE[0]}:${LINENO}: ' with bash -x -- shows file:line per command
  • Named exit codes: readonly EX_USAGE=64 EX_CONFIG=78 -- no magic numbers in exit
  • Pipeline diagnostics: "${PIPESTATUS[@]}" shows exit code of each pipe stage, not just last failure
  • Branch on a probe's exact exit status, not on nonzero-versus-zero. A tool that exits 2 for "ran, found nothing" and 128 for "could not run" collapses into a single negative under if ! cmd, and stderr is often empty for both. Treating every silent nonzero as "absent" converts a network, permission, or spawn failure into a confident false diagnosis
  • A || B is a fallback only when A fails on the case B exists for. When A succeeds while doing the wrong thing -- resolving a different tool, default, or directory -- B is dead code and the wrong behavior is silent. Same trap in ${VAR:-default} on a path two processes must agree on: whoever lacks VAR gets a different location, the two silently stop sharing state, and neither errors. Pick one resolution and fail loudly when it is unavailable

Read the full file on GitHub · 197 lines

Files

What ships with it

1 file 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. 4d ago First seen · 197 lines · 44 tokens per session scan C ecc2540b1a44

Subscribe to this mod's changes

linux-bash-scripting is a skill published in the GitHub repository iliaal/ai-skills (40 stars, last pushed 5d ago), licensed MIT. It adds 44 tokens to every session and 3,172 once invoked, about $0.0002 per session on Opus 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-08-30.

Related

Other skills, from other repositories

narrative-text-visualization

Generate structured narrative text visualizations from data using T8 Syntax. Use when users want to create data interpretation reports, summaries, or structured articles with semantic entity annotations. T8 is designed for unstructured data visualization where T stands for Text and 8 represents a byte of 8 bits…

antvis/chart-visualization-skills · 74 tokens

gpt-vis

推荐并生成合适的数据可视化图表,使用 GPT-Vis 库。支持两种输出模式:(1)语法模式——生成 Syntax 或 JSON 配置;(2)代码模式——生成完整的运行代码。支持 26 种图表类型。.

antvis/chart-visualization-skills · 63 tokens

antv-x6-editor

Use this skill whenever the user wants to create, customize, or troubleshoot X6 v3 graph editor diagrams. Triggers include: any mention of 'X6', 'antv x6', '@antv/x6', 'X6 editor', 'X6 图编辑', '流程图', 'DAG', 'ER图', '实体关系图', '血缘图', '组织架构图', 'UML类图', 'flowchart', 'DAG diagram', 'ER diagram', 'lineage graph', 'org chart'…

antvis/chart-visualization-skills · 253 tokens

infographic-creator

Create beautiful infographics based on given text content. Use when users request to create infographics.

antvis/chart-visualization-skills · 24 tokens

antv-g2-chart

Use this skill whenever the user wants to create, customize, or troubleshoot G2 v5 chart visualizations. Triggers include: any mention of 'G2', 'antv g2', '@antv/g2', 'G2 chart', 'G2 可视化', or requests to produce charts like bar charts (柱状图), line charts (折线图), pie charts (饼图), scatter plots (散点图), area charts (面积图)…

antvis/chart-visualization-skills · 230 tokens

review-spd

Findings-first code review workflow for AI coding agents. Use when the user asks to review uncommitted changes, commits in a date range, or a branch compared to the main branch / PR-style diff. Focuses on bugs, regressions, correctness risks, missing tests, security/data-safety issues, and other behavior-changing…

zhu1090093659/spec_driven_develop · 72 tokens