Agent definitionsReviewed · Seth Hobson (wshobson)

bash-pro: defensive Bash scripting agent definition

bash-pro is a Markdown agent definition, which is a reusable system prompt. It tells an AI coding assistant to write defensive, portable, testable Bash scripts and is aimed at developers and operators who automate with shell. It covers strict mode, quoting, traps, argument parsing, ShellCheck, shfmt, Bats testing, CI/CD wiring and security scanning. It includes many short Bash snippets and a sample CI command chain, and its front matter names the model as sonnet. Its main catch is that it is a very long checklist with no overall priority order, its behaviour is untested, and a few snippets and reference labels need checking. There is no complete end-to-end worked example.

Researched 12 Nov 2026

In short.

bash-pro is a single Markdown agent definition. It tells an AI coding assistant to write defensive, portable, testable Bash for automation, CI/CD and system utilities. It suits developers and operators who want an assistant to follow consistent shell-scripting habits. Its main catch is that it is a long checklist with no overall prioritised procedure, and a few snippets and reference labels need checking. There is no complete end-to-end worked example, although the file includes many short Bash snippets and an example CI command chain (shellcheck *.sh && shfmt -d *.sh && bats test/). The file starts with YAML front matter: name: bash-pro, a one-line description and model: sonnet. After that come bullet-list sections on focus areas, approach, portability, readability, safety, performance, documentation, Bash 5.x features, CI/CD, security scanning, observability, a quality checklist, expected outputs, essential tools, pitfalls, dependency management, advanced techniques and reference links. The repository root has an MIT licence notice. The agent was not installed or run and no generated script was checked, so how well it works in practice is unknown.

Researched and written by an AI model and checked by a second AI model. How it works

The review covers exactly one file, plugins/shell-scripting/agents/bash-pro.md at commit 9c61ab243def98f72da12abd41cfcf5bcd91af9d, read in full. It also covers the repository's root LICENSE (MIT) as the related licence notice. Everything else in the repository is excluded, including the shell-scripting plugin manifest, other agents and the external pages linked from the file. The agent was not installed, run or tested, so its behaviour, output quality and host compatibility have not been assessed. Facts about Bash feature history, the time -v option, platform availability and linked projects go beyond the file's text and are treated as unknown.

The overview

What this resource is

The resource is the file plugins/shell-scripting/agents/bash-pro.md in the GitHub repository wshobson/agents, as it stood at commit 9c61ab243def98f72da12abd41cfcf5bcd91af9d. Its public address is [https://github.com/wshobson/agents/blob/main/plugins/shell-scripting/agents/bash-pro.md]. The file is 17,729 bytes of Markdown.

It is an agent definition, meaning a named, reusable set of instructions for an AI coding assistant. The front matter has three fields. The name is bash-pro. The description reads: Master of defensive Bash scripting for production automation, CI/CD pipelines, and system utilities, with an emphasis on safe, portable and testable shell scripts. The model is sonnet. The path suggests the file belongs to a plugin called shell-scripting, but that plugin's manifest is not in the evidence, so how the plugin is packaged is unknown.

The copyright line in the repository licence names Seth Hobson (2024). The file itself has no author or version header.

Overall assessment

Judged on the text alone, this is a large collection of defensive Bash practices. It covers strict mode, quoting every expansion, mktemp with cleanup traps, NUL-safe file handling, getopts parsing, ShellCheck and shfmt, Bats tests and CI integration. It links to references it calls the Google Shell Style Guide, Bash Pitfalls and ShellCheck, among others. Those pages were not reviewed, so whether the file's advice matches them is unknown.

The weaknesses are in its structure and in a few details. It is one long list of bullets with no overall prioritised procedure and no complete end-to-end worked example. It does give some specific guidance on portability conflicts. It says to use [[ ]] for Bash conditionals but fall back to [ ] when POSIX compliance is needed. It says to avoid bashisms when POSIX compliance is required and to document Bash-specific features when they are used. It also says to provide fallback implementations for platform-specific features. What it lacks is a general way to weigh competing goals, such as how much testing, CI and packaging a small script deserves. It also lists a wide range of deliverables, including man pages, Homebrew formulas, deb/rpm specs, container images and benchmarks. That could push an assistant to produce far more than a simple request needs. Several snippets and reference labels need checking; see the limitations section.

Nothing was executed, so how well it works is unknown. Treat it as a reasonable starting prompt that a team should read, trim and adapt, not as a verified, drop-in expert.

Who it is for

The description names the target audience: people writing production automation, CI/CD pipeline scripts and system utilities in Bash. In practice that means developers, DevOps and platform engineers, and system administrators. They would use an AI assistant to draft or review shell scripts and want it to use defensive habits by default.

Beginners can benefit, because the file tells the assistant to quote variables, validate input, avoid unsafe patterns such as for f in $(ls), and add --help output. But the file is dense and assumes you know terms like word splitting, traps and process substitution. A beginner should still ask the assistant to explain its choices and should run ShellCheck on the result.

It is a poor fit for people who write in other shells or languages, such as zsh, fish, PowerShell or Python, or who must target pure POSIX sh only. Most of the guidance and snippets are specific to Bash.

What it tells the assistant to do

The body groups its guidance into sections. The Approach and Safety sections cover set -Eeuo pipefail with error traps, shopt -s inherit_errexit, IFS=$'\n\t', quoting, arrays instead of word-split strings, and printf instead of echo. They also cover mktemp with EXIT traps, using -- to end option parsing, never using eval on user input, a restrictive umask for sensitive files, timeouts on external commands, and required-variable checks with : "${VAR:?message}".

The Compatibility section covers the #!/usr/bin/env bash shebang, version checks, checking that commands exist, GNU versus BSD differences such as sed -i, and platform detection with uname. It also says to use [ ] when POSIX compliance is required, avoid bashisms in that case, and provide fallbacks for platform-specific features. Other sections cover readability conventions such as naming and keeping functions under 50 lines, and documentation such as --help, --version, documented exit codes, shdoc and shellman. They also cover performance habits such as using builtins instead of external commands, mapfile and xargs -P. Logging and observability cover log levels, JSON logs, logger for syslog and Prometheus-format metrics. Dependency handling covers vendoring, checksums and version pinning.

For tooling and delivery, the file names ShellCheck (with enable=all), shfmt, checkbashisms, Semgrep, CodeQL, gitleaks, Actionlint, pre-commit, bats-core, shellspec, shunit2 and bashly. It also gives an example workflow command chain: shellcheck *.sh && shfmt -d *.sh && bats test/. The Output section lists what the assistant should produce: scripts, test suites, CI configs, documentation, static-analysis config files, security review output, migration guides and packaging files.

The file does not tell the assistant to ask clarifying questions or to match the amount of work to the request.

Using it

What you need to use it

The file does not name a host application. Its layout, YAML front matter with name, description and model followed by a Markdown body, looks like the agent or subagent definitions used by some AI coding tools. The file does not say which tools support it, so the evidence does not establish compatibility with any specific product.

The front matter sets model: sonnet. The evidence does not say whether this is a required model, a default, or an alias that a host maps to a particular version. There is no tools field, and the file says nothing about what access the agent should have, such as reading files, running shell commands or using the network. What happens when that field is missing depends on the host and is not stated here.

To follow the advice fully, you would also need the tools it names, such as ShellCheck, shfmt and bats-core, and a Bash version that supports the features you use. The file recommends Bash 4.4+ for several features and Bash 5.x for others.

How it works

This is an instruction document containing shell code examples, rather than a standalone executable implementation. Its effect comes entirely from instructions that a language model reads.

How a host uses it is not established here. One possibility is that a host which supports this format shows the description to a main assistant, which uses it to decide whether to hand a task to this agent. Another possibility is that the host loads the Markdown body as the agent's standing instructions. The captured file does not identify a compatible host, and it does not describe how any host loads, delegates to or installs it. These are unverified possibilities, not behaviour the evidence demonstrates.

Because the file is prompt text, an assistant may not follow it fully. It may follow some rules and skip others, and the many parallel bullets have no overall priority order. Running ShellCheck, shfmt and Bats tests, as the file recommends, can check some properties of generated scripts. Those tools cannot confirm every requirement in the file, such as documentation content, design conventions or portability across all target platforms. Those parts need human review and testing on each target platform.

Setup

The evidence has no install instructions, README or plugin manifest, so the setup steps are unknown. One possible approach, not verified here, is to put the Markdown file wherever your assistant looks for agent definitions. Another is to install the shell-scripting plugin that the file path suggests contains it. You would then ask the assistant to delegate shell-scripting work to it. The captured file does not establish whether any particular tool supports this file, where the file should go, or how plugin installation works. Check your tool's own documentation.

Before adopting it, read the whole file and delete sections you do not want, such as packaging or Prometheus metrics. Correct the version-check snippets described under limitations, and decide which Bash versions and operating systems your scripts must support.

Illustrative example

The file contains many short Bash snippets and an example CI command chain, but no complete end-to-end worked example or sample output, and the agent was not run. The skeleton below was put together by hand from patterns the file lists: strict mode, inherit_errexit, IFS, a safe temporary directory with an EXIT trap, and rm -rf with --. It shows the style the instructions push toward. It is not output produced by the agent: #!/usr/bin/env bash set -Eeuo pipefail shopt -s inherit_errexit IFS=$'\n\t' tmpdir="" cleanup() { if [[ -n "$tmpdir" ]]; then rm -rf -- "$tmpdir"; fi; } trap cleanup EXIT tmpdir=$(mktemp -d) || exit 1

A realistic request would be: Write a Bash script that rotates logs in a directory, supports --dry-run and --help, and works on Linux and macOS. Going by the file, a good answer would include argument parsing with usage text, a dry-run mode, checks for required commands, handling of GNU versus BSD tool differences, and a Bats test file. Whether the agent actually does all of that is unknown. To judge its output, run ShellCheck, shfmt and the tests, and also review the result by hand.

Assessment & evidence

Limitations and things to check

Version checks in the text. The portability section suggests (( BASH_VERSINFO[0] >= 4 && BASH_VERSINFO[1] >= 4 )) as a test for Bash 4.4 or newer. Read literally, it requires a minor version of 4 or more whatever the major version is, so it would wrongly reject Bash 5.0, 5.1 and 5.2. The Modern Bash Features section's test for 5.2 is [[ ${BASH_VERSINFO[0]} -ge 5 && ${BASH_VERSINFO[1]} -ge 2 ]]. It correctly accepts 5.2 and rejects 5.0 and 5.1. But it would wrongly reject a later major version whose minor number is below 2, for example a hypothetical 6.0 or 6.1. Correct each comparison for its own minimum version instead of copying either unchanged.

Version attributions. The Modern Bash Features section links features to Bash versions: ${var@U} and ${var@L} to 5.0, varredir_close and EPOCHREALTIME to 5.2, and several ${parameter@...} operators to 4.4. The captured material does not establish when any of these features were introduced, so these links are unverified. Check them against the official Bash release notes before relying on them. The section stops at Bash 5.2.

Other snippets and references. The Performance Profiling item suggests time -v for detailed resource usage but does not say which time command provides that option. Whether it works as written in a Bash script, and whether it is available on macOS or other target platforms, is unknown, so test it on each platform before relying on it. The reference labelled Bash Security Best Practices points to [https://github.com/carlospolop/PEASS-ng], and the project name in the address does not obviously match the label. The linked pages were not reviewed, so what that project covers is unknown. Confirm what each link points to before using it. The file also advises long-form options such as --verbose for clarity but does not say whether every tool on each target platform accepts long-form options. Check this for your platforms.

Scope and design gaps. There is no complete end-to-end worked example and no overall prioritised procedure for applying the many rules. The file handles some conflicts directly: POSIX conditionals when needed, avoiding bashisms for POSIX compliance, documenting Bash-specific features, and platform fallbacks. It does not say how to weigh other conflicts, such as keeping a script minimal versus adding a full set of tests, CI configuration and packaging. It does not say when another language would be a better choice, and it does not say what the agent may run or modify. The tool list includes names such as bashing and shellman whose maintenance, licences and suitability were not checked. Nothing was run, so output quality, speed and failure modes are unknown.

Reasoning behind the assessment

The assessment is based on reading the full text of the agent file and the licence notice. The core guidance is consistent across several sections: quote expansions, use traps for cleanup, avoid for f in $(ls), use NUL separators, lint with ShellCheck and test with Bats. That supports calling the file a reasonable starting point. The file cites outside references, but those were not reviewed, so this review does not claim the file agrees with them.

The caution comes from details in the text itself. The 4.4+ version check would wrongly reject Bash 5.0 to 5.2. The 5.2+ check correctly accepts 5.2 and rejects 5.0 and 5.1, but would wrongly reject a later major version with a minor number below 2. The bullets have no overall priority order, although some specific POSIX and platform conflicts are addressed.

Some points depend on facts outside the captured material and remain unknown: when the listed Bash features were introduced, how time -v behaves in Bash and on macOS, and what the PEASS-ng project contains. They are listed as things to check, not as established findings.

Because nothing was executed, there is no evidence on whether an assistant given this prompt writes better scripts than one without it. That question remains open.

Alternatives

Use the tools the file recommends directly: ShellCheck for static analysis, shfmt for formatting and bats-core for testing. How using these tools on their own compares with using this agent is unknown.

Use a general-purpose coding assistant with your own short project instruction file that lists only the Bash rules your team cares about, for example strict mode, quoting, a clean ShellCheck result and Bats tests. A shorter file would take up less context and would leave out the broad list of deliverables. Whether it produces better or worse scripts is unknown.

For human-readable conventions, follow a published style guide such as the Google Shell Style Guide, which the file itself cites. Other agents in the same repository may cover related areas, but they were not reviewed here.

Evidence base

Two items were read in full. The first is plugins/shell-scripting/agents/bash-pro.md at commit 9c61ab243def98f72da12abd41cfcf5bcd91af9d: 17,729 bytes, SHA-256 640c8e4f162c6cc72763a300ff90abb56eb9bf450ef186407e83ae9c89deb791, git blob bf62a83b1209c689ed3b03fc265c9c1a7373c7eb. The second is the root LICENSE file at the same commit: 1,068 bytes, SHA-256 f89abb55d9f073f38f1703e4518f0613c788c6174be7f13b8dfe48a1c076c746.

Not read: the rest of the repository, the shell-scripting plugin manifest or README, other agent files, the linked external pages, commit history, issues and user feedback. Nothing was installed or executed, so there are no test results, benchmarks or sample outputs.

Access & freshness

Costs

The evidence shows no price for the file, and the licence grants use free of charge. Any cost of running it depends on the assistant and model you use, which the evidence does not state. The front matter asks for model: sonnet, but pricing, plan requirements and usage limits for that model or for any host tool are unknown.

Context size is a likely cost. The file is 17,729 bytes. If a host loads the whole body as instructions each time the agent is used, it would take up part of the model's context window and add to any per-token charges. The token count was not measured.

The instructions also steer toward large deliverables such as tests, CI configs and documentation, which could make responses longer and slower. Trimming the file might reduce that, but this has not been measured, and actual costs and timing are unknown.

Rights and licence

The repository licence notice at the same commit is the MIT License, with the line Copyright (c) 2024 Seth Hobson. It grants permission, free of charge, to use, copy, modify, merge, publish, distribute, sublicense and sell copies of the software and associated documentation files. It requires the copyright notice and permission notice to be included in all copies or substantial portions. It provides the software as is, without warranty, and disclaims liability.

The agent file has no licence header of its own, so its rights come from the repository-level notice. The file also names and links to third-party tools and documents, such as ShellCheck, shfmt, bats-core, Semgrep and CodeQL. Those have their own licences and terms, which were not reviewed. If you redistribute the file, keep the copyright and permission notice with it.

Freshness

The text was read as published at commit 9c61ab243def98f72da12abd41cfcf5bcd91af9d and retrieved on 12 November 2026. The commit date, release tags, change history and the maintainer's update plans are not in the evidence, so when the file was written or last revised is unknown. The licence gives 2024 as the copyright year for the repository, which says nothing about when this particular file last changed.

The newest Bash version the file describes is 5.2. It recommends tools such as bats-core and ShellCheck without version numbers. Later Bash releases and tool changes are not covered. The public address contains main, so it shows the latest state of that branch, which may differ from the commit reviewed here.

Suggested actions

Before use: read the whole file and remove sections you do not need, such as packaging, Prometheus metrics and man pages. Correct each version check for its own minimum version. For a 4.4-or-newer check, compare the major version first, for example (( BASH_VERSINFO[0] > 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] >= 4) )), so that Bash 5.0 to 5.2 are accepted. For a 5.2-or-newer check, use the same shape with 5 and 2, for example (( BASH_VERSINFO[0] > 5 || (BASH_VERSINFO[0] == 5 && BASH_VERSINFO[1] >= 2) )), so that a later major version is not rejected. Check any version-specific feature you plan to rely on against the official Bash release notes, test time -v on your target platforms, and open the reference links yourself before trusting their labels.

When using it: state your target platforms and Bash version in each request, and ask for dry-run modes and test files only when you need them. Run ShellCheck, shfmt and your Bats tests on every generated script. Also review documentation, design choices and portability by hand, because those tools cannot check everything the file asks for. Review anything that deletes files, uses sudo or touches the network before running it.

If you adopt it for a team: keep the MIT notice with any copy, and consider keeping a shorter in-house version that records the rules you actually enforce in CI.

Evidence for this report

LICENSEnotice · checked 2026-11-12
plugins/shell-scripting/agents/bash-pro.mdselected · checked 2026-11-12