How to test and validate claude-code-java scripts and skills
A bash test script validates that the setup scripts work and that the skills conform to the Agent Skills specification. It runs locally and in CI on every push and pull request.
./scripts/test-all.sh| Script | Validations |
|---|---|
link-skills.sh |
Creates .claude/, symlink points to workspace |
generate-claude-md.sh |
Creates CLAUDE.md with content |
configure-mcp.sh |
Template file exists |
configure-settings.sh |
Creates settings.json with content |
validate-skills.sh |
Every skill passes the Agent Skills spec checks |
- Tests run in a temporary directory (auto-cleaned)
- Zero external dependencies. The reference validator
skills-refneeds Python, so it runs as a separate CI job rather than insidetest-all.sh - Fast execution (< 2 seconds)
- Clear pass/fail output
bats-core - Bash Automated Testing System
When to adopt:
- 10+ test cases
- Multiple contributors
- Want better test organization (describe/it blocks)
Example:
@test "link-skills creates symlink" {
run ./scripts/link-skills.sh "$TEST_DIR"
[ "$status" -eq 0 ]
[ -L "$TEST_DIR/.claude/skills" ]
}Install: npm install -g bats or brew install bats-core
When to adopt:
- Want to catch issues before commit
- Local-only validation
Setup:
# .git/hooks/pre-commit
#!/bin/bash
./scripts/test-all.sh || exit 1| Phase | Recommended Approach |
|---|---|
| MVP | Simple test script |
| Public release | GitHub Actions (adopted, .github/workflows/test.yml) |
| Growth with contributors | Add bats-core |
| Team adoption | Add pre-commit hooks |
When adding a new script, add corresponding tests to test-all.sh:
# Test N: new-script.sh
echo "Testing new-script.sh..."
"$SCRIPT_DIR/new-script.sh" "$TEST_DIR" > /dev/null 2>&1
check "expected output created" [ -f "$TEST_DIR/expected-output" ]
echo ""For changes that are hard to automate:
- Run
setup-project.shon a real Java project - Verify skills symlink works in Claude Code
- Test on fresh directory (no existing
.claude/) - Test on directory with existing
.claude/skills