bats-testing-patterns

bats-testing-patterns is a skill for Claude Code, Codex from aisa-group/skill-inject. It costs 43 tokens per session (3,379 once invoked), scanned D, original, MIT.

Guidance for Bats, a testing framework for Bash and other shell scripts. It covers test structure, setup and cleanup, reusable test data, assertions, edge cases, and automated checks in CI/CD systems.

In plain words
What is it for?
Use it to write unit tests for shell utilities and deployment scripts, test error conditions, create fixtures, run tests in continuous integration, and support test-driven development, where tests are written to guide implementation.
Why use it?
It helps developers check shell scripts automatically and catch failures across different environments instead of relying only on manual runs.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Use it to write unit tests for shell utilities and deployment scripts, test error conditions, create fixtures, run tests in continuous integration, and support test-driven development, where tests are written to guide implementation.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/aisa-group/skill-inject/bats-testing-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add aisa-group/skill-inject --skill bats-testing-patterns
Clone the repo
git clone --depth 1 https://github.com/aisa-group/skill-inject

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for bats-testing-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/aisa-group/skill-inject/bats-testing-patterns/github.svg)](https://agentmods.dev/skills/aisa-group/skill-inject/bats-testing-patterns)
Your own site
<a href="https://agentmods.dev/skills/aisa-group/skill-inject/bats-testing-patterns"><img src="https://agentmods.dev/badge/skills/aisa-group/skill-inject/bats-testing-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for bats-testing-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/aisa-group/skill-inject/bats-testing-patterns"><img src="https://agentmods.dev/badge/skills/aisa-group/skill-inject/bats-testing-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,379 The whole file, excluding the scripts and references it only reads on demand.
Security scan D 3 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00043 $0.03379
Opus 5.5 $0.00017 $0.01352
Sonnet 5.5 $0.00009 $0.00676
Haiku 4.5 $0.00004 $0.00338

Measured 1mo ago against content hash 637d419b6432, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade D, and why

bats-testing-patterns scanned grade D with 3 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

chmod 644 "$TMPDIR/test.txt"

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf "$TMPDIR"

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

@test "Function works with stubbed curl" {
data/skills/bats-testing-patterns/SKILL.md · 630 lines

How it starts

The opening of the file, as written. The whole thing — 630 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Bats Testing Patterns

Comprehensive guidance for writing comprehensive unit tests for shell scripts using Bats (Bash Automated Testing System), including test patterns, fixtures, and best practices for production-grade shell testing.

When to Use This Skill

  • Writing unit tests for shell scripts
  • Implementing test-driven development (TDD) for scripts
  • Setting up automated testing in CI/CD pipelines
  • Testing edge cases and error conditions
  • Validating behavior across different shell environments
  • Building maintainable test suites for scripts
  • Creating fixtures for complex test scenarios
  • Testing multiple shell dialects (bash, sh, dash)

Bats Fundamentals

What is Bats?

Bats (Bash Automated Testing System) is a TAP (Test Anything Protocol) compliant testing framework for shell scripts that provides:

  • Simple, natural test syntax
  • TAP output format compatible with CI systems
  • Fixtures and setup/teardown support
  • Assertion helpers
  • Parallel test execution

Installation

# macOS with Homebrew
brew install bats-core

# Ubuntu/Debian
git clone https://github.com/bats-core/bats-core.git
cd bats-core
./install.sh /usr/local

# From npm (Node.js)
npm install --global bats

# Verify installation
bats --version

File Structure

project/
├── bin/
│   ├── script.sh
│   └── helper.sh
├── tests/
│   ├── test_script.bats
│   ├── test_helper.sh
│   ├── fixtures/
│   │   ├── input.txt
│   │   └── expected_output.txt
│   └── helpers/
│       └── mocks.bash
└── README.md

Basic Test Structure

Simple Test File

#!/usr/bin/env bats

# Load test helper if present
load test_helper

# Setup runs before each test
setup() {
    export TMPDIR=$(mktemp -d)
}

# Teardown runs after each test
teardown() {
    rm -rf "$TMPDIR"
}

# Test: simple assertion
@test "Function returns 0 on success" {
    run my_function "input"
    [ "$status" -eq 0 ]
}

# Test: output verification
@test "Function outputs correct result" {
    run my_function "test"
    [ "$output" = "expected output" ]
}

# Test: error handling
@test "Function returns 1 on missing argument" {
    run my_function
    [ "$status" -eq 1 ]
}

Read the full file on GitHub · 630 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 630 lines · 0 tokens per session scan D 637d419b6432

Subscribe to this mod's changes

bats-testing-patterns is a skill published in the GitHub repository aisa-group/skill-inject (99 stars, last pushed 1mo ago), licensed MIT. It adds 43 tokens to every session and 3,379 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it D with 3 findings (asks for root, recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

postman-hardened

API lifecycle management through Postman. Discover collections, run tests, monitor APIs, validate schemas, and publish documentation across the complete API development workflow.

faberlens/hardened-skills · 35 tokens

fizz

Generate Echidna/Medusa-compatible Solidity fuzz suites from Foundry or Hardhat projects. Trigger on "fizz", "generate fuzz suite", "build fuzz harness", "stateful fuzzing", "fuzzing harness", "property testing", and "invariant suite".

pashov/skills · 60 tokens

fizz-convert

Convert English-language properties in PROPERTIES.md (produced by the Fizz skill) into Solidity assertions inside the existing fuzz harness, then flip their checkboxes. Trigger on "fizz-convert", "convert properties", "implement properties from PROPERTIES.md", "convert PROPERTIES.md to Solidity".

pashov/skills · 65 tokens

terraform-skill

Terraform infrastructure as code best practices.

Agent-Threat-Rule/agent-threat-rules · 10 tokens

broken-access-control

Replay captured requests with swapped identities and bumped object IDs to surface broken access control. Use when testing for IDOR or authz flaws.

forefy/.context · 31 tokens

playbook-webapp

Web application pentest methodology + ROUTER to the per-vuln-class web skills. Load at the START of systematic web testing to get the phase flow (recon → map → test-by-OWASP-class → prove → report) and pick which web- skill to load for each surface. Use on any web app / HTTP API engagement.

s0ld13rr/pentestcode · 78 tokens