Bats Shell Testing Patterns
wshobson/agents
Writes unit tests for shell scripts with Bats: error-condition tests, fixtures and mocks, cross-shell checks, parallel runs, helper files and CI integration.
Writes unit tests (for lib/.sh-style helpers) or mocked end-to-end tests (for executable scripts) using bats, and runs task tests:bash/tests:coverage.
$ npx skills add agntcy/coffeeAgntcy --skill testing-bash-scripts -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install agntcy/coffeeAgntcy testing-bash-scripts --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/agntcy/coffeeAgntcy.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/quality-checks/testing-bash-scripts .claude/skills/testing-bash-scripts && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "testing-bash-scripts" agent skill from https://github.com/agntcy/coffeeAgntcy/tree/main/.agents/skills/quality-checks/testing-bash-scripts into .claude/skills/testing-bash-scripts/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "testing-bash-scripts", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/agntcy/coffeeAgntcy/tree/main/.agents/skills/quality-checks/testing-bash-scriptsType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add agntcy/coffeeAgntcy --skill testing-bash-scripts -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install agntcy/coffeeAgntcy testing-bash-scripts --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/agntcy/coffeeAgntcy.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/quality-checks/testing-bash-scripts .agents/skills/testing-bash-scripts && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "testing-bash-scripts" agent skill from https://github.com/agntcy/coffeeAgntcy/tree/main/.agents/skills/quality-checks/testing-bash-scripts into .agents/skills/testing-bash-scripts/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "testing-bash-scripts", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add agntcy/coffeeAgntcy --skill testing-bash-scripts -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install agntcy/coffeeAgntcy testing-bash-scripts --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/agntcy/coffeeAgntcy.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/quality-checks/testing-bash-scripts .cursor/skills/testing-bash-scripts && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "testing-bash-scripts" agent skill from https://github.com/agntcy/coffeeAgntcy/tree/main/.agents/skills/quality-checks/testing-bash-scripts into .cursor/skills/testing-bash-scripts/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "testing-bash-scripts", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/agntcy/coffeeAgntcy.git --path .agents/skills/quality-checks/testing-bash-scripts--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add agntcy/coffeeAgntcy --skill testing-bash-scripts -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install agntcy/coffeeAgntcy testing-bash-scripts --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/agntcy/coffeeAgntcy.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/quality-checks/testing-bash-scripts .gemini/skills/testing-bash-scripts && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "testing-bash-scripts" agent skill from https://github.com/agntcy/coffeeAgntcy/tree/main/.agents/skills/quality-checks/testing-bash-scripts into .gemini/skills/testing-bash-scripts/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "testing-bash-scripts", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install agntcy/coffeeAgntcy testing-bash-scriptsInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add agntcy/coffeeAgntcy --skill testing-bash-scripts -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/agntcy/coffeeAgntcy.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/quality-checks/testing-bash-scripts .github/skills/testing-bash-scripts && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "testing-bash-scripts" agent skill from https://github.com/agntcy/coffeeAgntcy/tree/main/.agents/skills/quality-checks/testing-bash-scripts into .github/skills/testing-bash-scripts/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "testing-bash-scripts", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add agntcy/coffeeAgntcy --skill testing-bash-scripts -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install agntcy/coffeeAgntcy testing-bash-scripts --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/agntcy/coffeeAgntcy.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/quality-checks/testing-bash-scripts .opencode/skills/testing-bash-scripts && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "testing-bash-scripts" agent skill from https://github.com/agntcy/coffeeAgntcy/tree/main/.agents/skills/quality-checks/testing-bash-scripts into .opencode/skills/testing-bash-scripts/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "testing-bash-scripts", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
testing-bash-scriptsWrites unit tests (for lib/.sh-style helpers) or mocked end-to-end tests (for executable scripts) using bats, and runs task tests:bash/tests:coverage.
Testing Bash Scripts is an agent skill from agntcy/coffeeAgntcy. Writes unit tests (for lib/.sh-style helpers) or mocked end-to-end tests (for executable scripts) using bats, and runs task tests:bash/tests:coverage. Use whenever adding a new bash script anywhere in the repository, or when asked to test, mock, or audit test coverage for one.
Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Testing & QA, covering Shell scripting, Unit testing and Test coverage. It works with Bash. The repository describes itself as: End-to-end reference application for AGNTCY Components. The licence is Apache-2.0.
Read from SKILL.md and the folder at commit 36f1923. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md.
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Testing Bash Scripts loads about 1.1k tokens when it runs. Until then it costs about 75 tokens; SKILL.md has 359 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from agntcy/coffeeAgntcy at commit 36f1923, republished under its Apache-2.0 licence (© agntcy). 359 words, ~1,077 tokens.
.claude/skills/testing-bash-scripts/SKILL.md (or your agent's skills folder).Writes a .bats test for a new bash script anywhere in the repository, using bats
(bootstrapped by task setup) and this repo's shared mocking helper
(scripts/lib/testing.sh), then runs
task tests:bash (the whole suite) and
task tests:coverage (the audit that a test
exists at all). Both run as part of task check:all in
checks.yaml. See
.agents/rules/quality/bash-script-testing.md
for the underlying rule.
- [ ] 1. Decide which shape applies: a shared helper under a lib/*.sh-style directory
gets unit tests (source it, call its functions directly); an
executable script anywhere else gets a mocked end-to-end test
(run it as a subprocess with `run`).
- [ ] 2. Create <the script's own directory>/tests/<name>.bats.
- [ ] 3. At the top: `load '<relative path>/lib/testing.sh'` for
mock_setup/mock_command/mock_teardown, plus (unit tests only)
`load '<relative path>/<the file being tested>.sh'`.
- [ ] 4. For each external command the code under test invokes (gh,
docker, uname, git, ...), call `mock_command <name> '<stub body>'`
in the test that needs it, instead of letting the real binary
run.
- [ ] 5. Write one @test per meaningful behavior - the happy path, every
real branch, and every error path - not just one smoke test.
- [ ] 6. Run: task tests:bash (or `bats path/to/the.bats` directly while
iterating, for a faster loop).
- [ ] 7. Run: task tests:coverage - confirms the new script is no longer
flagged as untested. There's no exceptions list: every script,
with no exceptions, needs one.scripts/lib/*.sh files are already always sourced, never
executed directly, so they're naturally unit-testable with zero code
change; executable scripts are already invoked as their own subprocess
by a Taskfile task or CI, so they're naturally end-to-end-testable with
run and zero code change either. Neither needs a main() guard or
any other restructuring first.mock_command <name> '<body>' writes an executable stub named <name>
ahead of the real command on PATH for the rest of that one test - the
body runs as a real shell script, with $@/$1/etc. bound to whatever
arguments the real command would have received, so a stub can branch on
its arguments when a test needs different responses for different
calls.uname to exercise every
OS/arch branch) and
scripts/ci-gate/tests/wait-for-sibling-runs.bats
for a worked mocked end-to-end example (mocking gh).task tests:coverage flags a script, write it a test - there's no
exceptions list to add it to instead.PATH at a directory guessed not to
contain it - that guess can fail across OSes, e.g. Debian/Ubuntu's
merged-usr layout makes bare /bin reach everything /usr/bin has),
use mock_isolate_path <tool> ... (also in scripts/lib/testing.sh):
it symlinks each named tool from the real PATH into the mock bin
directory, then restricts PATH to only that directory.© agntcy, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .agents/skills/quality-checks/testing-bash-scripts of agntcy/coffeeAgntcy.
Open the folder on GitHubat commit 36f1923
Testing Bash Scripts next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Testing Bash Scripts this skillagntcy/coffeeAgntcy | 112 | — | ~1.1k | Automated safety check: Pass | Apache-2.0 | |
| Bats Shell Testing Patternswshobson/agents | 40k | 11 repos | ~1.3k | Automated safety check: Pass | MIT | |
| Test Writing WorkflowiOfficeAI/AionUi | 33k | 1 repos | ~1.2k | Automated safety check: Pass | Apache-2.0 | |
| OpenROAD Module Test AdderThe-OpenROAD-Project/OpenROAD | 3.2k | — | ~1.8k | Automated safety check: Pass | BSD-3-Clause | |
| CI FixFastLED/FastLED | 7.5k | — | ~897 | Automated safety check: Pass | MIT | |
| Testing iOS Codebitwarden/ios | 694 | — | ~1.8k | Automated safety check: Pass | GPL-3.0 |
wshobson/agents
Writes unit tests for shell scripts with Bats: error-condition tests, fixtures and mocks, cross-shell checks, parallel runs, helper files and CI integration.
iOfficeAI/AionUi
Sets the test-writing workflow for the repository: risk-first scenario lists, behavior-focused Vitest tests, a full run before each commit and a coverage target.
The-OpenROAD-Project/OpenROAD
Adds integration or unit tests to an OpenROAD module: writes the Tcl test, generates golden files and registers it in both CMake and Bazel.
FastLED/FastLED
Scan all CI builds and tests, find failures, fetch error logs, and fix the code.
bitwarden/ios
Write tests, add test coverage, unit test, or add missing tests for Bitwarden iOS.
caliber-ai-org/ai-setup
Writes Vitest tests following project patterns: tests/ directories, vi.mock() for module mocking with vi.hoisted() for test-time factories, global LLM mock from src/test/setup.ts, environment…
agntcy/coffeeAgntcy
A skill your agent uses when the user asks about A2A (Agent-to-Agent) protocol communication, OASF record formats, AGNTCY directory operations, agent card parsing, or dirctl CLI usage.
agntcy/coffeeAgntcy
Guides adding a new repository operation (a check, validation, or piece of tooling) through this repo's standard script - Taskfile task - skill - CI enforcement - rule pipeline.
agntcy/coffeeAgntcy
Authors and maintains the human-facing Agentic Workflows API documentation for the lungo subproject at coffeeAGNTCY/coffeeagents/lungo/docs/workflow-instanceapi.md.
agntcy/coffeeAgntcy
Runs task pins:check to find any third-party GitHub Action, reusable-workflow, or image reference that isn't pinned to an immutable SHA/digest, and pins each one it finds.
agntcy/coffeeAgntcy
Runs task workflows:check-permissions to find any GitHub Actions workflow file with a write-all grant or no declared permissions, and scopes it down to least privilege.
agntcy/coffeeAgntcy
Generates coffeeAgntcy CHANGELOG release notes and README Built With updates from PRs and dependency lockfiles since the previous release tag.
Works with
Categories
Writes unit tests (for lib/.sh-style helpers) or mocked end-to-end tests (for executable scripts) using bats, and runs task tests:bash/tests:coverage. Testing Bash Scripts is an agent skill from agntcy/coffeeAgntcy.sh-style helpers) or mocked end-to-end tests (for executable scripts) using bats, and runs task tests:bash/tests:coverage.
Testing Bash Scripts fits situations like: adding a new bash script anywhere in the repository; audit test coverage for one.
Run `npx skills add agntcy/coffeeAgntcy --skill testing-bash-scripts -a claude-code`. Or copy the skill folder (.agents/skills/quality-checks/testing-bash-scripts in agntcy/coffeeAgntcy) into .claude/skills/testing-bash-scripts in your project. Claude Code loads it when a task matches its description.
Run `npx skills add agntcy/coffeeAgntcy --skill testing-bash-scripts -a codex`. Or copy the skill folder (.agents/skills/quality-checks/testing-bash-scripts in agntcy/coffeeAgntcy) into .agents/skills/testing-bash-scripts in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add agntcy/coffeeAgntcy --skill testing-bash-scripts -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/testing-bash-scripts, .gemini/skills/testing-bash-scripts, .github/skills/testing-bash-scripts and .opencode/skills/testing-bash-scripts in your project.
SKILL.md names no scripts, command-line tools or credentials: Testing Bash Scripts is instructions for the agent only. Our summary lists: Docker.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Testing Bash Scripts is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.1k tokens (SKILL.md is roughly 4.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Testing Bash Scripts: Bats Shell Testing Patterns (wshobson/agents, 40k stars), Test Writing Workflow (iOfficeAI/AionUi, 33k stars), OpenROAD Module Test Adder (The-OpenROAD-Project/OpenROAD, 3.2k stars) and CI Fix (FastLED/FastLED, 7.5k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
agntcy (a GitHub organization) maintains it in agntcy/coffeeAgntcy, which has 112 GitHub stars. The repository holds 16 skills in this directory. The repository was last updated on October 6, 2026.
Source: agntcy/coffeeAgntcy on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.