verify-k6-script
Skill1 starsChanged 3 months agoMITView on GitHub
Type: skill (bounded model) · Used by: perf-author · Status: IMPLEMENTED (P1) Confirm an authored k6 script actually validates and runs before it ships. Inputs: - script_path — path to the in-flight script, always under drafts/<team>/<profile>/script.js - env_vars — map of env vars to pass (credentials, BASE_URL, etc.) — never hardcoded in the script Hard rules (read before doing anything): 1. script_path MUST be under drafts/ — refuse any path outside it (that is run-k6-script's job) 2. Cap fix rounds…
In this repository42 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- k6-browser-testSkill
- k6-load-testSkill
- k6-playwright-converterSkill
- k6-smoke-testSkill
- k6-test-plannerSkill
- apply-ws2-conventionsSkill
- author-resilient-playwrightSkill
- build-status-viewsSkill
- choose-k6-execution-modeSkill
- compare-coreSkill
- compare-to-baselineSkill
- corroborate-2-sourcesSkill
- curate-baselinesSkill
- doc-consistency-checkSkill
- emit-otlp-and-prometheusSkill
- estimate-token-costSkill
- explore-product-structureSkill
- file-perf-regression-jiraSkill
- func-verdictSkill
- heal-playwright-suiteSkill
- k6-profile-benchmarkSkill
- k6-profile-loadSkill
- k6-profile-soakSkill
- k6-profile-spikeSkill
- k6-profile-stressSkill
- learn-via-k6-docsSkill
- link-grafana-panelSkill
- notify-responsible-teamSkill
- open-draft-prSkill
- parse-k6-json-summarySkill
- parse-playwright-summarySkill
- perf-run-logSkill
- run-k6-scriptSkill
- run-ledgerSkill
- run-playwright-suiteSkill
- scope-reviewSkill
- scrub-har-secretsSkill
- triage-func-verdictSkill
- triage-perf-verdictSkill
- verify-playwright-suiteSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 7 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Never write credentials or secrets into the script file
- Very specific: line 19
Write validate + run output to reports/verify-<team>-<profile>-<timestamp>.txt
- Very specific: line 25
Read script_path from disk.
- Very specific: line 29
Call mcp__k6__validate_script with the script content.
- Distinctive: line 32
If validation passes → proceed to Step 3
- Distinctive: line 33
If validation fails → go to Fix loop (Step 4), then re-validate
- Very specific: line 41
HTTP script: call mcp__k6__run_script(script: <content>, vus: 1, iterations: 1)
- Very specific: line 43
Browser script: use Bash: k6 run <script_path> with env vars — do NOT use mcp__k6__run_script (it passes --vus/--iterations CLI flags that …
- Distinctive: line 48
Check: exit code 0, no threshold breaches, checks pass
- Distinctive: line 49
If smoke run passes → proceed to Step 5 (write report, return PASS)
- Distinctive: line 50
If smoke run fails → go to Fix loop (Step 4)
- Very specific: line 56
API / syntax errors: call mcp__k6__get_documentation or mcp__k6__list_sections for the failing construct first.
- Distinctive: line 58
Browser selector / interaction failures: use Playwright MCP to explore the live page — do NOT ask the user:
- Very specific: line 81
Write results to reports/verify-<team>-<profile>.txt:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
verify-k6-script
Validate, run, and fix an authored k6 script in a bounded loop.
Type: skill (bounded model) · Used by: perf-author · Status: IMPLEMENTED (P1)
Prompt
Confirm an authored k6 script actually validates and runs before it ships.
Inputs:
script_path— path to the in-flight script, always underdrafts/<team>/<profile>/script.jsenv_vars— map of env vars to pass (credentials, BASE_URL, etc.) — never hardcoded in the script
Hard rules (read before doing anything):
script_pathMUST be underdrafts/— refuse any path outside it (that isrun-k6-script's job)- Cap fix rounds at 3 — if it still fails after round 3, report FAIL and stop; never loop forever
- A non-zero exit code is a FAIL — never swallow it (99 = threshold breach, 97 = crash/abort; both fail verify)
- Never write credentials or secrets into the script file
- Write validate + run output to
reports/verify-<team>-<profile>-<timestamp>.txt
Step 1 — Read the script
Read script_path from disk.
Step 2 — Validate (syntax + API check, no network)
Call mcp__k6__validate_script with the script content.
- Tool:
mcp__k6__validate_script(script: <content>) - If validation passes → proceed to Step 3
- If validation fails → go to Fix loop (Step 4), then re-validate
Step 3 — Smoke run (real network, 1 VU, 1 iteration)
First: detect script type — inspect the script content for browser imports:
import { browser } from 'k6/browser'ORimport { chromium } from 'k6/browser'→ browser script- Anything else → HTTP script
HTTP script: call mcp__k6__run_script(script: <content>, vus: 1, iterations: 1)
Browser script: use Bash: k6 run <script_path> with env vars — do NOT use mcp__k6__run_script (it passes --vus/--iterations CLI flags that override options.browser and prevent the browser scenario from running):
k6 run -e PERF_USERNAME=<u> -e STAGING_PASSWORD=<p> -e ENVIRONMENT=stg <script_path>- Check: exit code 0, no threshold breaches, checks pass
- If smoke run passes → proceed to Step 5 (write report, return PASS)
- If smoke run fails → go to Fix loop (Step 4)
Step 4 — Fix loop (max 3 rounds, fully autonomous — never ask the user)
For each failure, self-diagnose using tools before editing:
API / syntax errors: call mcp__k6__get_documentation or mcp__k6__list_sections for the failing construct first. Validate with mcp__k6__validate_script after each edit.
Browser selector / interaction failures: use Playwright MCP to explore the live page — do NOT ask the user:
mcp__playwright__browser_navigateto the page (navigate directly to the login URL if auth is needed, not BASE_URL — avoids the shell→JS-redirect race)mcp__playwright__browser_snapshotto read the accessibility treemcp__playwright__browser_evaluatewith a shadow-DOM walk if elements are missing:() => { var r=[]; function w(root,p){root.querySelectorAll('button').forEach(b=>r.push(p+' id='+b.id+' aria='+b.getAttribute('aria-label')+' text='+b.textContent.trim().substring(0,40))); root.querySelectorAll('*').forEach(el=>{if(el.shadowRoot)w(el.shadowRoot,p+'>'+el.tagName+(el.id?'#'+el.id:''));}); } w(document,'doc'); return r.join('\n'); }mcp__playwright__browser_clickto confirm the selector works before writing it into the script
Known demo-web / k6-browser gotchas (check these first to save rounds):
goto(BASE_URL)race: shell HTML returns 200 immediately; JS detects 401 on /api/config and async-redirects to login. Navigate directly to the WS-Fed login URL.- Shadow DOM: shell uses
app-*custom elements behind shadow roots. CSS#id #childfails across shadow boundaries. Use the shadow host element tag+id (e.g.app-icon-button#menu-button). k6locator()pierces shadow DOM automatically. - Multiple Back buttons:
.first()prevents strict-mode violation. page.locator("banner")matches nothing on this shell — usenav[aria-label="Main navigation"].mcp__k6__run_scriptcannot run browser scripts (its CLI flags overrideoptions.browser). UseBash: k6 run <path>with env vars for browser scripts.
After diagnosis:
- Edit
script_pathon disk to apply the fix - Re-run Step 2 (validate) then Step 3 (smoke run)
- Increment round counter — stop at round 3 regardless; report FAIL with root cause and fix options if still failing
Step 5 — Write report
Write results to reports/verify-<team>-<profile>.txt:
VERDICT: PASS | FAIL
script: drafts/<team>/<profile>/script.js
rounds: <n>
validate: PASS | FAIL
smoke: PASS | FAIL — exit <code>
checks: <summary>
errors: <if any>Return the verdict to the caller.
Script-root: this skill may run
drafts/**scripts — that is the factory incubation path where new scripts are proven before graduating. The operational skillrun-k6-scriptstayslive/-only (proven/merged scripts only). See planningagent/DELIVERY-MODEL.md§2.
Tools
mcp__k6__validate_script— syntax + API check, no networkmcp__k6__run_script— real execution, HTTP scripts only (browser scripts: useBash: k6 run)mcp__k6__get_documentation/mcp__k6__list_sections— consult before guessing at API fixesmcp__playwright__browser_navigate/browser_snapshot/browser_evaluate/browser_click— live page exploration for browser script selector failures (autonomous, no user input)Read/Edit/Write— read script, apply fixes, write reportBash—k6 run <path>for browser scripts (mcp__k6__run_script cannot run them)
Data
- Reads:
drafts/<team>/<profile>/script.js - Writes:
reports/verify-<team>-<profile>.txt; may editdrafts/<team>/<profile>/script.jsduring fix loop
Frozen skill registry: AGENTS.md in this repo
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

