bash

A command mode for creating, changing, or reviewing Bash scripts. Bash is a command-line scripting language commonly used on Linux and macOS.

In plain words
What is it for?
Use it to write new shell scripts, modify existing scripts, or review scripts for common reliability and security problems.
Why use it?
It gives script work consistent safety rules, such as quoting paths, avoiding unsafe command evaluation, protecting secrets, and cleaning up temporary files.

Command

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 commands/d-padmanabhan/agent-engineering-handbook/bash
Clone the repo
git clone --depth 1 https://github.com/d-padmanabhan/agent-engineering-handbook
Per session 14 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 735 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00014 $0.00735
Opus 5 $0.00007 $0.00367
Sonnet 5 $0.00003 $0.00147
Haiku 4.5 $0.00001 $0.00073

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

Security

Grade A, and why

bash scanned grade A with 1 finding 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 2d 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.

Makes network callslowCapability

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

- **Network calls**: if using `curl`, apply the `140-bash.mdc` “Curl in scripts” baseline (timeouts + retries).
commands/bash.md · 89 lines

How it starts

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

BASH MODE ACTIVATED

You are now in BASH MODE. Any work on Bash scripts MUST follow:

  • rules/140-bash.mdc (Bash Engineering Ruleset)
  • rules/100-core.mdc (minimal, secure, production-ready)
  • rules/310-security.mdc (no secrets, OWASP-minded)

This command is used when the user asks Cursor to:

  • Generate a new Bash script
  • Modify an existing Bash script
  • Review an existing Bash script

Guardrails (mandatory)

  • No secrets: never add tokens/keys/passwords to scripts or examples.
  • Quoting: quote variables and paths ("${var}"), unless word splitting is explicitly intended.
  • No eval with user input.
  • No parsing ls output.
  • Safe temp files: prefer mktemp + trap cleanup.
  • Network calls: if using curl, apply the 140-bash.mdc “Curl in scripts” baseline (timeouts + retries).
  • Examples: use acme.com domains for examples.

Step 0: Determine intent (create vs modify vs review)

Infer intent from the user’s request. If ambiguous, ask ≤3 clarifying questions that materially change the implementation (e.g., target OS, required inputs/outputs, whether retries are expected).

Create: generate a new script

Produce a complete, runnable script (no TODO stubs) with:

  • Shebang: #!/usr/bin/env bash (default)
  • Safety mode: choose and justify set -euo pipefail vs set -uo pipefail
  • main() entrypoint + usage() (when args are non-trivial)
  • Dependency checks: command -v
  • Logging helper (UTC timestamps) to stderr
  • Structured error handling (traps) when warranted
  • shellcheck-clean, shfmt-formatted output

If the script talks to an HTTP API:

  • Use the curl baseline options pattern from rules/140-bash.mdc
  • Do not log auth headers/tokens

Modify: change an existing script

Follow “minimal diff” discipline:

  • Preserve behavior unless the user asked to change it
  • Don’t refactor unrelated parts
  • Keep changes localized and reversible
  • If changing error-handling mode, explain why

Read the full file on GitHub · 89 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. 2d ago First seen · 89 lines · 14 tokens per session scan A 3f641a2187e8

Subscribe to this mod's changes

bash is a command published in the GitHub repository d-padmanabhan/agent-engineering-handbook (15 stars, last pushed 2d ago), licensed MIT. It adds 14 tokens to every session and 735 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.