Skills bats-testing-patterns
๐Ÿ“ฆ

bats-testing-patterns

Content revision r2 Safe โš™๏ธ External commands๐ŸŒ Network access๐Ÿ“ Filesystem access

Build Reliable Bats Tests for Shell Scripts

Shell scripts often lack repeatable tests for output, exit codes, files, and failures. This skill provides practical Bats patterns for maintainable local and CI test suites.

Supports: Claude Codex Code(CC)
๐Ÿฅ‰ 78 Bronze

Install with my Agent

Copy this request to your Agent. It includes the canonical Skill page and manifest.

Agent request
Review the Skillstore skill "bats-testing-patterns" from https://skillstore.io/skills/sickn33-bats-testing-patterns.md and its manifest at https://skillstore.io/api/skills/sickn33-bats-testing-patterns/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.

Your Agent should still show its plan and request any confirmation required by the security policy.

Agent-readable resources

Use these links when an AI agent, crawler, or script needs clean context instead of reading the full page.

Test it

Using "bats-testing-patterns". Create tests for a backup script that requires a destination directory.

Expected outcome:

  • A success test verifies the archive path, status, and reported filename.
  • Failure tests cover a missing destination, an unwritable directory, and an unavailable source.
  • Setup creates isolated fixtures, while teardown removes only the generated test directory.

Using "bats-testing-patterns". Test a shell function that calls curl and parses a response.

Expected outcome:

  • A command stub returns controlled success, timeout, and malformed response cases.
  • Assertions verify exit codes and user-facing errors without making network requests.
  • Each test resets the stub environment to prevent state leakage.

Using "bats-testing-patterns". Prepare existing Bats tests for continuous integration.

Expected outcome:

The result organizes fixtures, removes shared mutable state, adds dependency checks, and defines repeatable test commands for the CI workflow.

Security Audit

Safe
v5 โ€ข 8/14/2026 Open versioned report

All 33 static findings are false positives caused by markdown examples, fixed test commands, project-relative paths, and ordinary shell redirection. No prompt injection, malicious intent, credential access, covert network activity, or unsafe executable payload was found.

2
Files scanned
658
Lines analyzed
0
Review items
0
False positives ignored
No confirmed security findings were detected by the latest completed static and semantic audit. This does not prove the skill has no side effects.
Audited by: codex View Audit History โ†’
Share & cite this report

Share the versioned assessment report, neutral badge, embed card, and citations. Skillstore reports evidence without deciding whether this Skill is safe.

Open versioned report
Security Assessment

Copy report link

https://skillstore.io/skills/sickn33-bats-testing-patterns/audits/5?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_report

Markdown badge

[![Skillstore security assessment](https://skillstore.io/badges/skills/sickn33-bats-testing-patterns/security.svg)](https://skillstore.io/skills/sickn33-bats-testing-patterns?utm_source=security_passport_badge)

HTML badge

<a href="https://skillstore.io/skills/sickn33-bats-testing-patterns?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/sickn33-bats-testing-patterns/security.svg" alt="Skillstore security assessment" loading="lazy"></a>

Embed card

<iframe src="https://skillstore.io/embed/skills/sickn33-bats-testing-patterns.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>
Academic citations (APA ยท BibTeX ยท CFF)

APA citation

sickn33. (2026). bats-testing-patterns security audit report (audit version 5) [Author version unspecified]. Skillstore. https://skillstore.io/skills/sickn33-bats-testing-patterns/audits/5

BibTeX citation

@techreport{sickn33-sickn33-bats-testing-patterns-2026, author = {sickn33}, title = {bats-testing-patterns security audit report (audit version 5)}, institution = {Skillstore}, year = {2026}, number = {5}, url = {https://skillstore.io/skills/sickn33-bats-testing-patterns/audits/5}, note = {Author version unspecified} }

CITATION.cff

cff-version: 1.2.0 message: "If you use this Skill, cite its author and this versioned security audit report." title: "bats-testing-patterns security audit report (audit version 5)" version: "unspecified" type: report authors: - name: "sickn33" date-released: "2026-08-14" url: "https://skillstore.io/skills/sickn33-bats-testing-patterns/audits/5" identifiers: - type: other value: "skillstore:sickn33-bats-testing-patterns:audit:5" description: "Skillstore immutable audit report identifier"

Compare variants

2 installable variants

Each author remains a separate installable skill. The recommended variant is ranked by Skillstore evidence.

Why this variant is first

Highest Skillstore Score
sickn33 Recommended Current

sickn33-bats-testing-patterns

Skillstore Score 78
Evidence Confidence High
Skillstore usage 8
Updated

2026-08-21

wshobson-bats-testing-patterns

Skillstore Score 77
Evidence Confidence High
Skillstore usage 10
Updated

2026-08-21

Skillstore Score

Why this score Evidence Confidence: High
55
Architecture
85
Maintainability
87
Content
68
Community
83
Spec Compliance

What You Can Build

Test a shell utility

Create focused Bats tests for normal output, invalid arguments, exit codes, and file side effects.

Add regression coverage

Convert reported shell failures into isolated fixtures and repeatable tests before changing production scripts.

Standardize CI checks

Organize a portable Bats suite and run it consistently across supported shell environments.

Try These Prompts

Create a basic test
Write Bats tests for [script] covering successful output, one invalid argument, and expected exit codes.
Test file side effects
Design Bats setup, teardown, and fixtures for [script]. Verify created files, contents, permissions, and cleanup.
Mock external commands
Create Bats tests for [function] that stub [dependency]. Cover dependency success, failure, malformed output, and missing installation.
Design a portable CI suite
Review [test suite] for Bash, sh, and dash portability. Improve fixtures, parallel safety, failure coverage, and CI execution.

Best Practices

  • Test one behavior per case and name the expected outcome clearly.
  • Create isolated fixtures with secure temporary directories and reliable teardown.
  • Cover success, failure, edge cases, and supported shell environments in CI.

Avoid

  • Do not depend on live services when a controlled command stub can isolate behavior.
  • Do not share writable fixture state between tests or parallel workers.
  • Do not assert only output while ignoring exit codes and filesystem side effects.

Frequently Asked Questions

What is Bats?
Bats is a testing framework for shell programs that produces Test Anything Protocol output.
Which shells can these patterns test?
The patterns focus on Bash and can verify scripts under POSIX sh or dash when those interpreters are available.
Does this skill install Bats?
No. It provides installation references and testing guidance, but the user controls all installation commands.
Can it test external commands without network access?
Yes. Command stubs and function mocks can return controlled outputs and exit codes without contacting live services.
Can Bats tests run in CI?
Yes. The skill includes patterns for GitHub Actions, Make targets, TAP output, and parallel execution.
Does it provide code coverage metrics?
No. It focuses on behavior tests and does not configure a shell coverage tool.

Developer Details

Author

sickn33

License

MIT

Skillstore revision

r2

Version notice

The author did not declare a version.

Ref

5a26d1d61d694db29af9b138c661c1981076d9df

Maintenance freshness

8/15/2026

Usage

7 downloads ยท 93 views

File structure

๐Ÿ“ resources/

๐Ÿ“„ implementation-playbook.md

๐Ÿ“„ SKILL.md