/gavel-skills:gavel-fixture-testerfrom gavel-skills
Create and run Gavel fixture-based tests and TODO executable definitions of done using Markdown command blocks, tables, test/lint steps, acceptance checklists, and CEL assertions. Use when authoring standalone fixtures or persisted TODO Verification content.
Ships in gavel-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Create fixture-based tests for CLI commands using Gavel's Markdown fixture format. Fixtures define test cases with YAML frontmatter, command blocks, tables, test/lint steps, and CEL validation expressions.
gavel fixtures --help is the complete, authoritative spec for every frontmatter key, special table column, CEL variable/function, and code-fence format.
Use this skill as the practical authoring guide and reach for --help when the exact field list matters.
This file is itself a valid fixture. Run it to verify all examples parse and execute:
gavel fixtures .agents/skills/gavel-fixture-tester/SKILL.md
For running tests and linters outside fixtures, see gavel-runner. For TODO storage, review, and checking, see
gavel-todos.
When authoring persisted TODO Verification content, treat it as the TODO's executable definition of done:
## Verification when embedding it in a TODO body or portable .todos Markdown.## Verification heading in a standalone file passed to gavel todos create --verification @verification.md.gavel fixtures outline .tmp/verification.md to inspect parsing, then gavel fixtures .tmp/verification.md to execute it before attaching it.gavel todos check <todo> after implementation to execute the persisted definition of done and record its lifecycle result.Use gavel fixtures when:
Use regular Go tests when:
Every fixture file can start with --- delimited YAML front-matter:
---
build: go build -o myapp # Run once before all tests
exec: ./myapp # Default executable (default: bash)
args: [--verbose] # Default arguments
env: # Environment variables
LOG_LEVEL: debug
cwd: ./testdir # Working directory (resolved relative to fixture file location)
terminal: pty # Pseudo-terminal mode (merges stdout/stderr)
codeBlocks: [bash] # Languages to execute (default: [bash])
files: "**/*.go" # Glob: replicate tests per matching file
timeout: 30s # Total timeout
os: linux # OS constraint ("!darwin" = skip on macOS)
arch: amd64 # Architecture constraint
skip: "test -z $CI" # Bash command; exit 0 = skip fixture
---
Each row is a test. Column headers map to fixture fields. Prefer this format when tests share the same executable and differ only in arguments or expected output.
Supported column headers (case-insensitive):
Input: name, cli/command/exec, args, cwd, query, terminal/term, os, arch, skip
Expectations: exit code, expected output/output, expected error/error, format, count, cel/validation/expr
Unrecognized columns become custom template variables, usable in exec, args, and build through Go template syntax ({{.colName}}). They are also
accessible in CEL through expectations.Properties["col"].
Custom keys in YAML frontmatter provide global defaults for template variables. Per-row column values override frontmatter defaults. Empty cells use the frontmatter default.
Priority (highest to lowest): file expansion vars > table column values > frontmatter metadata
Use sections (## Section Name) to group related tables within a file.
The most common pattern: frontmatter defines a command template, table columns fill in the variables per row.
---
exec: bash
args: ["-c", "curl {{.flags}} {{.baseUrl}}{{.path}}"]
baseUrl: https://httpbin.flanksource.com
flags: "-s"
---
| Name | path | CEL Validation |
|---|---|---|
| get endpoint | /get | json.url.contains("httpbin") |
| get ip | /ip | json.origin != "" |
| get with headers | /get | stdout.contains("HTTP") |
| Name | Command | Exit Code | CEL Validation |
|---|---|---|---|
| Echo stdout | echo hello world | 0 | stdout.contains("hello") |
| Exit code zero | echo ok | 0 | exitCode == 0 |
| Non-zero exit | exit 1 | 1 | exitCode == 1 |
| Stderr output | echo "err msg" >&2 | 0 | stderr.contains("err msg") |
| Multiword contains | echo "the quick brown fox" | 0 | stdout.contains("quick") && stdout.contains("fox") |
| Negation check | echo "success" | 0 | !stdout.contains("error") |
| Regex match | echo "version 1.2.3" | 0 | stdout.matches("version [0-9]+\.[0-9]+\.[0-9]+") |
| Name | Command | Exit Code | CEL Validation |
|---|---|---|---|
| JSON object | echo '{"name":"test","count":3}' | 0 | json.name == "test" && json.count == 3.0 |
| JSON array | echo '[{"id":1},{"id":2}]' | 0 | size(json) == 2 && json[0].id == 1.0 |
| JSON nested | echo '{"data":{"items":["a","b"]}}' | 0 | size(json.data.items) == 2 |
| Name | Command | Exit Code | CEL Validation |
|---|---|---|---|
| Detect color codes | printf '\033[31mred text\033[0m' | 0 | ansi.has_color == true && ansi.has_any == true |
| Plain text no ANSI | echo "no colors here" | 0 | ansi.has_any == false && ansi.has_color == false |
| Cursor movement | printf '\033[2Amoved up' | 0 | ansi.has_updates == true |
Use ### command: <test name> headings for tests that need multi-line scripts, setup/teardown, or per-test YAML config.
YAML config block fields: cwd, exitCode, env, timeout, terminal, os, arch, skip
Validation bullet prefixes:
cel: <expr> — Raw CEL expressioncontains: <text> — Converts to stdout.contains("<text>")regex: <pattern> — Converts to stdout.matches("<pattern>")not: contains: <text> — Converts to !stdout.contains("<text>")not: <expr> — Converts to !(<expr>)Multiple validations are joined with &&.
exitCode: 0
TMPFILE=$(mktemp)
echo "hello from tempfile" > "$TMPFILE"
cat "$TMPFILE"
rm -f "$TMPFILE"
export MY_VAR="fixture_value"
echo "var is $MY_VAR"
exitCode: 1
echo "expected failure" >&2
exit 1
echo "line1: alpha"
echo "line2: beta"
echo "line3: gamma"
exitCode: 1
exit 1
exitCode: 0
timeout: 10
echo "completed within timeout"
Executable code blocks outside command: headings are auto-detected. Test name comes from the nearest preceding heading.
echo "standalone block detected"
Override YAML block values on the code fence info string: exitCode=N, timeout=N (seconds).
| Variable | Type | Description |
|---|---|---|
stdout / output | string | Process stdout |
stderr | string | Process stderr |
exitCode | int | Process exit code |
json | any | Auto-parsed JSON (when stdout starts with { or [) |
name | string | Test name |
sourceDir | string | Directory containing fixture file |
query | string | Query string |
expectations | object | Expected values |
executablePath | string | Path to gavel binary |
workDir | string | Working directory |
GIT_ROOT_DIR | string | Nearest parent with .git (also env var) |
GO_ROOT_DIR | string | Nearest parent with go.mod (also env var) |
ROOT_DIR | string | GIT_ROOT_DIR > GO_ROOT_DIR > workDir (also env var) |
ansi.has_color | bool | Output contains ANSI color codes (foreground/background) |
ansi.has_any | bool | Output contains any ANSI escape sequences |
ansi.has_updates | bool | Output contains cursor movement/screen update codes |
File expansion variables (when files: is set): file, filename, dir, absfile, absdir, basename, ext
Built-in: contains(), startsWith(), endsWith(), matches(regex), size(), all(), exists(), filter()
Extended (gomplate): strings.*, math.*, regexp.*, conv.*, coll.*, data.JSON, data.YAML, file.*, time.*
exec, build, and args support Go template syntax:
exec: bash
args: ["-c", "curl {{.flags}} {{.baseUrl}}{{.path}}"]
Sources (highest to lowest priority):
files: is set): .file, .filename, .dir, .absfile, .absdir, .basename, .ext.path, .flags).baseUrl).executablePath, .workDir, .name, .query, .GIT_ROOT_DIR, .GO_ROOT_DIR, .ROOT_DIR| Language | Executor |
|---|---|
| bash, sh, shell | bash -c |
| python, py, python3 | python -c |
| typescript, ts | ts-node -e |
| javascript, js | node -e |
| pwsh, powershell | pwsh -Command |
| go | go (direct) |
Non-executable (config): yaml, frontmatter, json
gavel fixtures <fixture-files...>
gavel fixtures tests.md
gavel fixtures fixtures/**/*.md
gavel fixtures -v tests.md # Verbose (stderr on pass, stdout+stderr on fail)
gavel fixtures -vv tests.md # More verbose (stdout+stderr always)
gavel fixtures --no-progress tests.md # Disable progress display
gavel fixtures --json tests.md # JSON output
gavel fixtures --json tests.md 2>/dev/null # JSON only, no logs
Tests run in parallel (2-minute timeout per test, 5-minute for build).
The working directory for each test is resolved with the following priority (highest wins):
cwd in a frontmatter code block, or cwd/dir/working directory table columncwd in the YAML front-matter at the top of the fixture file--path flag)Relative paths are resolved from SourceDir (the fixture file's directory). Absolute paths are used directly.
Environment variables set via env: in file-level front-matter or per-test frontmatter blocks are passed to the executed command.
Example — file-level CWD with per-test override:
---
cwd: ./src # default for all tests in this file
env:
NODE_ENV: test
---
| Name | CWD | Command | CEL |
|---|---|---|---|
| test from src | ls | stdout.contains("main.go") | |
| test from root | .. | ls | stdout.contains("src") |
In the table above, "test from src" inherits ./src from front-matter. "test from root" overrides to .. (resolved as <fixture-dir>/..).
Read the command or executable being tested. Identify:
Place fixture files alongside the code they test, typically in fixtures/testdata/ or a testdata/ directory near the relevant package.
File naming: <feature-name>.md using kebab-case.
Prefer CEL expressions for flexible validation:
stdout.contains("text") for substring checksjson.field == value when testing JSON outputexitCode == N for exit code checks!stdout.contains("text") for negative assertions&& for multiple conditionsgavel fixtures <your-fixture-file>.md
Fix failures and iterate until all tests pass.
args with {{.col}} placeholders and vary inputs through
per-row columns.### command: <name>) when tests need multi-line scripts, setup/teardown, or per-test YAML config that cannot be expressed as
one templated command.## Section Name) to group related tables within a filecodeBlocks: [bash] in front-matter when mixing executable and non-executable code blocksexitCode when expecting non-zero{ or [ for auto-parsing2>/dev/null to suppress log output from stdout: gavel cmd --json 2>/dev/nullcontains: shorthand over cel: stdout.contains(...) for simple substring checks (command blocks only — tables use CEL Validation column)os: and arch: front-matter constraintsWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub flanksource/gavel --plugin gavel-skills6 skills in this plugin
/gavel-ci-migratorMigrate a repo's GitHub Actions lint and test workflows onto the flanksource/gavel composite action — discover existing golangci-lint / go test / make lint|test jobs, ask the user per-workflow whether to replace, add alongside, or skip, rewrite YAML with the right permissions and checkout depth, and verify with actionlint without auto-committing/gavel-gitUse gavel instead of gh/git for pull requests, CI status, and commits — check a PR's checks with gavel pr status, open PRs with AI-generated content, and commit with gavel commit/gavel-runnerRun gavel test and lint, focus on a subset, re-run only failures (defaults to .gavel/last.json), filter noise with baselines, and pull JSON/markdown results from finished or live runs/gavel-todosCreate, inspect, review, verify, and maintain PostgreSQL-backed Gavel TODOs without starting implementation runs. Use for creating or syncing TODOs, attaching durable plans, authoring fixture-backed executable definitions of done, reviewing plans, running gavel todos check, inspecting history, or importing and exporting portable .todos Markdown./gavel-triageTriage a Gavel TODO backlog by sorting work into keep, shape, investigate, retire, merge, or duplicate; detecting completed or duplicate work; setting priority, labels and status; and preparing survivors for external execution with scope, acceptance criteria, and an executable definition of done. Use for backlog cleanup, choosing the next task, shaping raw TODOs, or investigating stuck work.