22
33## Project Overview
44
5- ** bashunit** is a comprehensive, lightweight Bash testing framework (requires Bash 3.0+) focused on developer experience. It provides assertions, test doubles (spies/mocks), data providers, snapshots, and more.
5+ ** bashunit** is a lightweight Bash testing framework (Bash 3.0+) focused on developer experience. Provides assertions, test doubles (spies/mocks), data providers, snapshots, and more.
66
77** Documentation:** https://bashunit.typeddevs.com
88
9- ## Claude Code Configuration
10-
11- This directory (` .claude/ ` ) contains comprehensive Claude Code configuration:
12- - ** Custom skills** : ` /tdd-cycle ` , ` /fix-test ` , ` /add-assertion ` , ` /check-coverage ` , ` /pre-release `
13- - ** Custom commands** : ` /gh-issue ` (complete GitHub issue → PR workflow)
14- - ** Modular rules** : Bash 3.0+ compatibility, testing patterns, TDD workflow
15- - ** Automation** : Agent SDK examples for CI/CD
16-
17- See ` README.md ` in this directory for complete documentation.
18-
199## Core Principles
2010
2111### TDD by Default
22- ** RED → GREEN → REFACTOR**
23-
24- 1 . ** RED** - Write failing test (fail for the RIGHT reason)
25- 2 . ** GREEN** - Minimal code to make it pass
26- 3 . ** REFACTOR** - Improve while keeping tests green
27-
28- Every change starts from a failing test. No exceptions.
12+ ** RED → GREEN → REFACTOR** — every change starts from a failing test. No exceptions.
2913
3014### Bash 3.0+ Compatible
3115
3216Works on macOS default bash. ** Prohibited features:**
33- - ❌ ` declare -A ` (associative arrays - Bash 4.0+)
34- - ❌ ` [[ ]] ` (use ` [ ] ` instead)
35- - ❌ ` ${var,,} ` (case conversion - Bash 4.0+)
36- - ❌ ` ${array[-1]} ` (negative indexing - Bash 4.3+)
37- - ❌ ` &>> ` redirect (Bash 4.0+)
17+ - ` declare -A ` (associative arrays - Bash 4.0+)
18+ - ` [[ ]] ` (use ` [ ] ` instead)
19+ - ` ${var,,} ` (case conversion - Bash 4.0+)
20+ - ` ${array[-1]} ` (negative indexing - Bash 4.3+)
21+ - ` &>> ` redirect (Bash 4.0+)
3822
39- See ` @.claude/rules/bash-style.md ` for complete compatibility guide.
23+ See @.claude/rules/bash-style.md for complete compatibility guide.
4024
4125### Quality Standards
4226
@@ -62,9 +46,8 @@ bashunit/
6246│ ├── functional/ # Integration tests
6347│ └── acceptance/ # End-to-end CLI tests
6448├── .claude/ # Claude Code configuration
65- │ ├── CLAUDE.md # This file (primary instructions)
66- │ ├── skills/ # Custom workflows
67- │ ├── commands/ # End-to-end commands
49+ │ ├── CLAUDE.md # This file
50+ │ ├── skills/ # Custom workflows (invoke with /skill-name)
6851│ └── rules/ # Modular guidelines
6952├── .tasks/ # Optional task tracking files
7053├── adrs/ # Architecture Decision Records
@@ -74,135 +57,49 @@ bashunit/
7457## Common Commands
7558
7659``` bash
77- # Testing
7860./bashunit tests/ # Run all tests
7961./bashunit --parallel tests/ # Parallel execution
8062./bashunit tests/unit/ # Run unit tests only
81- make test # Run full test suite
82-
83- # Quality checks
8463make sa # ShellCheck static analysis
8564make lint # EditorConfig checker
8665shfmt -w . # Format all shell files
87-
88- # Documentation
89- npm run docs:dev # Start docs dev server
90- npm run docs:build # Build documentation
91-
92- # Releases
93- ./release.sh # Release new version
9466```
9567
9668## Test Patterns
9769
9870Study existing tests before writing new ones:
9971
100- - ** Assertions** : ` tests/unit/assert_test.sh ` - Assertion patterns and failure testing
101- - ** Test Doubles** : ` tests/functional/doubles_test.sh ` - ` mock ` / ` spy ` + ` assert_have_been_called* `
102- - ** Data Providers** : ` tests/functional/provider_test.sh ` - ` @data_provider ` syntax
103- - ** Lifecycle Hooks** : ` tests/unit/setup_teardown_test.sh ` - ` set_up_before_script ` , etc.
104- - ** CLI Testing** : ` tests/acceptance/bashunit_test.sh ` - Snapshot testing
72+ - ** Assertions** : ` tests/unit/assert_test.sh `
73+ - ** Test Doubles** : ` tests/functional/doubles_test.sh `
74+ - ** Data Providers** : ` tests/functional/provider_test.sh `
75+ - ** Lifecycle Hooks** : ` tests/unit/setup_teardown_test.sh `
76+ - ** CLI Testing** : ` tests/acceptance/bashunit_test.sh `
10577
106- ## Available Skills
78+ ## Skills
10779
10880Invoke with ` /skill-name ` :
10981
110- ### ` /tdd-cycle ` - Complete TDD Workflow
111- Guides through RED → GREEN → REFACTOR cycle with quality checks.
112- ```
113- /tdd-cycle
114- ```
115-
116- ### ` /fix-test ` - Debug Failing Tests
117- Systematically debugs and fixes test failures.
118- ```
119- /fix-test
120- ```
121-
122- ### ` /add-assertion ` - Add New Assertion
123- Adds new assertion following TDD with comprehensive tests.
124- ```
125- /add-assertion
126- ```
127-
128- ### ` /check-coverage ` - Analyze Coverage
129- Analyzes test coverage and identifies gaps.
130- ```
131- /check-coverage
132- ```
133-
134- ### ` /pre-release ` - Release Validation
135- Comprehensive validation before releasing.
136- ```
137- /pre-release
138- ```
139-
140- ## Expert Agents
141-
142- Specialized agents you can consult using the Task tool:
143-
144- ### Bash 3.0+ Expert
145- ** When to use:** Reviewing code for Bash 3.0+ compatibility
146- ** Expertise:** Identifying incompatible features, suggesting portable alternatives
147- ** Invoke:** Use Task tool with subagent_type="bash-3.0-expert"
148-
149- ### Code Reviewer
150- ** When to use:** Before committing, for comprehensive code review
151- ** Expertise:** Project standards, quality, security, documentation
152- ** Invoke:** Use Task tool with subagent_type="code-reviewer"
153-
154- ### TDD Coach
155- ** When to use:** Learning TDD, guidance through RED-GREEN-REFACTOR
156- ** Expertise:** TDD methodology, test design, avoiding common mistakes
157- ** Invoke:** Use Task tool with subagent_type="tdd-coach"
158-
159- ### Test Architect
160- ** When to use:** Planning test strategy, organizing tests
161- ** Expertise:** Test categorization, coverage planning, testing patterns
162- ** Invoke:** Use Task tool with subagent_type="test-architect"
163-
164- ### Performance Optimizer
165- ** When to use:** Optimizing slow code, improving test suite performance
166- ** Expertise:** Bash performance patterns, benchmarking, profiling
167- ** Invoke:** Use Task tool with subagent_type="performance-optimizer"
168-
169- ## Available Commands
170-
171- ### ` /gh-issue ` - GitHub Issue Workflow
172- Complete end-to-end workflow from issue to PR:
173- 1 . Fetches issue from GitHub
174- 2 . Creates branch with proper naming
175- 3 . Plans implementation
176- 4 . Implements following TDD
177- 5 . Runs quality checks
178- 6 . Creates commit and PR
179-
180- ```
181- /gh-issue 42
182- ```
82+ | Skill | Purpose |
83+ | -------| ---------|
84+ | ` /tdd-cycle ` | Complete RED → GREEN → REFACTOR cycle |
85+ | ` /fix-test ` | Debug and fix failing tests |
86+ | ` /add-assertion ` | Add new assertion with TDD |
87+ | ` /check-coverage ` | Analyze test coverage gaps |
88+ | ` /pre-release ` | Pre-release validation checklist |
89+ | ` /commit ` | Stage and commit with conventional commits |
90+ | ` /gh-issue <N> ` | GitHub issue → branch → implement → PR |
91+ | ` /pr [#N] ` | Push branch and create PR |
18392
18493## Code Standards
18594
18695### Bash Style
18796@.claude/rules/bash-style.md
188- - Bash 3.0+ compatibility (critical!)
189- - ShellCheck compliance
190- - Function documentation
191- - Naming conventions
19297
19398### Testing
19499@.claude/rules/testing.md
195- - Test organization (unit/functional/acceptance)
196- - Assertion patterns
197- - Test doubles (mocks/spies)
198- - Data providers
199- - Anti-patterns to avoid
200100
201101### TDD Workflow
202102@.claude/rules/tdd-workflow.md
203- - RED → GREEN → REFACTOR cycle
204- - Quality gates
205- - Definition of Done
206103
207104## Path-Scoped Guidelines
208105
@@ -211,7 +108,6 @@ Complete end-to-end workflow from issue to PR:
211108- Bash 3.0+ compatibility (no associative arrays, no ` [[ ` , no ` ${var,,} ` )
212109- Proper namespacing (` bashunit::* ` )
213110- No external dependencies in core
214- - Function documentation required
215111
216112### ` tests/**/*_test.sh `
217113- Behavior-focused tests
@@ -220,16 +116,9 @@ Complete end-to-end workflow from issue to PR:
220116- Use ` temp_file ` /` temp_dir ` for isolation
221117- Test both success and failure paths
222118
223- ### ` .tasks/YYYY-MM-DD-slug.md ` (Optional)
224- - Use for complex work to track progress
225- - Include test inventory
226- - Timestamped logbook entries
227- - Not required for simple fixes
228-
229119### ` adrs/*.md `
230120- Read existing ADRs before major changes
231121- Use template for new decisions
232- - Match existing format
233122
234123## Guardrails
235124
@@ -238,104 +127,43 @@ Complete end-to-end workflow from issue to PR:
238127- Break Bash 3.0+ compatibility
239128- Skip tests or quality checks
240129- Change public API without docs/CHANGELOG
241- - Use speculative/unproven patterns
242130- Commit without tests passing
243131- Batch unrelated changes in one PR
244- - Create a PR without using the ` /pr ` skill (even if user says "create pr")
132+ - Create a PR without using the ` /pr ` skill
245133
246134### Always:
247135- Write tests before implementation
248136- Use existing patterns from ` tests/** ` and ` src/** `
249137- Minimal code in GREEN phase
250138- Keep tests passing during REFACTOR
251- - Update CHANGELOG.md before creating a PR (for user-facing changes)
252- - Run quality checks before committing
253139- Update CHANGELOG.md for user-visible changes
140+ - Run quality checks before committing
254141- Maintain Bash 3.0+ compatibility
255142
256143## Definition of Done
257144
258- Before marking work complete:
259- - ✅ All tests green for the ** right reason**
260- - ✅ ` make sa ` passes (ShellCheck)
261- - ✅ ` make lint ` passes (EditorConfig)
262- - ✅ Code formatted (` shfmt -w . ` )
263- - ✅ Bash 3.0+ compatible
264- - ✅ Parallel tests passing (` ./bashunit --parallel tests/ ` )
265- - ✅ CHANGELOG.md updated (if user-facing changes)
266- - ✅ Documentation updated (if needed)
267- - ✅ ADR created/updated (if architectural decision)
145+ - All tests green for the ** right reason**
146+ - ` make sa ` passes (ShellCheck)
147+ - ` make lint ` passes (EditorConfig)
148+ - Code formatted (` shfmt -w . ` )
149+ - Bash 3.0+ compatible
150+ - Parallel tests passing (` ./bashunit --parallel tests/ ` )
151+ - CHANGELOG.md updated (if user-facing changes)
152+ - ADR created/updated (if architectural decision)
268153
269- ## Task Files (Optional)
154+ ## Commit Message Format
270155
271- For complex work, consider creating ` .tasks/YYYY-MM-DD-slug.md ` to track:
272- - Test inventory (which tests to write)
273- - Progress logbook (timestamped entries)
274- - Acceptance criteria
156+ [ Conventional Commits] ( https://conventionalcommits.org/ ) : ` <type>(<scope>): <description> `
275157
276- Not required for simple fixes. See ` .tasks/ ` for examples.
158+ ** Types:** ` feat ` , ` fix ` , ` docs ` , ` style ` , ` refactor ` , ` test ` , ` chore `
159+ ** Scopes:** ` assert ` , ` runner ` , ` cli ` , ` docs ` , etc.
277160
278161## Prohibited Actions
279162
280- ** Never do these without explicit user request:**
163+ ** Never without explicit user request:**
281164- Commit secrets or sensitive data
282165- Force push to main/master
283166- Skip git hooks (--no-verify)
284167- Amend published commits
285168- Use destructive git commands (reset --hard, clean -f)
286- - Delete branches
287169- Push to remote without confirmation
288-
289- ## ADRs (Architecture Decision Records)
290-
291- Read existing ADRs in ` adrs/ ` before making architectural changes. Create new ADRs for significant decisions using the repo's template.
292-
293- ## Commit Message Format
294-
295- Use [ Conventional Commits] ( https://conventionalcommits.org/ ) :
296-
297- ```
298- <type>(<scope>): <description>
299-
300- <optional body>
301- ```
302-
303- ** Types:** ` feat ` , ` fix ` , ` docs ` , ` style ` , ` refactor ` , ` test ` , ` chore `
304-
305- ** Scopes:** ` assert ` , ` runner ` , ` cli ` , ` docs ` , etc.
306-
307- ** Examples:**
308- ```
309- feat(assert): add assert_json_contains function
310-
311- Adds new assertion to validate JSON key-value pairs.
312- Supports nested keys and provides clear error messages.
313- ```
314-
315- ```
316- fix(runner): resolve parallel execution race condition
317-
318- Fixed race condition when multiple tests write to temp files.
319- ```
320-
321- ## Help & Resources
322-
323- ### Documentation
324- - ** Getting started:** @.claude/GETTING_STARTED.md (5-minute intro)
325- - ** Quick reference:** @.claude/QUICK_REFERENCE.md (one-page cheat sheet)
326- - ** Full docs:** https://bashunit.typeddevs.com
327- - ** Contributing:** @.github/CONTRIBUTING.md
328-
329- ### Claude Code
330- - ** This directory:** @.claude/README.md (comprehensive guide)
331- - ** Skills:** See ` .claude/skills/ ` directory
332- - ** Commands:** See ` .claude/commands/ ` directory
333- - ** Automation:** See ` .claude/agents/ ` directory
334-
335- ### Community
336- - ** Issues:** https://github.com/TypedDevs/bashunit/issues
337- - ** Discussions:** https://github.com/TypedDevs/bashunit/discussions
338-
339- ---
340-
341- ** Need help?** Start with ` @.claude/GETTING_STARTED.md ` for a quick introduction to the Claude Code configuration.
0 commit comments