
Bats Shell Testing Patterns
Write and structure automated tests for shell scripts using the Bats testing framework
- Repository
- wshobson/agents
- Stars
- 42,095
- Licence
- MIT
- Files
- 2 files
What it does
When installed, the agent gains guidance for writing automated tests for Bash and other shell scripts using Bats (Bash Automated Testing System). It can produce Bats test files covering error cases, skipping tests when tools are missing, checking compatibility across bash, sh and dash, setting up helper functions, and running tests in CI pipelines such as GitHub Actions or a Makefile. It is a reference of patterns and examples rather than a tool that runs anything by itself.
Great for
- Developers maintaining shell scripts who want a test suite
- Teams adding shell script tests to a CI/CD pipeline
- Anyone practising test-driven development on command-line utilities
Skip it if
- Testing application code in other languages, since the skill covers only shell scripts with Bats (wrong tool for that job)
- Non-developers without a shell script to test, since the content assumes familiarity with Bash and CI systems
Try asking
- “Write Bats tests for my backup.sh script covering missing-file and bad-argument errors”
- “Set up a GitHub Actions workflow that runs my Bats tests on every push”
- “Help me test whether my deploy script works under both bash and dash”
Install in 3 steps
- 1
Download the skill
The ZIP contains the 2 original files, the MIT licence and an attribution note.
bats-testing-patterns.zip - 2
Add it to your agent
Claude Code (all projects)
mkdir -p ~/.claude/skills && unzip bats-testing-patterns.zip -d ~/.claude/skills/Claude Code / Agent SDK (this project only)
mkdir -p .claude/skills && unzip bats-testing-patterns.zip -d .claude/skills/Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.
- 3
Ask for the task
No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.
Get better results
- Ask the agent to read references/details.md when you need more detailed worked examples than SKILL.md provides
- Review any generated test that uses chmod or creates files in TMPDIR, since the examples modify file permissions and expect cleanup
- Give the agent the path to your script so generated tests call the real file rather than placeholder names like my_function
What's inside
- references/details.md
- SKILL.md
Redistributed unmodified from wshobson/agents under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.