GLSL and Shadertoy shader skills for Claude Code, Codex, Cursor, Copilot and Gemini CLI. 186 functions, SDF raymarching, procedural terrain, water, clouds and generative art, with a bundler, checker and 11 examples.
Python agent-skillsclaude-codecodexcomputer-graphicscursorgemini-cligenerative-artgithub-copilotglslnoiseprocedural-artprocedural-generationraymarchingshadersshadertoysigned-distance-functionsterrain-generationwebglwebgl2
Add a plugin-eval suite measuring the skill's effect
Gökayf26796a0b8a4
diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.ymlindex 39ca46e..b8176a0 100644--- a/.github/workflows/checks.yml+++ b/.github/workflows/checks.yml@@ -22,6 +22,8 @@ jobs:run: python3 tests/build_gallery.py --check- name: Lint, drift and compile every unitrun: python3 skills/shader-art-coding/scripts/glsl_tools.py check+ - name: Eval suite matches the plugin-eval format+ run: python3 tests/check_evals.pywebgl:name: WebGL2 compile, GPU property tests, rendersdiff --git a/.github/workflows/evals.yml b/.github/workflows/evals.ymlnew file mode 100644index 0000000..d403791--- /dev/null+++ b/.github/workflows/evals.yml@@ -0,0 +1,119 @@+name: evals++# Runs evals/ with `claude plugin eval`: every case with the plugin and again without it. Every run is a paid model+# call billed to the ANTHROPIC_API_KEY secret, so this workflow only runs when started by hand. See evals/README.md.+on:+ workflow_dispatch:+ inputs:+ case:+ description: "Case glob for --case (empty runs every case)"+ required: false+ default: ""+ runs:+ description: "Runs per case per arm"+ required: false+ default: "3"+ model:+ description: "Model under test"+ required: false+ default: "claude-sonnet-5-5"+ judge_model:+ description: "Judge model for llm graders"+ required: false+ default: "claude-haiku-5-5"+ threshold:+ description: "A case passes when its with-plugin score is at least this"+ required: false+ default: "0.8"+ max_cost_usd:+ description: "Ceiling on the list-price cost estimate, in USD"+ required: false+ default: "30"++permissions:+ contents: read++concurrency:+ group: evals++jobs:+ eval:+ name: plugin eval, with vs without the plugin+ runs-on: ubuntu-24.04+ timeout-minutes: 240+ steps:+ - uses: actions/checkout@v4+ - uses: actions/setup-python@v5+ with:+ python-version: "3.12"+ - name: Validate the suite+ run: python3 tests/check_evals.py+ - name: Install Claude Code, sandbox dependencies and glslang+ env:+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}+ run: |+ if [ -z "$ANTHROPIC_API_KEY" ]; then+ echo "::error::Add an ANTHROPIC_API_KEY repository secret to run the evals."+ exit 1+ fi+ sudo apt-get update+ sudo apt-get install -y bubblewrap socat glslang-tools+ # Ubuntu 24.04 blocks the user namespaces bubblewrap needs unless bwrap has an AppArmor profile.+ if [ "$(sysctl -n kernel.apparmor_restrict_unprivileged_userns 2>/dev/null)" = "1" ]; then+ printf '%s\n' 'abi <abi/4.0>,' 'include <tunables/global>' '' \+ 'profile bwrap /usr/bin/bwrap flags=(unconfined) {' ' userns,' ' include if exists <local/bwrap>' '}' \+ | sudo tee /etc/apparmor.d/bwrap > /dev/null+ sudo systemctl reload apparmor+ fi+ curl -fsSL https://claude.ai/install.sh | bash+ echo "$HOME/.local/bin" >> "$GITHUB_PATH"+ - name: Copy the plugin outside the home directory+ # Eval runs make the home directory unreadable to shell commands, and the checkout sits under /home/runner.+ # The skill's checker is a script inside the plugin, so run from a copy it can read.+ run: cp -R "$GITHUB_WORKSPACE" /tmp/shader-skills+ - name: Run the eval suite+ working-directory: /tmp/shader-skills+ env:+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}+ CASE: ${{ inputs.case }}+ RUNS: ${{ inputs.runs }}+ MODEL: ${{ inputs.model }}+ JUDGE_MODEL: ${{ inputs.judge_model }}+ THRESHOLD: ${{ inputs.threshold }}+ MAX_COST_USD: ${{ inputs.max_cost_usd }}+ run: |+ claude --version+ args=(--trust-plugin --no-publish --runs "$RUNS" --model "$MODEL" --judge-model "$JUDGE_MODEL"+ --threshold "$THRESHOLD" --max-cost-usd "$MAX_COST_USD" --output-dir "$GITHUB_WORKSPACE/eval-results")+ if [ -n "$CASE" ]; then args+=(--case "$CASE"); fi+ claude plugin eval . "${args[@]}" --allow-tools Write Edit Bash+ - name: Summarize+ if: always()+ run: |+ python3 - <<'PY' >> "$GITHUB_STEP_SUMMARY"+ import json+ from pathlib import Path++ path = Path("eval-results/aggregate-result.json")+ if not path.exists():+ print("No aggregate-result.json was written; see the run log.")+ raise SystemExit+ res = json.loads(path.read_text())+ num = lambda v, sign="": "—" if v is None else f"{v:{sign}.2f}"+ print("| case | with plugin | Δ vs without |\n|---|---|---|")+ for case in res.get("cases", []):+ agg = case.get("aggregates", {})+ print(f"| {case.get('name')} | {num(agg.get('score'))} | {num(agg.get('delta'), '+')} |")+ agg = res.get("aggregates", {})+ line = (f"\nOverall {num(agg.get('overallScore'))}, mean Δ {num(agg.get('meanDelta'), '+')}, "+ f"{agg.get('casesPassed')}/{agg.get('casesTotal')} cases passed, ~${num(res.get('costUsd'))}")+ if res.get("partial"):+ line += f" (partial: {res.get('partialReason')})"+ print(line)+ PY+ - uses: actions/upload-artifact@v4+ if: always()+ with:+ name: eval-results+ path: eval-results/+ if-no-files-found: warndiff --git a/.gitignore b/.gitignoreindex ea206fe..be91eec 100644--- a/.gitignore+++ b/.gitignore@@ -6,5 +6,6 @@ tmp/*.wav*.webmbuild/+evals/results/.claude/launch.json__pycache__/diff --git a/AGENTS.md b/AGENTS.mdindex 007c5e1..5df90bb 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -13,6 +13,7 @@ skills/shader-art-coding/ the skill (this is what gets installed)references/ guides and formula-code couples; library-index.md is generatedscripts/glsl_tools.py search | bundle | check | index (stdlib Python only)tests/ GPU property tests and the WebGL2 harness+evals/ `claude plugin eval` suite: skill vs no skill (paid to run; see evals/README.md)gallery/ rendered PNGs and paste-ready bundled shaders for each template (generated)adapters/ copy-in prompts for tools without skill support.claude-plugin/ Claude Code plugin + marketplace manifests@@ -27,6 +28,7 @@ python3 tests/build_gallery.py # regenerpython3 tests/build_harness.py && python3 tests/serve.py # WebGL2 checks: open /build/harness.htmlpython3 tests/build_harness.py --save-gallery # same, and rewrite gallery/*.pngpython3 tests/run_webgl.py # headless WebGL2 checks (needs playwright)+python3 tests/check_evals.py # validate evals/ without running it (free)```## Rules for library code (`glsl/`)diff --git a/README.md b/README.mdindex 5fbac05..5f915bf 100644--- a/README.md+++ b/README.md@@ -114,6 +114,7 @@ The full catalog with signatures, exactness and uses is| WebGL2 compile | `tests/` harness | all 147 units compile under ANGLE, which also enforces WebGL-only rules || GPU property tests | `tests/properties.py` | 84 tests × 16,384 samples: Lipschitz, exactness, signs, brute-force curve distance, derivatives, divergence, ranges, round trips || Renders | harness + gallery | every template renders with no NaNs and no black frames; images saved to `gallery/` |+| Skill effect | `evals/` (`claude plugin eval`, paid, manual) | output-rule adherence with the skill vs without it on 6 shader tasks, plus no false triggers on 3 near-miss tasks; see [evals/README.md](evals/README.md) |Run it locally: `python3 tests/build_harness.py && python3 tests/serve.py`, then open`http://127.0.0.1:8765/build/harness.html`. Headless: `python3 tests/run_webgl.py` (needs Playwright).@@ -135,6 +136,7 @@ Run it locally: `python3 tests/build_harness.py && python3 tests/serve.py`, then```textskills/shader-art-coding/ the skill: SKILL.md, glsl/ library, templates/, references/, scripts/glsl_tools.pytests/ WebGL2 harness, GPU property tests, gallery builder, headless runner+evals/ plugin eval suite: with vs without the skillgallery/ rendered templates and paste-ready bundlesadapters/ prompts for tools without skill support.claude-plugin/ Claude Code plugin + marketplace manifestsdiff --git a/evals/README.md b/evals/README.mdnew file mode 100644index 0000000..2b151ef--- /dev/null+++ b/evals/README.md@@ -0,0 +1,144 @@+# Evals++Does the `shader-art-coding` skill make Claude's shaders better? This suite measures it with+[`claude plugin eval`](https://code.claude.com/docs/en/plugin-evals). Each case runs with this plugin loaded and+again with no plugin, and the report shows both scores and their difference, `Δ`.++> **Running it costs money.** Every agent run and every judge call is a real model call on your account: billed to+> your API key, or counted against your plan. Validating the files is free; see [Validate](#validate-free).++## Cases++Six positive cases should trigger the skill. Three near-miss negatives sound shader-adjacent but should not.++| Case | Kind | The prompt asks for | Case-specific graders |+|---|---|---|---|+| `sdf-still-life` | positive | a raymarched bowl and fruit on a table | |+| `terrain-flyover` | positive | a camera flight over eroded desert mountains at sunset | |+| `cloud-layer` | positive | sunlit cumulus clouds drifting over a blue sky | |+| `poster-2d` | positive | a flat 2D poster: sun disc, mountain silhouettes, frame, halftone | |+| `fix-twist-holes` | positive, repair | a fix for a twisted column with holes. The prompt includes the shader, whose `map()` twists a box at 3 rad/unit with no Lipschitz correction | `twist-corrected` (judge) |+| `port-webgl1` | positive, repair | a port of a WebGL1 shader that uses `#version 100`, uniforms, `texture2D`, `gl_FragColor` and a sine hash | `samples-ichannel0`, `no-webgl1-io` |+| `neg-css-gradient` | negative | a "shader demo" animated gradient in plain CSS | `css-gradient`, `css-keyframes` |+| `neg-hlsl-compute` | negative | a Unity HLSL compute shader for a separable Gaussian blur | `hlsl-kernels`, `no-glsl` |+| `neg-matplotlib-noise` | negative | a Perlin-noise heatmap with matplotlib | `uses-matplotlib`, `saves-figure` |++Each positive prompt asks for the finished shader in `final.glsl`. Every positive case carries these five graders:++| Grader | Check | Counts toward the score |+|---|---|---|+| `mainimage` | `final.glsl` exists and has `void mainImage(out vec4 …, in vec2 …)` | yes, both arms |+| `no-banned-constructs` | `final.glsl` has no `gl_FragColor`, `texture2D(`, `#version` or `fract(sin(` outside `//` comments | yes, both arms |+| `ran-check` | the agent ran `glsl_tools.py check` on a `.glsl` file | no: with-plugin indicator (`arm: with-only`) |+| `check-clean` | the last checker output in the transcript was `0 error(s)` | no: with-plugin indicator (`arm: with-only`) |+| `skill-fired` | Claude invoked the `shader-art-coding` skill | no: excluded automatically, like every `tool_used: Skill` grader |++Each negative case has `skill-not-fired` (`tool_used: Skill`, `min: 0`, `max: 0`, `arm: both`), which counts in both+arms. Its other graders check that the agent did the non-shader task it was given.++### Why three positive graders do not count toward the score++`ran-check`, `check-clean` and `skill-fired` can never pass without the plugin, because without it the script and the+skill don't exist. Counting them would push the no-plugin score toward zero and inflate `Δ`. So `Δ` on positives+comes only from the output graders, and the indicators show in the with-plugin runs as the skill-trigger rate and the+clean-check rate. Under `--ablation none` all graders count.++### What "compile rate" means here++`claude plugin eval` has no custom-code graders, so a grader cannot compile the shader. The scored graders catch the+constructs that break Shadertoy and WebGL2 in both arms. A real glslang compile shows up only in the with-plugin+arm, through `check-clean`, and only when `glslangValidator` is on `PATH`; without it, `check` only lints. To get a+compile rate for both arms, run with `--keep-temp` and run+`python3 skills/shader-art-coding/scripts/glsl_tools.py check <run dir>/final.glsl` on each kept run.++## Requirements++- Claude Code v2.1.269 or later (`claude --version`) and git 2.31 or later.+- Credentials: export `ANTHROPIC_API_KEY`, or use the account or cloud-provider variables your normal sessions use.+- Recommended: `glslangValidator` (`brew install glslang` or `apt install glslang-tools`), so the skill's checker+ compiles as well as lints.+- Linux: `bubblewrap` and `socat` for the Bash sandbox. On Ubuntu 24.04 and later, bubblewrap also needs the+ AppArmor profile from the [sandboxing docs](https://code.claude.com/docs/en/sandboxing). The CI workflow installs it.++## Validate (free)++```bash+python3 tests/check_evals.py+```++This checks every `prompt.md` and grader against the documented fields and this suite's conventions. It also runs+the grader regexes on real inputs: the gallery shaders, the fixture shaders in the prompts, and real+`glsl_tools.py check` output. It makes no model calls. CI runs it in `checks.yml`.++## Run++Run from the repository root, which is the plugin root. Put the target `.` first and `--allow-tools` last, since it+takes a list. The cases need `Write` and `Edit` to save their output and `Bash` for the skill's checker. Without the+grant those tools are removed from the session and the positives fail. Granted Bash runs under the OS sandbox.++Smoke test: one case, one run, no baseline.++```bash+claude plugin eval . --case sdf-still-life --runs 1 --ablation none --max-cost-usd 2 --allow-tools Write Edit Bash+```++For scale: on the default model, one run of `port-webgl1` took 23 s and cost $0.15, and one run of+`neg-css-gradient` took 30 s and cost $0.15.++Full comparison: 9 cases × 3 runs × 2 arms = 54 agent sessions. Positive runs allow up to 40 turns. Add 3 judge calls+for each of the 6 `fix-twist-holes` runs. Set a ceiling you're comfortable with:++```bash+claude plugin eval . --model claude-sonnet-5-5 --judge-model claude-haiku-5-5 --threshold 0.8 --max-cost-usd 30 --allow-tools Write Edit Bash+```++Filters: `--tag positive`, `--tag negative`, `--tag repair`, or `--case 'neg-*'`. The first run in a terminal asks+`Trust this plugin directory?`. Answer `y`, or pass `--trust-plugin`.++Results go to `evals/results/<timestamp>/`, which is gitignored: `report.html` plus `aggregate-result.json`. When you're+signed in with a claude.ai subscription that has artifacts, the report is also published privately and the command+prints a `Published:` link. Pass+`--no-publish` to keep it local.++## Reading the result++- **Positives:** `WITH` is the share of output graders passed with the skill, and `W/OUT` is the same without it. A+ positive `Δ` means the skill improved output-rule adherence. Open the report to see the with-plugin+ `skill-fired`, `ran-check` and `check-clean` indicators per run.+- **Negatives:** `Δ` below 0 means the skill fired, or derailed the task, where it shouldn't have.+- **Exit code:** the default `--threshold` is `1.0`, so the command exits 1 when any case scores below perfect.+ `Δ` never changes the exit code.++## CI++[`.github/workflows/evals.yml`](../.github/workflows/evals.yml) runs the suite on manual dispatch only. Add an+`ANTHROPIC_API_KEY` repository secret, then go to Actions → evals → Run workflow. The inputs set the case glob, runs,+models, threshold and cost ceiling. The job uploads `eval-results` (report and JSON) and writes a per-case table to+the run summary.++## Adding a case++1. Create `evals/<name>/prompt.md`. Use only the documented frontmatter fields (`description`, `tags`, `runs`,+ `expected_outcome`, `model`, `max_turns`, `timeout_seconds`, `allowed_tools`, `append_system_prompt`, `env`, …).+ Double-quote any value that contains `: ` or ` #`. Write the body the way a user would type it, and name the output+ file in backticks.+2. Tag the case `positive` or `negative`. Copy the five shared graders into a positive case unchanged; a negative case+ needs `skill-not-fired.md`. Add graders for the case's own outcome. Prefer regex graders over long files and keep+ `llm` graders for short outputs.+3. Run `python3 tests/check_evals.py`, then a smoke run of the new case.++## Troubleshooting++- **`not granted` in the progress output:** add `--allow-tools Write Edit Bash`, after the target.+- **No `W/OUT` column, or "ablation requested but no plugin resolved":** add `plugins: ["../.."]` to the case's+ `prompt.md`.+- **`ran-check` passes, but `check-clean` fails and the transcript shows a permission error on `glsl_tools.py`:**+ eval runs make your home directory unreadable to shell commands, so the sandbox may block the plugin's script when+ the checkout lives under your home directory. Copy the repository outside it (for example to `/tmp/shader-skills`)+ and run from there. The CI workflow does the same. On macOS with v2.1.299, a checkout under `/Users` worked: the+ plugin directory stayed readable to sandboxed Bash.+- **`couldn't create cache file '…/xcrun_db-…' (errno=Operation not permitted)` in a macOS transcript:** the+ `/usr/bin/python3` shim tries to write an Xcode cache that the sandbox blocks. The checker still runs and prints its+ `N error(s)` line, so the noise does not affect any grader.+- **`check-clean` fails although the checker passed:** the regex reads the whole transcript. If Claude's own text+ after the last clean check quotes an earlier non-zero count like `2 error(s)`, the grader fails.diff --git a/evals/cloud-layer/graders/check-clean.md b/evals/cloud-layer/graders/check-clean.mdnew file mode 100644index 0000000..b48b688--- /dev/null+++ b/evals/cloud-layer/graders/check-clean.md@@ -0,0 +1,6 @@+---+type: regex+target: trace+pattern: '(?<!\d)0 error\(s\)(?![\s\S]*(?<!\d)[1-9]\d* error\(s\))'+arm: with-only+---diff --git a/evals/cloud-layer/graders/mainimage.md b/evals/cloud-layer/graders/mainimage.mdnew file mode 100644index 0000000..a932b14--- /dev/null+++ b/evals/cloud-layer/graders/mainimage.md@@ -0,0 +1,7 @@+---+type: regex+target:+ source: file+ path: final.glsl+pattern: '\bvoid\s+mainImage\s*\(\s*out\s+vec4\s+\w+\s*,\s*(?:in\s+)?vec2\s+\w+\s*\)'+---diff --git a/evals/cloud-layer/graders/no-banned-constructs.md b/evals/cloud-layer/graders/no-banned-constructs.mdnew file mode 100644index 0000000..dfd3ccc--- /dev/null+++ b/evals/cloud-layer/graders/no-banned-constructs.md@@ -0,0 +1,8 @@+---+type: regex+target:+ source: file+ path: final.glsl+pattern: '(?:^|\n)(?:(?!//)[^\n])*?(?:\bgl_FragColor\b|\btexture2D\s*\(|\bfract\s*\(\s*sin\s*\()|(?:^|\n)[ \t]*#[ \t]*version\b'+match: not_contains+---diff --git a/evals/cloud-layer/graders/ran-check.md b/evals/cloud-layer/graders/ran-check.mdnew file mode 100644index 0000000..9248e28--- /dev/null+++ b/evals/cloud-layer/graders/ran-check.md@@ -0,0 +1,6 @@+---+type: tool_used+tool: Bash+input_match: 'glsl_tools\.py\W{1,4}check\s+\S*\.(?:glsl|frag)'+arm: with-only+---diff --git a/evals/cloud-layer/graders/skill-fired.md b/evals/cloud-layer/graders/skill-fired.mdnew file mode 100644index 0000000..0fe7cc5--- /dev/null+++ b/evals/cloud-layer/graders/skill-fired.md@@ -0,0 +1,5 @@+---+type: tool_used+tool: Skill+input_match: '"skill"\s*:\s*"(?:[\w-]+:)?shader-art-coding"'+---diff --git a/evals/cloud-layer/prompt.md b/evals/cloud-layer/prompt.mdnew file mode 100644index 0000000..e5d9e56--- /dev/null+++ b/evals/cloud-layer/prompt.md@@ -0,0 +1,10 @@+---+description: "Volume integration of a cloud layer lit by the sun."+tags: [positive]+expected_outcome: "final.glsl is a Shadertoy mainImage cloud shader that follows the hard rules; the skill fires and its checker reports 0 errors."+max_turns: 40+timeout_seconds: 900+allowed_tools: [Read, Glob, Grep, Skill, Write, Edit, Bash]+---++Write a Shadertoy shader of a layer of puffy cumulus clouds seen from the ground, drifting slowly across a deep blue sky and lit by a low afternoon sun so their edges glow. Save the finished, paste-ready shader as `final.glsl`.diff --git a/evals/fix-twist-holes/graders/check-clean.md b/evals/fix-twist-holes/graders/check-clean.mdnew file mode 100644index 0000000..b48b688--- /dev/null+++ b/evals/fix-twist-holes/graders/check-clean.md@@ -0,0 +1,6 @@+---+type: regex+target: trace+pattern: '(?<!\d)0 error\(s\)(?![\s\S]*(?<!\d)[1-9]\d* error\(s\))'+arm: with-only+---diff --git a/evals/fix-twist-holes/graders/mainimage.md b/evals/fix-twist-holes/graders/mainimage.mdnew file mode 100644index 0000000..a932b14--- /dev/null+++ b/evals/fix-twist-holes/graders/mainimage.md@@ -0,0 +1,7 @@+---+type: regex+target:+ source: file+ path: final.glsl+pattern: '\bvoid\s+mainImage\s*\(\s*out\s+vec4\s+\w+\s*,\s*(?:in\s+)?vec2\s+\w+\s*\)'+---diff --git a/evals/fix-twist-holes/graders/no-banned-constructs.md b/evals/fix-twist-holes/graders/no-banned-constructs.mdnew file mode 100644index 0000000..dfd3ccc--- /dev/null+++ b/evals/fix-twist-holes/graders/no-banned-constructs.md@@ -0,0 +1,8 @@+---+type: regex+target:+ source: file+ path: final.glsl+pattern: '(?:^|\n)(?:(?!//)[^\n])*?(?:\bgl_FragColor\b|\btexture2D\s*\(|\bfract\s*\(\s*sin\s*\()|(?:^|\n)[ \t]*#[ \t]*version\b'+match: not_contains+---diff --git a/evals/fix-twist-holes/graders/ran-check.md b/evals/fix-twist-holes/graders/ran-check.mdnew file mode 100644index 0000000..9248e28--- /dev/null+++ b/evals/fix-twist-holes/graders/ran-check.md@@ -0,0 +1,6 @@+---+type: tool_used+tool: Bash+input_match: 'glsl_tools\.py\W{1,4}check\s+\S*\.(?:glsl|frag)'+arm: with-only+---diff --git a/evals/fix-twist-holes/graders/skill-fired.md b/evals/fix-twist-holes/graders/skill-fired.mdnew file mode 100644index 0000000..0fe7cc5--- /dev/null+++ b/evals/fix-twist-holes/graders/skill-fired.md@@ -0,0 +1,5 @@+---+type: tool_used+tool: Skill+input_match: '"skill"\s*:\s*"(?:[\w-]+:)?shader-art-coding"'+---diff --git a/evals/fix-twist-holes/graders/twist-corrected.md b/evals/fix-twist-holes/graders/twist-corrected.mdnew file mode 100644index 0000000..4c2115c--- /dev/null+++ b/evals/fix-twist-holes/graders/twist-corrected.md@@ -0,0 +1,14 @@+---+type: llm+focus:+ source: file+ path: final.glsl+---++The file is a Shadertoy shader that raymarches a box twisted around the Y axis. The original set TWIST = 3.0 radians per unit of height and stepped the full distance returned by map(), which overshoots because the twist raises the field's Lipschitz constant above 1, so the surface showed holes.++PASS if both hold:+- The twist is still applied at 1.5 radians per unit of height or more.+- The overshoot is compensated: map() divides the twisted distance by a factor above 1 or multiplies it by one below 1 (a constant such as 0.4, or a formula such as 1.0 / sqrt(1.0 + k*k*r*r)), or the march loop advances by a fraction of the distance (a step scale below 1).++FAIL if the twist was removed or weakened below 1.5, or if the only changes are more iterations, a smaller hit epsilon, or other tweaks that still step the full distance.diff --git a/evals/fix-twist-holes/prompt.md b/evals/fix-twist-holes/prompt.mdnew file mode 100644index 0000000..bf2b77d--- /dev/null+++ b/evals/fix-twist-holes/prompt.md@@ -0,0 +1,67 @@+---+description: "Repair: the given map() twists a box without Lipschitz correction, so the march overshoots and the surface tears."+tags: [positive, repair]+expected_outcome: "final.glsl keeps the twist but scales the distance (or the march step) to compensate, follows the hard rules, and passes the skill's checker."+max_turns: 40+timeout_seconds: 900+allowed_tools: [Read, Glob, Grep, Skill, Write, Edit, Bash]+---++This Shadertoy shader is supposed to show a slowly orbiting twisted column, but the surface is full of holes and torn-looking bits, worst near the edges. Can you fix it without losing the twist? Save the fixed, paste-ready shader as `final.glsl`.++```glsl+// Twisted column+const float TWIST = 3.0; // radians per unit of height++mat2 rot(float a) {+ float c = cos(a), s = sin(a);+ return mat2(c, -s, s, c);+}++float sdBox(vec3 p, vec3 b) {+ vec3 q = abs(p) - b;+ return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);+}++float map(vec3 p) {+ p.xz *= rot(TWIST * p.y);+ return sdBox(p, vec3(0.45, 1.6, 0.45));+}++vec3 calcNormal(vec3 p) {+ vec2 e = vec2(1e-3, 0.0);+ return normalize(vec3(map(p + e.xyy) - map(p - e.xyy),+ map(p + e.yxy) - map(p - e.yxy),+ map(p + e.yyx) - map(p - e.yyx)));+}++void mainImage(out vec4 fragColor, in vec2 fragCoord) {+ vec2 uv = (2.0 * fragCoord - iResolution.xy) / iResolution.y;++ float an = 0.3 * iTime;+ vec3 ro = vec3(4.0 * sin(an), 0.6, 4.0 * cos(an));+ vec3 ww = normalize(-ro);+ vec3 uu = normalize(cross(ww, vec3(0.0, 1.0, 0.0)));+ vec3 vv = cross(uu, ww);+ vec3 rd = normalize(uv.x * uu + uv.y * vv + 1.8 * ww);++ float t = 0.0;+ bool hit = false;+ for (int i = 0; i < 100; i++) {+ float d = map(ro + rd * t);+ if (d < 0.001) { hit = true; break; }+ t += d;+ if (t > 20.0) break;+ }++ vec3 col = vec3(0.08, 0.09, 0.12) - 0.05 * uv.y;+ if (hit) {+ vec3 p = ro + rd * t;+ vec3 n = calcNormal(p);+ vec3 l = normalize(vec3(0.6, 0.8, 0.4));+ float dif = clamp(dot(n, l), 0.0, 1.0);+ col = vec3(0.8, 0.55, 0.35) * (0.15 + 0.85 * dif);+ }+ fragColor = vec4(pow(col, vec3(0.4545)), 1.0);+}+```diff --git a/evals/neg-css-gradient/graders/css-gradient.md b/evals/neg-css-gradient/graders/css-gradient.mdnew file mode 100644index 0000000..320a17e--- /dev/null+++ b/evals/neg-css-gradient/graders/css-gradient.md@@ -0,0 +1,7 @@+---+type: regex+target:+ source: file+ path: hero.css+pattern: '(?:linear|radial|conic)-gradient\s*\('+---diff --git a/evals/neg-css-gradient/graders/css-keyframes.md b/evals/neg-css-gradient/graders/css-keyframes.mdnew file mode 100644index 0000000..131dbc7--- /dev/null+++ b/evals/neg-css-gradient/graders/css-keyframes.md@@ -0,0 +1,7 @@+---+type: regex+target:+ source: file+ path: hero.css+pattern: '@keyframes\s+[\w-]+'+---diff --git a/evals/neg-css-gradient/graders/skill-not-fired.md b/evals/neg-css-gradient/graders/skill-not-fired.mdnew file mode 100644index 0000000..9e8d7d5--- /dev/null+++ b/evals/neg-css-gradient/graders/skill-not-fired.md@@ -0,0 +1,8 @@+---+type: tool_used+tool: Skill+input_match: '"skill"\s*:\s*"(?:[\w-]+:)?shader-art-coding"'+min: 0+max: 0+arm: both+---diff --git a/evals/neg-css-gradient/prompt.md b/evals/neg-css-gradient/prompt.mdnew file mode 100644index 0000000..8c7f987--- /dev/null+++ b/evals/neg-css-gradient/prompt.md@@ -0,0 +1,10 @@+---+description: "Near miss: asks for a shader-demo look, but in plain CSS."+tags: [negative]+expected_outcome: "hero.css animates a CSS gradient with @keyframes; the shader skill does not fire."+max_turns: 15+timeout_seconds: 300+allowed_tools: [Read, Glob, Grep, Skill, Write, Edit, Bash]+---++For my landing page I want an animated gradient background, that soft, slowly drifting multi-colour blob look you see in WebGL shader demos, but in plain CSS with no canvas or JavaScript. Purple, coral and a little teal. Save it as `hero.css`, styling a `.hero` class.diff --git a/evals/neg-hlsl-compute/graders/hlsl-kernels.md b/evals/neg-hlsl-compute/graders/hlsl-kernels.mdnew file mode 100644index 0000000..92fca4e--- /dev/null+++ b/evals/neg-hlsl-compute/graders/hlsl-kernels.md@@ -0,0 +1,7 @@+---+type: regex+target:+ source: file+ path: Blur.compute+pattern: '#pragma\s+kernel\s+\w+[\s\S]*#pragma\s+kernel\s+\w+[\s\S]*\[\s*numthreads\s*\('+---diff --git a/evals/neg-hlsl-compute/graders/no-glsl.md b/evals/neg-hlsl-compute/graders/no-glsl.mdnew file mode 100644index 0000000..bb144c3--- /dev/null+++ b/evals/neg-hlsl-compute/graders/no-glsl.md@@ -0,0 +1,8 @@+---+type: regex+target:+ source: file+ path: Blur.compute+pattern: '\bmainImage\b|\bvec[234]\s*\(|\bgl_GlobalInvocationID\b|\bimageStore\s*\('+match: not_contains+---diff --git a/evals/neg-hlsl-compute/graders/skill-not-fired.md b/evals/neg-hlsl-compute/graders/skill-not-fired.mdnew file mode 100644index 0000000..9e8d7d5--- /dev/null+++ b/evals/neg-hlsl-compute/graders/skill-not-fired.md@@ -0,0 +1,8 @@+---+type: tool_used+tool: Skill+input_match: '"skill"\s*:\s*"(?:[\w-]+:)?shader-art-coding"'+min: 0+max: 0+arm: both+---diff --git a/evals/neg-hlsl-compute/prompt.md b/evals/neg-hlsl-compute/prompt.mdnew file mode 100644index 0000000..8cfdfb6--- /dev/null+++ b/evals/neg-hlsl-compute/prompt.md@@ -0,0 +1,10 @@+---+description: "Near miss: a GPU shader, but HLSL compute for Unity, which the skill description excludes."+tags: [negative]+expected_outcome: "Blur.compute is an HLSL compute shader with #pragma kernel and [numthreads]; no GLSL; the shader skill does not fire."+max_turns: 15+timeout_seconds: 300+allowed_tools: [Read, Glob, Grep, Skill, Write, Edit, Bash]+---++Write me an HLSL compute shader for Unity that runs a separable 9-tap Gaussian blur on a RenderTexture, with one kernel for the horizontal pass and one for the vertical pass. Save it as `Blur.compute`.diff --git a/evals/neg-matplotlib-noise/graders/saves-figure.md b/evals/neg-matplotlib-noise/graders/saves-figure.mdnew file mode 100644index 0000000..c315af4--- /dev/null+++ b/evals/neg-matplotlib-noise/graders/saves-figure.md@@ -0,0 +1,7 @@+---+type: regex+target:+ source: file+ path: plot_noise.py+pattern: 'savefig\s*\([^)]*noise\.png'+---diff --git a/evals/neg-matplotlib-noise/graders/skill-not-fired.md b/evals/neg-matplotlib-noise/graders/skill-not-fired.mdnew file mode 100644index 0000000..9e8d7d5--- /dev/null+++ b/evals/neg-matplotlib-noise/graders/skill-not-fired.md@@ -0,0 +1,8 @@+---+type: tool_used+tool: Skill+input_match: '"skill"\s*:\s*"(?:[\w-]+:)?shader-art-coding"'+min: 0+max: 0+arm: both+---diff --git a/evals/neg-matplotlib-noise/graders/uses-matplotlib.md b/evals/neg-matplotlib-noise/graders/uses-matplotlib.mdnew file mode 100644index 0000000..c7ac181--- /dev/null+++ b/evals/neg-matplotlib-noise/graders/uses-matplotlib.md@@ -0,0 +1,7 @@+---+type: regex+target:+ source: file+ path: plot_noise.py+pattern: '(?:^|\n)[ \t]*(?:import[ \t]+matplotlib|from[ \t]+matplotlib\b)'+---diff --git a/evals/neg-matplotlib-noise/prompt.md b/evals/neg-matplotlib-noise/prompt.mdnew file mode 100644index 0000000..7a5e727--- /dev/null+++ b/evals/neg-matplotlib-noise/prompt.md@@ -0,0 +1,10 @@+---+description: "Near miss: procedural noise, but as a matplotlib figure."+tags: [negative]+expected_outcome: "plot_noise.py builds a noise field with numpy and saves a matplotlib heatmap to noise.png; the shader skill does not fire."+max_turns: 15+timeout_seconds: 300+allowed_tools: [Read, Glob, Grep, Skill, Write, Edit, Bash]+---++I need a quick figure for a blog post about procedural noise: plot a 2D Perlin-style noise field as a 256x256 heatmap with matplotlib, viridis colormap and a colorbar, and save it as `noise.png`. Put the script in `plot_noise.py`. numpy is fine, but please don't add other dependencies.diff --git a/evals/port-webgl1/graders/check-clean.md b/evals/port-webgl1/graders/check-clean.mdnew file mode 100644index 0000000..b48b688--- /dev/null+++ b/evals/port-webgl1/graders/check-clean.md@@ -0,0 +1,6 @@+---+type: regex+target: trace+pattern: '(?<!\d)0 error\(s\)(?![\s\S]*(?<!\d)[1-9]\d* error\(s\))'+arm: with-only+---diff --git a/evals/port-webgl1/graders/mainimage.md b/evals/port-webgl1/graders/mainimage.mdnew file mode 100644index 0000000..a932b14--- /dev/null+++ b/evals/port-webgl1/graders/mainimage.md@@ -0,0 +1,7 @@+---+type: regex+target:+ source: file+ path: final.glsl+pattern: '\bvoid\s+mainImage\s*\(\s*out\s+vec4\s+\w+\s*,\s*(?:in\s+)?vec2\s+\w+\s*\)'+---diff --git a/evals/port-webgl1/graders/no-banned-constructs.md b/evals/port-webgl1/graders/no-banned-constructs.mdnew file mode 100644index 0000000..dfd3ccc--- /dev/null+++ b/evals/port-webgl1/graders/no-banned-constructs.md@@ -0,0 +1,8 @@+---+type: regex+target:+ source: file+ path: final.glsl+pattern: '(?:^|\n)(?:(?!//)[^\n])*?(?:\bgl_FragColor\b|\btexture2D\s*\(|\bfract\s*\(\s*sin\s*\()|(?:^|\n)[ \t]*#[ \t]*version\b'+match: not_contains+---diff --git a/evals/port-webgl1/graders/no-webgl1-io.md b/evals/port-webgl1/graders/no-webgl1-io.mdnew file mode 100644index 0000000..bcfe405--- /dev/null+++ b/evals/port-webgl1/graders/no-webgl1-io.md@@ -0,0 +1,8 @@+---+type: regex+target:+ source: file+ path: final.glsl+pattern: '(?:^|\n)[ \t]*(?:uniform|varying|attribute)\b'+match: not_contains+---diff --git a/evals/port-webgl1/graders/ran-check.md b/evals/port-webgl1/graders/ran-check.mdnew file mode 100644index 0000000..9248e28--- /dev/null+++ b/evals/port-webgl1/graders/ran-check.md@@ -0,0 +1,6 @@+---+type: tool_used+tool: Bash+input_match: 'glsl_tools\.py\W{1,4}check\s+\S*\.(?:glsl|frag)'+arm: with-only+---diff --git a/evals/port-webgl1/graders/samples-ichannel0.md b/evals/port-webgl1/graders/samples-ichannel0.mdnew file mode 100644index 0000000..df18c4a--- /dev/null+++ b/evals/port-webgl1/graders/samples-ichannel0.md@@ -0,0 +1,7 @@+---+type: regex+target:+ source: file+ path: final.glsl+pattern: '\btexture\s*\(\s*iChannel0\b'+---diff --git a/evals/port-webgl1/graders/skill-fired.md b/evals/port-webgl1/graders/skill-fired.mdnew file mode 100644index 0000000..0fe7cc5--- /dev/null+++ b/evals/port-webgl1/graders/skill-fired.md@@ -0,0 +1,5 @@+---+type: tool_used+tool: Skill+input_match: '"skill"\s*:\s*"(?:[\w-]+:)?shader-art-coding"'+---diff --git a/evals/port-webgl1/prompt.md b/evals/port-webgl1/prompt.mdnew file mode 100644index 0000000..5efe613--- /dev/null+++ b/evals/port-webgl1/prompt.md@@ -0,0 +1,42 @@+---+description: "Port a GLSL ES 1.00 (WebGL1) shader with gl_FragColor, texture2D, #version, custom uniforms and a sine hash to Shadertoy GLSL ES 3.00."+tags: [positive, repair]+expected_outcome: "final.glsl is a Shadertoy mainImage shader that samples iChannel0 with texture(), declares no uniforms or varyings, and has no gl_FragColor, texture2D, #version or sine hash."+max_turns: 40+timeout_seconds: 900+allowed_tools: [Read, Glob, Grep, Skill, Write, Edit, Bash]+---++Can you port this old WebGL1 fragment shader to Shadertoy (GLSL ES 3.00)? I'll bind the texture to iChannel0. Keep the look the same. Save the paste-ready result as `final.glsl`.++```glsl+#version 100+#ifdef GL_ES+precision mediump float;+#endif++uniform vec2 u_resolution;+uniform float u_time;+uniform sampler2D u_texture;++float rand(vec2 co) {+ return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453);+}++float noise(vec2 p) {+ vec2 i = floor(p);+ vec2 f = fract(p);+ vec2 u = f * f * (3.0 - 2.0 * f);+ return mix(mix(rand(i), rand(i + vec2(1.0, 0.0)), u.x),+ mix(rand(i + vec2(0.0, 1.0)), rand(i + vec2(1.0, 1.0)), u.x), u.y);+}++void main() {+ vec2 uv = gl_FragCoord.xy / u_resolution.xy;+ float n = noise(uv * 8.0 + u_time * 0.2);+ vec2 warp = uv + 0.03 * vec2(n - 0.5, noise(uv * 8.0 - u_time * 0.2) - 0.5);+ vec3 tex = texture2D(u_texture, warp).rgb;+ vec3 col = mix(tex, vec3(0.1, 0.3, 0.6), 0.25 * n);+ gl_FragColor = vec4(col, 1.0);+}+```diff --git a/evals/poster-2d/graders/check-clean.md b/evals/poster-2d/graders/check-clean.mdnew file mode 100644index 0000000..b48b688--- /dev/null+++ b/evals/poster-2d/graders/check-clean.md@@ -0,0 +1,6 @@+---+type: regex+target: trace+pattern: '(?<!\d)0 error\(s\)(?![\s\S]*(?<!\d)[1-9]\d* error\(s\))'+arm: with-only+---diff --git a/evals/poster-2d/graders/mainimage.md b/evals/poster-2d/graders/mainimage.mdnew file mode 100644index 0000000..a932b14--- /dev/null+++ b/evals/poster-2d/graders/mainimage.md@@ -0,0 +1,7 @@+---+type: regex+target:+ source: file+ path: final.glsl+pattern: '\bvoid\s+mainImage\s*\(\s*out\s+vec4\s+\w+\s*,\s*(?:in\s+)?vec2\s+\w+\s*\)'+---diff --git a/evals/poster-2d/graders/no-banned-constructs.md b/evals/poster-2d/graders/no-banned-constructs.mdnew file mode 100644index 0000000..dfd3ccc--- /dev/null+++ b/evals/poster-2d/graders/no-banned-constructs.md@@ -0,0 +1,8 @@+---+type: regex+target:+ source: file+ path: final.glsl+pattern: '(?:^|\n)(?:(?!//)[^\n])*?(?:\bgl_FragColor\b|\btexture2D\s*\(|\bfract\s*\(\s*sin\s*\()|(?:^|\n)[ \t]*#[ \t]*version\b'+match: not_contains+---diff --git a/evals/poster-2d/graders/ran-check.md b/evals/poster-2d/graders/ran-check.mdnew file mode 100644index 0000000..9248e28--- /dev/null+++ b/evals/poster-2d/graders/ran-check.md@@ -0,0 +1,6 @@+---+type: tool_used+tool: Bash+input_match: 'glsl_tools\.py\W{1,4}check\s+\S*\.(?:glsl|frag)'+arm: with-only+---diff --git a/evals/poster-2d/graders/skill-fired.md b/evals/poster-2d/graders/skill-fired.mdnew file mode 100644index 0000000..0fe7cc5--- /dev/null+++ b/evals/poster-2d/graders/skill-fired.md@@ -0,0 +1,5 @@+---+type: tool_used+tool: Skill+input_match: '"skill"\s*:\s*"(?:[\w-]+:)?shader-art-coding"'+---diff --git a/evals/poster-2d/prompt.md b/evals/poster-2d/prompt.mdnew file mode 100644index 0000000..5613d66--- /dev/null+++ b/evals/poster-2d/prompt.md@@ -0,0 +1,10 @@+---+description: "2D distance-field graphics: shapes, outlines, halftone, antialiasing."+tags: [positive]+expected_outcome: "final.glsl is a Shadertoy mainImage 2D poster shader that follows the hard rules; the skill fires and its checker reports 0 errors."+max_turns: 40+timeout_seconds: 900+allowed_tools: [Read, Glob, Grep, Skill, Write, Edit, Bash]+---++Design a flat 2D poster as a Shadertoy shader: a big sun disc over three overlapping mountain silhouettes, a thin inset frame, halftone dots in the sky, crisp antialiased edges, and a retro orange-and-teal palette. Save the finished, paste-ready shader as `final.glsl`.diff --git a/evals/sdf-still-life/graders/check-clean.md b/evals/sdf-still-life/graders/check-clean.mdnew file mode 100644index 0000000..b48b688--- /dev/null+++ b/evals/sdf-still-life/graders/check-clean.md@@ -0,0 +1,6 @@+---+type: regex+target: trace+pattern: '(?<!\d)0 error\(s\)(?![\s\S]*(?<!\d)[1-9]\d* error\(s\))'+arm: with-only+---diff --git a/evals/sdf-still-life/graders/mainimage.md b/evals/sdf-still-life/graders/mainimage.mdnew file mode 100644index 0000000..a932b14--- /dev/null+++ b/evals/sdf-still-life/graders/mainimage.md@@ -0,0 +1,7 @@+---+type: regex+target:+ source: file+ path: final.glsl+pattern: '\bvoid\s+mainImage\s*\(\s*out\s+vec4\s+\w+\s*,\s*(?:in\s+)?vec2\s+\w+\s*\)'+---diff --git a/evals/sdf-still-life/graders/no-banned-constructs.md b/evals/sdf-still-life/graders/no-banned-constructs.mdnew file mode 100644index 0000000..dfd3ccc--- /dev/null+++ b/evals/sdf-still-life/graders/no-banned-constructs.md@@ -0,0 +1,8 @@+---+type: regex+target:+ source: file+ path: final.glsl+pattern: '(?:^|\n)(?:(?!//)[^\n])*?(?:\bgl_FragColor\b|\btexture2D\s*\(|\bfract\s*\(\s*sin\s*\()|(?:^|\n)[ \t]*#[ \t]*version\b'+match: not_contains+---diff --git a/evals/sdf-still-life/graders/ran-check.md b/evals/sdf-still-life/graders/ran-check.mdnew file mode 100644index 0000000..9248e28--- /dev/null+++ b/evals/sdf-still-life/graders/ran-check.md@@ -0,0 +1,6 @@+---+type: tool_used+tool: Bash+input_match: 'glsl_tools\.py\W{1,4}check\s+\S*\.(?:glsl|frag)'+arm: with-only+---diff --git a/evals/sdf-still-life/graders/skill-fired.md b/evals/sdf-still-life/graders/skill-fired.mdnew file mode 100644index 0000000..0fe7cc5--- /dev/null+++ b/evals/sdf-still-life/graders/skill-fired.md@@ -0,0 +1,5 @@+---+type: tool_used+tool: Skill+input_match: '"skill"\s*:\s*"(?:[\w-]+:)?shader-art-coding"'+---diff --git a/evals/sdf-still-life/prompt.md b/evals/sdf-still-life/prompt.mdnew file mode 100644index 0000000..25b8276--- /dev/null+++ b/evals/sdf-still-life/prompt.md@@ -0,0 +1,10 @@+---+description: "SDF raymarching of a small object scene from a natural request."+tags: [positive]+expected_outcome: "final.glsl is a Shadertoy mainImage shader of the still life that follows the hard rules; the skill fires and its checker reports 0 errors."+max_turns: 40+timeout_seconds: 900+allowed_tools: [Read, Glob, Grep, Skill, Write, Edit, Bash]+---++Make me a Shadertoy shader of a small still life: a matte ceramic bowl on a wooden table with an apple, a pear and a lemon next to it, warm light from a window on the left, soft shadows, fairly tight framing. Save the finished, paste-ready shader as `final.glsl`.diff --git a/evals/terrain-flyover/graders/check-clean.md b/evals/terrain-flyover/graders/check-clean.mdnew file mode 100644index 0000000..b48b688--- /dev/null+++ b/evals/terrain-flyover/graders/check-clean.md@@ -0,0 +1,6 @@+---+type: regex+target: trace+pattern: '(?<!\d)0 error\(s\)(?![\s\S]*(?<!\d)[1-9]\d* error\(s\))'+arm: with-only+---diff --git a/evals/terrain-flyover/graders/mainimage.md b/evals/terrain-flyover/graders/mainimage.mdnew file mode 100644index 0000000..a932b14--- /dev/null+++ b/evals/terrain-flyover/graders/mainimage.md@@ -0,0 +1,7 @@+---+type: regex+target:+ source: file+ path: final.glsl+pattern: '\bvoid\s+mainImage\s*\(\s*out\s+vec4\s+\w+\s*,\s*(?:in\s+)?vec2\s+\w+\s*\)'+---diff --git a/evals/terrain-flyover/graders/no-banned-constructs.md b/evals/terrain-flyover/graders/no-banned-constructs.mdnew file mode 100644index 0000000..dfd3ccc--- /dev/null+++ b/evals/terrain-flyover/graders/no-banned-constructs.md@@ -0,0 +1,8 @@+---+type: regex+target:+ source: file+ path: final.glsl+pattern: '(?:^|\n)(?:(?!//)[^\n])*?(?:\bgl_FragColor\b|\btexture2D\s*\(|\bfract\s*\(\s*sin\s*\()|(?:^|\n)[ \t]*#[ \t]*version\b'+match: not_contains+---diff --git a/evals/terrain-flyover/graders/ran-check.md b/evals/terrain-flyover/graders/ran-check.mdnew file mode 100644index 0000000..9248e28--- /dev/null+++ b/evals/terrain-flyover/graders/ran-check.md@@ -0,0 +1,6 @@+---+type: tool_used+tool: Bash+input_match: 'glsl_tools\.py\W{1,4}check\s+\S*\.(?:glsl|frag)'+arm: with-only+---diff --git a/evals/terrain-flyover/graders/skill-fired.md b/evals/terrain-flyover/graders/skill-fired.mdnew file mode 100644index 0000000..0fe7cc5--- /dev/null+++ b/evals/terrain-flyover/graders/skill-fired.md@@ -0,0 +1,5 @@+---+type: tool_used+tool: Skill+input_match: '"skill"\s*:\s*"(?:[\w-]+:)?shader-art-coding"'+---diff --git a/evals/terrain-flyover/prompt.md b/evals/terrain-flyover/prompt.mdnew file mode 100644index 0000000..1bd405d--- /dev/null+++ b/evals/terrain-flyover/prompt.md@@ -0,0 +1,10 @@+---+description: "Heightfield terrain with atmosphere and an animated camera."+tags: [positive]+expected_outcome: "final.glsl is a Shadertoy mainImage terrain shader that follows the hard rules; the skill fires and its checker reports 0 errors."+max_turns: 40+timeout_seconds: 900+allowed_tools: [Read, Glob, Grep, Skill, Write, Edit, Bash]+---++I'd like a Shadertoy shader where the camera glides slowly over eroded desert mountains at sunset: sharp ridges, sandy valleys, a warm low sun, and haze that swallows the distant peaks. Save the finished, paste-ready shader as `final.glsl`.diff --git a/tests/check_evals.py b/tests/check_evals.pynew file mode 100644index 0000000..b56b515--- /dev/null+++ b/tests/check_evals.py@@ -0,0 +1,333 @@+#!/usr/bin/env python3+"""Validate evals/ against the `claude plugin eval` case format without running it (running costs money).++ python3 tests/check_evals.py++Checks every case's prompt.md and graders/*.md against the fields the plugin-evals docs list, enforces this suite's+conventions (positive / negative tags, identical shared graders, a skill-not-fired grader on negatives), and runs the+grader regexes on real inputs: the gallery shaders, the fixture shaders embedded in the prompts, and real output of+`glsl_tools.py check`. Frontmatter is parsed with a small YAML subset (scalars, quoted strings, flow lists, one level of+nested maps), so keep it within that subset.+"""++from __future__ import annotations++import json+import re+import subprocess+import sys+import tempfile+from pathlib import Path++ROOT = Path(__file__).resolve().parents[1]+EVALS = ROOT / "evals"+TOOLS = ROOT / "skills" / "shader-art-coding" / "scripts" / "glsl_tools.py"++# https://code.claude.com/docs/en/plugin-evals#prompt-md-fields and #grader-frontmatter+PROMPT_FIELDS = {"schema_version", "name", "description", "tags", "plugins", "runs", "expected_outcome", "model",+ "max_turns", "timeout_seconds", "allowed_tools", "append_system_prompt", "env"}+GRADER_COMMON = {"type", "weight", "arm"}+GRADER_OPTIONS = {+ "regex": {"pattern", "flags", "match", "target"},+ "tool_used": {"tool", "input_match", "min", "max"},+ "tool_order": {"before", "after"},+ "file_exists": {"path", "exists"},+ "llm": {"criteria", "focus"},+ "baseline": {"baseline_file", "criteria"},+}+TARGETS = {"last_message", "trace", "files", "mock_calls"}+TOOLS_KNOWN = {"Read", "Glob", "Grep", "NotebookRead", "Skill", "AskUserQuestion", "Agent", "TodoWrite", "TaskCreate",+ "TaskGet", "TaskList", "TaskUpdate", "TaskStop", "Bash", "Write", "Edit", "WebFetch", "WebSearch"}+# graders every positive case carries, byte-identical+SHARED_POSITIVE = ["mainimage", "no-banned-constructs", "ran-check", "check-clean", "skill-fired"]++errors: list[str] = []+++def fail(where: str, msg: str) -> None:+ errors.append(f"{where}: {msg}")+++# ------------------------------------------------------------------------------------------- frontmatter++def scalar(v: str, where: str):+ if v.startswith("'"):+ if len(v) < 2 or not v.endswith("'") or "'" in v[1:-1].replace("''", ""):+ fail(where, f"bad single-quoted string: {v}")+ return v[1:-1].replace("''", "'")+ if v.startswith('"'):+ try:+ return json.loads(v)+ except json.JSONDecodeError:+ fail(where, f"bad double-quoted string: {v}")+ return v+ if v.startswith("["):+ if not v.endswith("]"):+ fail(where, f"unterminated flow list: {v}")+ return [scalar(x.strip(), where) for x in v[1:-1].split(",") if x.strip()]+ if re.fullmatch(r"-?\d+", v):+ return int(v)+ if re.fullmatch(r"-?\d+\.\d+", v):+ return float(v)+ if v in ("true", "false"):+ return v == "true"+ if ": " in v or " #" in v or v[0] in "{&*!|>%@`":+ fail(where, f"quote this value: {v}")+ return v+++def frontmatter(path: Path) -> tuple[dict, str]:+ where = str(path.relative_to(ROOT))+ text = path.read_text(encoding="utf-8")+ m = re.match(r"---\n(.*?)\n---(?:\n|$)(.*)", text, re.S)+ if not m:+ fail(where, "missing --- frontmatter ---")+ return {}, text+ data: dict = {}+ nested = None+ for line in m.group(1).split("\n"):+ if not line.strip() or line.lstrip().startswith("#"):+ continue+ kv = re.match(r"( *)([A-Za-z_][\w-]*):(?: +(.*))?$", line)+ if not kv:+ fail(where, f"cannot parse line: {line!r}")+ continue+ indent, key, val = kv.groups()+ target = data+ if indent:+ if nested is None:+ fail(where, f"unexpected indent: {line!r}")+ continue+ target = data[nested]+ if key in target:+ fail(where, f"duplicate key {key}")+ if val is None and not indent:+ target[key] = {}+ nested = key+ else:+ target[key] = scalar((val or "").strip(), where)+ if not indent:+ nested = None+ return data, m.group(2)+++# ------------------------------------------------------------------------------------------- regexes++def js_regex(pattern: str, flags: str, where: str) -> re.Pattern | None:+ """Compile a grader's JavaScript regex with Python's re, rejecting syntax only one of the two accepts."""+ if re.search(r"\(\?[aiLmsux]+\)|\(\?P|\(\?>|\\[AZz]|[*+?}]\+", pattern):+ fail(where, f"pattern uses syntax JavaScript does not accept: {pattern}")+ if set(flags) - set("dgimsuyv"):+ fail(where, f"unknown JavaScript regex flags: {flags}")+ py_flags = (re.I if "i" in flags else 0) | (re.M if "m" in flags else 0) | (re.S if "s" in flags else 0)+ try:+ return re.compile(pattern, py_flags)+ except re.error as e:+ fail(where, f"pattern does not compile: {e}")+ return None+++def grader_regex(case: str, grader: str) -> re.Pattern:+ data, _ = frontmatter(EVALS / case / "graders" / f"{grader}.md")+ key = "input_match" if data["type"] == "tool_used" else "pattern"+ rx = js_regex(data[key], data.get("flags", ""), f"{case}/{grader}")+ assert rx is not None+ return rx+++# ------------------------------------------------------------------------------------------- format++def check_target(value, where: str, key: str) -> str | None:+ """Validate a target/focus value; return the workspace path it reads, if any."""+ if isinstance(value, dict):+ if set(value) != {"source", "path"} or value["source"] != "file" or not value["path"]:+ fail(where, f"{key} must be one of {sorted(TARGETS)} or {{source: file, path: <path>}}")+ return None+ return value["path"]+ if value not in TARGETS:+ fail(where, f"{key} {value!r} is not one of {sorted(TARGETS)}")+ return None+++def check_grader(path: Path, prompt_body: str) -> None:+ where = str(path.relative_to(ROOT))+ data, body = frontmatter(path)+ gtype = data.get("type")+ if gtype not in GRADER_OPTIONS:+ fail(where, f"type {gtype!r} is not one of {sorted(GRADER_OPTIONS)}")+ return+ for key in set(data) - GRADER_COMMON - GRADER_OPTIONS[gtype]:+ fail(where, f"unknown key {key!r} for a {gtype} grader")+ if "arm" in data and data["arm"] not in ("with-only", "both"):+ fail(where, "arm must be with-only or both")+ if "weight" in data and not (isinstance(data["weight"], (int, float)) and data["weight"] > 0):+ fail(where, "weight must be a positive number")+ if gtype != "llm" and body.strip():+ fail(where, "only llm graders carry a body in this suite; put options in frontmatter")+ file_read = None+ if gtype == "regex":+ if not data.get("pattern"):+ fail(where, "regex grader needs a pattern")+ else:+ js_regex(data["pattern"], data.get("flags", ""), where)+ if "match" in data and not re.fullmatch(r"not_contains|count:\d+", str(data["match"])):+ fail(where, "match must be not_contains or count:N")+ file_read = check_target(data.get("target", "last_message"), where, "target")+ elif gtype == "tool_used":+ if not data.get("tool"):+ fail(where, "tool_used grader needs a tool")+ if "input_match" in data:+ js_regex(data["input_match"], "", where)+ for key in ("min", "max"):+ if key in data and not (isinstance(data[key], int) and data[key] >= 0):+ fail(where, f"{key} must be a non-negative integer")+ elif gtype == "llm":+ if not body.strip() and not data.get("criteria"):+ fail(where, "llm grader needs criteria (the file body)")+ file_read = check_target(data.get("focus", "last_message"), where, "focus")+ elif gtype == "file_exists" and not data.get("path"):+ fail(where, "file_exists grader needs a path")+ if file_read and f"`{file_read}`" not in prompt_body:+ fail(where, f"grades {file_read}, but the prompt never asks for `{file_read}`")+++def check_case(case_dir: Path) -> str | None:+ """Validate one case; return its polarity tag."""+ where = str(case_dir.relative_to(ROOT))+ data, body = frontmatter(case_dir / "prompt.md")+ for key in set(data) - PROMPT_FIELDS:+ fail(where, f"unknown prompt.md field {key!r} (unknown keys are an error)")+ if not body.strip():+ fail(where, "prompt body is empty")+ if not 1 <= data.get("max_turns", 10) <= 200:+ fail(where, "max_turns must be 1..200")+ if not 1 <= data.get("timeout_seconds", 300) <= 3600:+ fail(where, "timeout_seconds must be 1..3600")+ if not 1 <= data.get("runs", 3) <= 50:+ fail(where, "runs must be 1..50")+ for tool in data.get("allowed_tools", []):+ if re.sub(r"\(.*\)$", "", tool) not in TOOLS_KNOWN:+ fail(where, f"unknown tool {tool!r} in allowed_tools")+ for key in data.get("env", {}) or {}:+ if not re.fullmatch(r"EVAL_[A-Z0-9_]*", key):+ fail(where, f"env key {key} must match EVAL_[A-Z0-9_]*")+ graders = sorted((case_dir / "graders").glob("*.md"))+ if not graders:+ fail(where, "a case needs at least one grader")+ for g in graders:+ check_grader(g, body)+ polarity = {"positive", "negative"} & set(data.get("tags", []))+ if len(polarity) != 1:+ fail(where, "tag the case with exactly one of positive / negative")+ return None+ return polarity.pop()+++def check_suite_policy(positives: list[Path], negatives: list[Path]) -> None:+ for name in SHARED_POSITIVE:+ texts = {}+ for case in positives:+ p = case / "graders" / f"{name}.md"+ if not p.exists():+ fail(str(case.relative_to(ROOT)), f"positive case is missing the shared grader {name}.md")+ else:+ texts[case.name] = p.read_text(encoding="utf-8")+ if len(set(texts.values())) > 1:+ fail("evals", f"shared grader {name}.md differs between positive cases: {sorted(texts)}")+ for case in negatives:+ p = case / "graders" / "skill-not-fired.md"+ if not p.exists():+ fail(str(case.relative_to(ROOT)), "negative case needs graders/skill-not-fired.md")+ continue+ data, _ = frontmatter(p)+ if (data.get("tool"), data.get("min"), data.get("max"), data.get("arm")) != ("Skill", 0, 0, "both"):+ fail(str(p.relative_to(ROOT)), "skill-not-fired needs tool: Skill, min: 0, max: 0, arm: both")+++# ------------------------------------------------------------------------------------------- grader self-tests++def fixture(case: str) -> str:+ _, body = frontmatter(EVALS / case / "prompt.md")+ m = re.search(r"```glsl\n(.*?)```", body, re.S)+ assert m, f"{case}: no ```glsl fixture in the prompt"+ return m.group(1)+++def checker_output(src: str) -> str:+ with tempfile.TemporaryDirectory() as tmp:+ path = Path(tmp) / "final.glsl"+ path.write_text(src, encoding="utf-8")+ run = subprocess.run([sys.executable, str(TOOLS), "check", str(path)], capture_output=True, text=True)+ return run.stdout+++def expect(name: str, rx: re.Pattern, text: str, found: bool) -> None:+ if bool(rx.search(text)) != found:+ fail("self-test", f"{name}: expected {'a match' if found else 'no match'}")+++def self_tests() -> None:+ main_rx = grader_regex("sdf-still-life", "mainimage")+ banned_rx = grader_regex("sdf-still-life", "no-banned-constructs")+ for shader in sorted((ROOT / "gallery").glob("*.glsl")):+ text = shader.read_text(encoding="utf-8")+ expect(f"mainimage on gallery/{shader.name}", main_rx, text, True)+ expect(f"no-banned-constructs on gallery/{shader.name}", banned_rx, text, False)++ twisted, webgl1 = fixture("fix-twist-holes"), fixture("port-webgl1")+ expect("mainimage on the twist fixture", main_rx, twisted, True)+ expect("no-banned-constructs on the twist fixture", banned_rx, twisted, False)+ expect("mainimage on the WebGL1 fixture", main_rx, webgl1, False)+ for token in ("gl_FragColor = vec4(1.0);", "c = texture2D(t, uv);", "#version 300 es",+ "return fract(sin(x) * 43758.5453);"):+ expect(f"no-banned-constructs on {token!r}", banned_rx, "void f() {}\n" + token, True)+ expect(f"no-banned-constructs on a comment about {token!r}", banned_rx, "x = 1.0; // was " + token, False)+ io_rx = grader_regex("port-webgl1", "no-webgl1-io")+ expect("no-webgl1-io on the WebGL1 fixture", io_rx, webgl1, True)+ expect("no-webgl1-io on the twist fixture", io_rx, twisted, False)++ clean, dirty = checker_output(twisted), checker_output(webgl1)+ if "0 error(s)" not in clean or "0 error(s)" in dirty:+ fail("self-test", f"unexpected glsl_tools.py check output:\n{clean}\n{dirty}")+ clean_rx = grader_regex("sdf-still-life", "check-clean")+ # Traces and tool inputs are compact JSON (no spaces after `:` or `,`), as in a real v2.1.299 eval trace.+ compact = lambda o: json.dumps(o, separators=(",", ":")) # noqa: E731+ as_trace = lambda *outs: "\n".join(compact({"type": "tool_result", "content": o}) for o in outs) # noqa: E731+ expect("check-clean on [clean]", clean_rx, as_trace(clean), True)+ expect("check-clean on [failing, clean]", clean_rx, as_trace(dirty, clean), True)+ expect("check-clean on [clean, failing]", clean_rx, as_trace(clean, dirty), False)+ expect("check-clean on [failing]", clean_rx, as_trace(dirty), False)+ expect("check-clean on '10 error(s)'", clean_rx, as_trace("10 error(s), 0 warning(s)"), False)++ ran_rx = grader_regex("sdf-still-life", "ran-check")+ bash = lambda cmd: compact({"command": cmd, "description": "Check the shader"}) # noqa: E731+ expect("ran-check on a relative check", ran_rx, bash("python3 scripts/glsl_tools.py check out.glsl"), True)+ expect("ran-check on a quoted absolute check", ran_rx,+ bash('cd /p/skills/shader-art-coding && python3 "scripts/glsl_tools.py" check "/w/final.glsl"'), True)+ expect("ran-check on the library self-check", ran_rx, bash("python3 scripts/glsl_tools.py check"), False)+ expect("ran-check on a bundle", ran_rx, bash("python3 scripts/glsl_tools.py bundle shader.glsl -o out.glsl"),+ False)++ skill_rx = grader_regex("sdf-still-life", "skill-fired")+ skill = lambda name: compact({"skill": name, "args": "Port the shader"}) # noqa: E731+ expect("skill-fired, namespaced", skill_rx, skill("shader-skills:shader-art-coding"), True)+ expect("skill-fired, bare", skill_rx, skill("shader-art-coding"), True)+ expect("skill-fired, other skill", skill_rx, skill("shader-skills:other"), False)+++def main() -> int:+ cases = sorted(p.parent for p in EVALS.glob("*/prompt.md"))+ polarity = {c: check_case(c) for c in cases}+ positives = [c for c, p in polarity.items() if p == "positive"]+ negatives = [c for c, p in polarity.items() if p == "negative"]+ check_suite_policy(positives, negatives)+ if not errors:+ self_tests()+ for e in errors:+ print(f"ERROR {e}")+ print(f"{len(cases)} case(s): {len(positives)} positive, {len(negatives)} negative; {len(errors)} error(s)")+ return 1 if errors else 0+++if __name__ == "__main__":+ sys.exit(main())