About write-bats-test
A skill for adding bats-core tests when behavior in setup.sh or context.sh changes. It emphasizes testing observable contracts in temporary directories and running the full test suite.
Key features
- 01Match existing test conventions
- 02Test new or changed behavior
- 03Isolate filesystem effects in temp dirs
- 04Run the complete bats suite
Use cases
- 01Adding a setup.sh flag
- 02Changing context.sh output fields
- 03Updating detection behavior
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ dailybothq/ deepworkplan-skill --skill write-bats-testAfter installing, type/write-bats-testin Claude Code to confirm it loaded.
Details
From the project READMEWrite Bats Test
Goal
Cover new or changed shell behavior with a bats-core test that matches the
existing convention in tests/.
When to use
When setup.sh or skills/deepworkplan/shared/context.sh gains or changes
behavior (a new flag, a new detection branch, a new output field).
Steps
- Read the existing tests to match style and helpers:
tests/setup-sh.bats,tests/context-sh.bats. - Add
@testcases for the new behavior. Use a throwawayHOME/temp dir for any filesystem effect so the suite never touches the developer's~/.claude. - Keep assertions on observable contract: emitted JSON fields from
context.sh, created symlink names fromsetup.sh, exit codes. - Run
bats tests/and iterate until green.
Validation
bats tests/ passes, including the new cases, and the suite leaves no artifacts
outside its temp dirs.
Notes
Tests must run on bash 3.2. Prefer testing the public contract (flags, symlink names, JSON keys) over internal implementation so refactors don't churn the suite.