bats-testing-patterns Skill for Claude: What It Does and How to Install It
Helps your assistant write Bats (Bash Automated Testing System) tests for shell scripts.
- Installs
- 11.2K
- on skills.sh
- Stars
- 42.1K
- on GitHub
- Files
- 1
- besides SKILL.md
- Updated
- Oct 2026
- last repo commit
SKILL.md covers error-condition tests, dependency checks that skip a test when a tool is missing, tests across bash, sh and dash, parallel execution, a shared test_helper.sh and CI setups with a GitHub Actions workflow and a Makefile. It ends with 10 best practices.
Its "When to Use" list covers unit tests and TDD for shell scripts, CI/CD pipelines, edge cases, fixtures and multiple shell dialects. Fundamentals (including how to install Bats), assertions, setup and teardown, mocking and fixtures sit in references/details.md. It bundles no scripts.
Good for
- Developers testing shell utilities
- DevOps engineers adding script tests to CI
- Teams doing TDD on bash scripts
Install bats-testing-patterns
Claude Code
- 1
Copy this prompt.
Install the bats-testing-patterns skill in Claude Code. Run this command: /plugin marketplace add wshobson/agents /plugin install shell-scripting@claude-code-workflows Then check that it loaded and tell me how to use it.
- 2
Paste it into Claude Code. It shows the change and asks before running it.
Pick one route. The plugin routes install the whole shell-scripting plugin: 2 agents and 3 skills (counted from the plugin folder in the repo tree, which has no hooks or MCP config files). The skills-only routes install just this skill, with no agents or commands. Running the generated tests needs Bats installed; references/details.md shows install routes.
From the project README. Source.
What's in the skill
When it loads
Master Bash Automated Testing System (Bats) for comprehensive shell script testing. Use when writing tests for shell scripts, CI/CD pipelines, or requiring test-driven development of shell utilities.
Sections in SKILL.md
- When to Use This Skill
- Detailed patterns and worked examples
- Testing Error Conditions
- Testing with Dependencies
- Testing Shell Compatibility
- Parallel Execution
- Test Helper Pattern
- test_helper.sh
- Integration with CI/CD
- GitHub Actions Workflow
- Makefile Integration
- Best Practices
Key facts
- Author
- wshobson (repo owner)
- License
- MIT
- Installs on skills.sh
- 11,237 (Nov 2, 2026)
- Last repo commit
- Oct 30, 2026
- What it includes
- 2 files including SKILL.md: references/details.md (no scripts)
What it includes
Missing files, invalid input, permission denied and usage messages
Missing files, invalid input, permission denied and usage messages.
Testing error conditionsSkip a test when a tool such as jq is missing
Skip a test when a tool such as jq is missing.
Testing with dependenciesRun a script under bash, sh and dash
Run a script under bash, sh and dash.
Testing shell compatibilityTests that run background jobs and wait for them
Tests that run background jobs and wait for them.
Parallel executionA shared test_helper.sh with file assertions and a temp-dir setup and cleanup
A shared test_helper.sh with file assertions and a temp-dir setup and cleanup.
Test helper patternInstalls Bats with npm and runs bats tests/*.bats, including TAP output
Installs Bats with npm and runs bats tests/*.bats, including TAP output.
GitHub Actions workflowtest, test-verbose, test-tap and test-parallel targets
test, test-verbose, test-tap and test-parallel targets.
Makefile integrationWhat Bats is, install routes (Homebrew, git clone, npm) and file structure
What Bats is, install routes (Homebrew, git clone, npm) and file structure (in references/details.md)
Fundamentals and installationExit code, output and file assertions
Exit code, output and file assertions (in references/details.md)
Assertion patternsPer-test and per-file hooks, including setup_file and teardown_file
Per-test and per-file hooks, including setup_file and teardown_file (in references/details.md)
Setup and teardownFunction mocks, command stubs and variable stubs
Function mocks, command stubs and variable stubs (in references/details.md)
Mocking and stubbingFixture files and dynamically generated fixtures
Fixture files and dynamically generated fixtures (in references/details.md)
Fixture management
From the official docs
Permissions
Low risk
What it can do
- Read your data
- Create and change things
- Delete things
- Read-only mode
Watch out for
The samples install Bats system-wide
references/details.md shows brew install bats-core, a git clone of bats-core with ./install.sh /usr/local, and npm install --global bats. SKILL.md's GitHub Actions example also runs npm install --global bats. github.com
The samples delete folders with rm -rf
SKILL.md and references/details.md use rm -rf on $TEST_DIR, $TMPDIR/data and $SHARED_RESOURCE in teardown helpers. Check that these variables point at temp directories before running generated tests. github.com
A CI workflow example would add a file under .github
SKILL.md shows a GitHub Actions workflow that checks out your repo, installs Bats and runs tests. Review it before you commit it. github.com
The plugin route installs more than this skill
The shell-scripting plugin has 2 agents and 3 skills. We found no hooks or MCP config files in its folder. The skills-only routes install only this skill. github.com
Security advisories
No published security advisories as of Nov 2, 2026.
Technical details
| Turning on read-only | SKILL.md and references/details.md do not describe a read-only mode. |
|---|---|
| Sign-in and keys | SKILL.md and references/details.md do not describe key storage or accounts. |
| Scopes |
|
Questions
What does the bats-testing-patterns skill do?
It gives the assistant a Bats playbook for testing shell scripts: error cases, dependency checks, shell compatibility, helpers, mocking, fixtures and CI.
How do I install bats-testing-patterns?
Use the install box at the top of this page. For Claude Code it lists the plugin route (/plugin marketplace add wshobson/agents, then /plugin install shell-scripting@claude-code-workflows) and two skills-only commands: npx skills add wshobson/agents --skill bats-testing-patterns and gh skill install wshobson/agents bats-testing-patterns (GitHub CLI 2.90 or later), which skip the plugin's agents and commands.
Do I need Bats installed?
Yes, to run the tests the assistant writes. references/details.md lists three install routes: brew install bats-core, cloning bats-core and running ./install.sh /usr/local, or npm install --global bats. SKILL.md names no API key.
Is it safe?
Its folder holds two Markdown files and no scripts. The samples install Bats, use rm -rf on temp folders in teardown, use chmod and create executable command stubs. Review the commands before the assistant runs them, and check that any rm -rf path is a temp directory.
Should I install the whole shell-scripting plugin?
Only if you want the rest. The README documents a plugin route for Claude Code and Codex. The shell-scripting plugin folder holds 2 agents and 3 skills, and its repo tree shows no hooks or MCP config files. The install box offers the plugin and the skills-only commands.
Does it work in Codex or Cursor?
The README documents Codex CLI as a plugin route and a skills-only install. For Cursor it points to a plugin marketplace and its setup docs, which we did not check, so follow the README there.
Is this skill from Anthropic?
No. It is in wshobson/agents, a community collection. The skill sits in the shell-scripting plugin there, alongside bash-defensive-patterns and shellcheck-configuration.
Information
updated Nov 2, 2026
- Repository
- wshobson/agents
- Folder
plugins/shell-scripting/skills/bats-testing-patterns
Sources
Docs, issue trackers and discussions this page is built from.
Show all 5Hide
- bats-testing-patterns SKILL.md · github.com
- wshobson/agents README · github.com
- shell-scripting plugin.json · github.com
- wshobson/agents marketplace.json · github.com
- details.md · github.com