PlugWiki

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. 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. 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

  1. When to Use This Skill
  2. Detailed patterns and worked examples
  3. Testing Error Conditions
  4. Testing with Dependencies
  5. Testing Shell Compatibility
  6. Parallel Execution
  7. Test Helper Pattern
  8. test_helper.sh
  9. Integration with CI/CD
  10. GitHub Actions Workflow
  11. Makefile Integration
  12. Best Practices

Key facts

License
MIT
Installs on skills.sh
11,237 (Nov 2, 2026)
Last repo commit
Oct 30, 2026

What it includes

  • Missing files, invalid input, permission denied and usage messages

    Missing files, invalid input, permission denied and usage messages.

    Testing error conditions

  • Skip a test when a tool such as jq is missing

    Skip a test when a tool such as jq is missing.

    Testing with dependencies

  • Run a script under bash, sh and dash

    Run a script under bash, sh and dash.

    Testing shell compatibility

  • Tests that run background jobs and wait for them

    Tests that run background jobs and wait for them.

    Parallel execution

  • A 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 pattern

  • Installs 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 workflow

  • test, test-verbose, test-tap and test-parallel targets

    test, test-verbose, test-tap and test-parallel targets.

    Makefile integration

  • What 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 installation

  • Exit code, output and file assertions

    Exit code, output and file assertions (in references/details.md)

    Assertion patterns

  • Per-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 teardown

  • Function mocks, command stubs and variable stubs

    Function mocks, command stubs and variable stubs (in references/details.md)

    Mocking and stubbing

  • Fixture 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-onlySKILL.md and references/details.md do not describe a read-only mode.
Sign-in and keysSKILL.md and references/details.md do not describe key storage or accounts.
Scopes
  • The assistant may write .bats test files, helper scripts and a CI workflow in your project

  • The samples create and delete temporary files and folders, and change file permissions

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

wshobson/agentsskills.sh

Sources

Docs, issue trackers and discussions this page is built from.

Show all 5
  1. bats-testing-patterns SKILL.md · github.com
  2. wshobson/agents README · github.com
  3. shell-scripting plugin.json · github.com
  4. wshobson/agents marketplace.json · github.com
  5. details.md · github.com

Updated Nov 2, 2026.