|
|
1 month ago | |
|---|---|---|
| .. | ||
| fixtures | 3 months ago | |
| functional | 3 months ago | |
| reports | 3 months ago | |
| README.md | 3 months ago | |
| manual-trigger-test.md | 1 month ago | |
| run-tests.sh | 3 months ago | |
| trigger-tests.md | 1 month ago | |
| validate-triggers.sh | 3 months ago | |
Automated test suite for validating all 16 skills.
# Run all tests
./tests/skills/run-tests.sh
# Run specific test suite
./tests/skills/run-tests.sh triggers
./tests/skills/run-tests.sh data-processing
# List available tests
./tests/skills/run-tests.sh --list
| Type | Script | Purpose |
|---|---|---|
| Trigger validation | validate-triggers.sh |
Validates frontmatter and trigger keywords |
| Functional | functional/*.sh |
Tests CLI tools work correctly |
tests/skills/
├── run-tests.sh # Main test runner
├── validate-triggers.sh # Trigger keyword validation
├── trigger-tests.md # Manual trigger test cases (reference)
├── fixtures/ # Test data files
│ ├── package.json
│ ├── config.yaml
│ ├── docker-compose.yml
│ └── example.js
└── functional/
├── data-processing.sh # jq, yq tests
├── code-stats.sh # tokei, difft tests
├── git-workflow.sh # gh, delta, lazygit tests
└── structural-search.sh # ast-grep tests
./tests/skills/run-tests.sh
Output:
╔══════════════════════════════════════════╗
║ Skill Test Runner ║
╚══════════════════════════════════════════╝
═══════════════════════════════════
Trigger Validation
═══════════════════════════════════
--- code-stats ---
✓ code-stats: 6 trigger keywords
...
═══════════════════════════════════
data-processing
═══════════════════════════════════
--- jq tests ---
✓ jq: extract single field
✓ jq: extract nested field
...
════════════════════════════════════════
Test Summary
════════════════════════════════════════
Suites passed: 5
Suites failed: 0
All tests passed!
# Only trigger validation
./tests/skills/run-tests.sh --triggers
# Only functional tests
./tests/skills/run-tests.sh --functional
# Specific skill
./tests/skills/run-tests.sh data-processing
./tests/skills/run-tests.sh code-stats
# Multiple skills
./tests/skills/run-tests.sh data-processing structural-search
Validates each skill's frontmatter:
name matches directory namename is lowercase alphanumeric with hyphens (1-64 chars)description is non-empty (max 1024 chars)description contains "Triggers on:" with keywordscompatibility field exists if skill uses CLI toolsallowed-tools field is presentEach functional test:
fixtures/ directoryInstall required tools:
# All tools
brew install jq yq tokei difftastic ast-grep gh delta lazygit
# Minimum for data-processing
brew install jq yq
# Check what's installed
./tests/skills/run-tests.sh --list
Create functional/skill-name.sh:
#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
FIXTURES="$SCRIPT_DIR/../fixtures"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
PASSED=0
FAILED=0
pass() { ((PASSED++)); echo -e "${GREEN}✓${NC} $1"; }
fail() { ((FAILED++)); echo -e "${RED}✗${NC} $1: $2"; }
# Check prerequisites
check_prereqs() {
command -v your-tool >/dev/null 2>&1 || {
echo "Missing: your-tool"
exit 1
}
}
# Tests
test_example() {
local result
result=$(your-tool --version)
if [[ -n "$result" ]]; then
pass "your-tool works"
else
fail "your-tool" "no output"
fi
}
main() {
echo "=== skill-name functional tests ==="
check_prereqs
test_example
echo ""
echo "Passed: $PASSED"
echo "Failed: $FAILED"
[[ $FAILED -eq 0 ]]
}
main "$@"
Add files to fixtures/:
fixtures/example.jsonfixtures/example.yamlfixtures/example.{js,py,ts}Add to your CI workflow:
- name: Run skill tests
run: |
chmod +x tests/skills/run-tests.sh
./tests/skills/run-tests.sh
chmod +x tests/skills/*.sh tests/skills/functional/*.sh
Install missing tools:
brew install jq yq tokei difftastic ast-grep gh delta
For gh tests, run:
gh auth login