Detect Flaky Tests
agent-substrate/substrate
Detects flaky Go tests by analyzing GitHub Actions workflow runs across the last 7 days and all PRs — covering both the run-tests job (unit/integration) and the e2e-test job (gVisor and microVM…
Detects broken and flaky acceptance tests from recent CI failures on main and opens structured GitHub issues for automated remediation.
$ npx skills add elastic/terraform-provider-elasticstack --skill flaky-test-catcher -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install elastic/terraform-provider-elasticstack flaky-test-catcher --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/elastic/terraform-provider-elasticstack.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/flaky-test-catcher .claude/skills/flaky-test-catcher && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "flaky-test-catcher" agent skill from https://github.com/elastic/terraform-provider-elasticstack/tree/main/.agents/skills/flaky-test-catcher into .claude/skills/flaky-test-catcher/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "flaky-test-catcher", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/elastic/terraform-provider-elasticstack/tree/main/.agents/skills/flaky-test-catcherType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add elastic/terraform-provider-elasticstack --skill flaky-test-catcher -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install elastic/terraform-provider-elasticstack flaky-test-catcher --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/elastic/terraform-provider-elasticstack.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/flaky-test-catcher .agents/skills/flaky-test-catcher && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "flaky-test-catcher" agent skill from https://github.com/elastic/terraform-provider-elasticstack/tree/main/.agents/skills/flaky-test-catcher into .agents/skills/flaky-test-catcher/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "flaky-test-catcher", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add elastic/terraform-provider-elasticstack --skill flaky-test-catcher -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install elastic/terraform-provider-elasticstack flaky-test-catcher --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/elastic/terraform-provider-elasticstack.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/flaky-test-catcher .cursor/skills/flaky-test-catcher && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "flaky-test-catcher" agent skill from https://github.com/elastic/terraform-provider-elasticstack/tree/main/.agents/skills/flaky-test-catcher into .cursor/skills/flaky-test-catcher/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "flaky-test-catcher", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/elastic/terraform-provider-elasticstack.git --path .agents/skills/flaky-test-catcher--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add elastic/terraform-provider-elasticstack --skill flaky-test-catcher -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install elastic/terraform-provider-elasticstack flaky-test-catcher --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/elastic/terraform-provider-elasticstack.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/flaky-test-catcher .gemini/skills/flaky-test-catcher && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "flaky-test-catcher" agent skill from https://github.com/elastic/terraform-provider-elasticstack/tree/main/.agents/skills/flaky-test-catcher into .gemini/skills/flaky-test-catcher/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "flaky-test-catcher", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install elastic/terraform-provider-elasticstack flaky-test-catcherInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add elastic/terraform-provider-elasticstack --skill flaky-test-catcher -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/elastic/terraform-provider-elasticstack.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/flaky-test-catcher .github/skills/flaky-test-catcher && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "flaky-test-catcher" agent skill from https://github.com/elastic/terraform-provider-elasticstack/tree/main/.agents/skills/flaky-test-catcher into .github/skills/flaky-test-catcher/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "flaky-test-catcher", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add elastic/terraform-provider-elasticstack --skill flaky-test-catcher -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install elastic/terraform-provider-elasticstack flaky-test-catcher --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/elastic/terraform-provider-elasticstack.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/flaky-test-catcher .opencode/skills/flaky-test-catcher && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "flaky-test-catcher" agent skill from https://github.com/elastic/terraform-provider-elasticstack/tree/main/.agents/skills/flaky-test-catcher into .opencode/skills/flaky-test-catcher/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "flaky-test-catcher", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
flaky-test-catcherDetects broken and flaky acceptance tests from recent CI failures on main and opens structured GitHub issues for automated remediation.
Flaky Test Catcher is an agent skill from elastic/terraform-provider-elasticstack, published by the product's own GitHub organization. Detects broken and flaky acceptance tests from recent CI failures on main and opens structured GitHub issues for automated remediation. Follow this skill strictly when analyzing CI failures.
Its SKILL.md is about 2.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Testing & QA, covering Failing and flaky tests and End-to-end testing. It works with GitHub. The repository describes itself as: Terraform provider for Elastic Stack. The licence is Apache-2.0.
10 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit b6bbc21. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
ghgitFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md. Its commands use gh and git, which can reach the network depending on how they are called.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Flaky Test Catcher loads about 2.9k tokens when it runs. Until then it costs about 52 tokens; SKILL.md has 1,365 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from elastic/terraform-provider-elasticstack at commit b6bbc21, republished under its Apache-2.0 licence (© elastic). 1,365 words, ~2,912 tokens.
.claude/skills/flaky-test-catcher/SKILL.md (or your agent's skills folder).This skill defines the end-to-end protocol for detecting broken and flaky acceptance tests by analyzing recent CI failures on main, then opening structured GitHub issues so that automated remediation workflows can address the root causes.
You must follow this protocol strictly. Do not improvise or skip steps.
The workflow pre-activation step has already computed all run-level data. Do not re-query GitHub for run lists or issue counts. Use the values injected into your prompt:
| Variable | Meaning |
|---|---|
failed_run_ids | JSON array of run IDs of failed test.yml runs on main in the last 3 days |
total_run_count | Count of completed runs with meaningful conclusions (success, failure, timed_out, neutral, action_required) — cancelled runs excluded |
open_issues | Current count of open flaky-test issues |
issue_slots_available | How many new issues you may create (max 3) |
Parse failed_run_ids as a JSON array immediately. Example: ["12345678","87654321"].
For each run ID in failed_run_ids:
gh api /repos/{owner}/{repo}/actions/runs/{run_id}/jobs?per_page=100Replace {owner} and {repo} with the values from the repository's GitHub remote (visible in git remote get-url origin).
From the returned jobs array, keep only jobs where both conditions hold:
conclusion == "failure"Matrix Acceptance Test (this is the job group that runs acceptance tests)Ignore infrastructure jobs (e.g. lint, build, generate) — they do not produce --- FAIL: lines.
The GitHub API log endpoint returns a ZIP archive. Use the gh CLI to stream plain-text logs for a job:
gh run view --job {job_id} --log | grep '^--- FAIL:'Log size warning: Job logs can be very large (10 MB+). Do not load the full log into context. Instead:
grep so only matching lines are retained.--- FAIL: pattern (see §4).grep -B3 -A3 or similar when you also need surrounding context for the "Sample Failure Output" issue section.--- FAIL: line) for the "Sample Failure Output" issue section.If a job list response has 100 items and there may be more, check the Link header for a next page URL and repeat the request. In practice, a single run rarely has more than 100 jobs.
--- FAIL: extraction patternScan each log for lines that match this exact pattern:
^--- FAIL: TestName (timing)Examples of matching lines:
--- FAIL: TestAccResourceAgentConfiguration_alternateEnvironment (12.34s)
--- FAIL: TestAccSomeResource_basic (0.45s)Rules:
--- FAIL: (three hyphens, a space, FAIL:, a space).TestAcc... with optional underscore-separated sub-name.(12.34s).FAIL lines without the --- prefix; those are package-level failure markers, not individual test failures.Collect all extracted test names across all runs and all jobs. A test may appear multiple times (once per run where it failed) — track counts.
Same-run deduplication: If the same test name appears in multiple failing jobs within a single run (e.g. multiple shards both failing the same test), count it only once for that run. Deduplication is by run ID, not job ID — use a set per run when accumulating test names.
For each unique test name:
fail_rate = fail_count / total_run_countWhere:
fail_count = number of distinct run IDs in which this test appeared as --- FAIL:total_run_count = the value from pre-activation context (already excludes cancelled runs)| Classification | Condition | Action |
|---|---|---|
| Broken | fail_rate == 1.0 (fails in 100% of runs) | Create issue |
| Flaky | fail_rate >= 0.20 and < 1.0 | Create issue |
| Noise | fail_rate < 0.20 | Ignore — do not create issues |
Extract the base test name from each test function name using this rule:
Take the substring from the beginning up to (but not including) the first underscore
_.
Pattern: TestAcc[^_]+
Examples:
| Full test name | Base test name |
|---|---|
TestAccResourceAgentConfiguration_alternateEnvironment | TestAccResourceAgentConfiguration |
TestAccResourceAgentConfiguration_minimal | TestAccResourceAgentConfiguration |
TestAccResourceAgentConfiguration | TestAccResourceAgentConfiguration |
TestAccSomeResource_basic | TestAccSomeResource |
One issue per base test name. All scenario variants (subtests/suffixes) belonging to the same base name are consolidated into a single issue. List each specific variant inside the issue body.
Fallback for non-TestAcc tests: All acceptance tests in this project follow the TestAcc prefix convention. If a non-TestAcc test name appears in the logs, treat everything up to the first _ (or the full name if no _) as the base name.
For each base test name that will receive an issue, investigate whether any recent commit may already address the failure:
From the failed_run_ids list, identify the oldest run's created_at timestamp. You can get metadata for a single run:
gh api /repos/{owner}/{repo}/actions/runs/{run_id}Take the minimum created_at across all failed runs.
main since that timestampgh api "/repos/{owner}/{repo}/commits?sha=main&since={timestamp}&per_page=50"Replace {timestamp} with the ISO 8601 value from step 7.1 (e.g. 2024-01-15T12:00:00Z).
For each commit returned:
a. Commit message relevance — does it reference any of:
TestAccResourceAgentConfiguration)agent_configuration → AgentConfiguration)fix, flaky, test, revertb. Changed file relevance — fetch the full commit detail to get changed file paths:
gh api /repos/{owner}/{repo}/commits/{sha}Check if any file in files[].filename matches patterns like:
*_test.go files whose name contains a token from the resource name⚠️ may already be addressed in `{short_sha}` — {one-line message summary}No recent commits appear to address this failure.Frame the analysis as "has this been fixed yet?" — not as blame attribution.
Do not suppress issue creation: Even if a fix commit is found, always proceed with creating the issue and include the fix-detection note in the Commit Analysis section. The issue serves as the remediation trigger regardless.
Before creating an issue for a base test name, check whether one already exists:
gh api "/repos/{owner}/{repo}/issues?labels=flaky-test&state=open&per_page=100"title.[flaky-test] {BaseTestName} (the [flaky-test] prefix is applied automatically by the create-issue safe output). When checking for duplicates, compare against this full title as it appears in GitHub.issue_slots_available; use only the value from pre-activation.next link in the Link response header and repeat the request for subsequent pages until all open issues are fetched.Issue title: Pass only {BaseTestName} to the create-issue safe output — the [flaky-test] prefix is added automatically.
Every issue you create must contain exactly these 5 sections in this order:
## Broken Tests
List each test function name (including scenario suffix) that failed in 100% of runs:
- ❌ `TestAccResourceFoo_basic` — failed in 5/5 runs
## Flaky Tests
List each test function name that failed in ≥ 20% but < 100% of runs, with the observed rate:
- ⚠️ `TestAccResourceFoo_update` — failed in 3/5 runs (60%)
- ⚠️ `TestAccResourceFoo_import` — failed in 1/5 runs (20%)
## Commit Analysis
{Output from §7. Either a ⚠️ note about a possible fix commit, or the "No recent commits" message. Include commit SHA, message, and affected file paths when relevant.}
## Sample Failure Output
{Short excerpt (5–15 lines) of the actual log output surrounding a `--- FAIL:` line. Include any immediately preceding error messages for context.}
## Affected Stack Versions
{List the Elastic Stack versions / matrix dimension values (e.g. Elasticsearch version, Kibana version) from the failing job names or log metadata. If not determinable, write "Unknown — not present in log output".}Formatting rules:
❌ for broken tests (100% fail rate).⚠️ for flaky tests (20%–99% fail rate), and always include the fraction and percentage.Cap enforcement: Before creating each issue, verify that the number of issues created so far in this run has not reached issue_slots_available. Stop creating issues once the cap is reached, even if additional base test names remain.
Call noop with a descriptive explanation (do not create any issues) when any of these conditions holds:
All failures already have open issues — every qualifying base test name matched an existing open flaky-test issue during deduplication; nothing new to open.
All failures are below the 20% threshold — every observed --- FAIL: test has fail_rate < 0.20; there are no broken or flaky tests to report.
No --- FAIL: patterns found — none of the logs for the provided failed_run_ids contained a --- FAIL: line; the CI failures were likely infrastructure failures (network timeouts, setup errors, etc.) rather than test logic failures.
When calling noop, state which condition applied and include basic counts (e.g. "3 failures observed, all below 20% threshold").
failed_run_ids from pre-activation context.Matrix Acceptance Test jobs → fetch and scan logs for --- FAIL: lines.< 20%).flaky-test issues.issue_slots_available): run commit analysis, then create an issue with all 5 required sections.noop.© elastic, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .agents/skills/flaky-test-catcher of elastic/terraform-provider-elasticstack.
Open the folder on GitHubat commit b6bbc21
Flaky Test Catcher next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Flaky Test Catcher this skillelastic/terraform-provider-elasticstack | 210 | — | ~2.9k | Automated safety check: Pass | Apache-2.0 | |
| Detect Flaky Testsagent-substrate/substrate | 4.5k | — | ~3k | Automated safety check: Pass | Apache-2.0 | |
| MAUI UI Test Writerdotnet/maui | 23k | — | ~3k | Automated safety check: Pass | MIT | |
| Test Fix WorkflowGoogleCloudPlatform/magic-modules | 974 | — | ~1.3k | Automated safety check: Pass | Custom licence | |
| Cucumber and Playwright E2E Testslanggenius/dify | 158k | — | ~682 | Automated safety check: Pass | Custom licence | |
| Triage CI Flakepayloadcms/payload | 45k | — | ~4.4k | Automated safety check: Pass | MIT |
agent-substrate/substrate
Detects flaky Go tests by analyzing GitHub Actions workflow runs across the last 7 days and all PRs — covering both the run-tests job (unit/integration) and the e2e-test job (gVisor and microVM…
dotnet/maui
Writes UI tests that reproduce a GitHub issue in .NET MAUI and keeps iterating until the tests actually fail, proving they catch the bug.
GoogleCloudPlatform/magic-modules
Workflow for diagnosing, fixing, and verifying failing Terraform acceptance tests from GitHub issue URLs (detecting test-failure labels), direct prompts, or log files using Failure Scenario Decision…
langgenius/dify
Guides changes and reviews of the Cucumber and Playwright end-to-end suite under `e2e/`: feature files, step definitions, support code, tags, locators and assertions.
payloadcms/payload
A skill your agent uses when CI tests fail on main branch after PR merge, when investigating flaky test failures, or when user provides a PR URL/number to aggregate all failing tests
GreptimeTeam/greptimedb
Diagnoses a failed GreptimeDB fuzz CI job by pulling its GitHub Actions logs and fuzz artifacts, then matching the evidence to the local source code.
elastic/terraform-provider-elasticstack
Enter explore mode - a thinking partner for exploring ideas, investigating problems, and clarifying requirements.
elastic/terraform-provider-elasticstack
Implement tasks from an OpenSpec change. An agent skill from elastic/terraform-provider-elasticstack.
elastic/terraform-provider-elasticstack
Archive a completed change in the experimental workflow. An agent skill from elastic/terraform-provider-elasticstack.
elastic/terraform-provider-elasticstack
Monitor GitHub pull requests through a subagent-based loop that watches CI checks, review comments, PR comments, review state, merge conflicts, and branch freshness.
elastic/terraform-provider-elasticstack
MANDATORY skill that activates whenever the OpenSpec proposal phase begins.
elastic/terraform-provider-elasticstack
Continue working on an OpenSpec change by creating the next artifact.
Works with
Categories
Detects broken and flaky acceptance tests from recent CI failures on main and opens structured GitHub issues for automated remediation. Flaky Test Catcher is an agent skill from elastic/terraform-provider-elasticstack, published by the product's own GitHub organization. Detects broken and flaky acceptance tests from recent CI failures on main and opens structured GitHub issues for automated remediation.
Flaky Test Catcher fits situations like: tasks that involve Failing and flaky tests; tasks that involve End-to-end testing.
Run `npx skills add elastic/terraform-provider-elasticstack --skill flaky-test-catcher -a claude-code`. Or copy the skill folder (.agents/skills/flaky-test-catcher in elastic/terraform-provider-elasticstack) into .claude/skills/flaky-test-catcher in your project. Claude Code loads it when a task matches its description.
Run `npx skills add elastic/terraform-provider-elasticstack --skill flaky-test-catcher -a codex`. Or copy the skill folder (.agents/skills/flaky-test-catcher in elastic/terraform-provider-elasticstack) into .agents/skills/flaky-test-catcher in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add elastic/terraform-provider-elasticstack --skill flaky-test-catcher -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/flaky-test-catcher, .gemini/skills/flaky-test-catcher, .github/skills/flaky-test-catcher and .opencode/skills/flaky-test-catcher in your project.
Going by SKILL.md and its folder, Flaky Test Catcher needs the command-line tools its instructions call (gh and git).
SKILL.md contains no URLs. Its commands use gh and git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Flaky Test Catcher is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.9k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Flaky Test Catcher: Detect Flaky Tests (agent-substrate/substrate, 4.5k stars), MAUI UI Test Writer (dotnet/maui, 23k stars), Test Fix Workflow (GoogleCloudPlatform/magic-modules, 974 stars) and Cucumber and Playwright E2E Tests (langgenius/dify, 158k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
elastic (a GitHub organization, an official publisher) maintains it in elastic/terraform-provider-elasticstack, which has 210 GitHub stars. The repository holds 21 skills in this directory. The repository was last updated on October 8, 2026.
Source: elastic/terraform-provider-elasticstack on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.