Agent skill

Close Flaky Issues

by ClickHouse in ClickHouse/ClickHouse

Audit open "flaky test" GitHub issues and close those whose tests are no longer failing on master.

Apache-2.0Auto-check: notesTesting & QA

Install Close Flaky Issues

skills CLI
$ npx skills add ClickHouse/ClickHouse --skill close-flaky-issues -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ClickHouse/ClickHouse close-flaky-issues --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ClickHouse/ClickHouse.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/close-flaky-issues .claude/skills/close-flaky-issues && rm -rf skills-src

Use ~/.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/

Facts

Skill name
close-flaky-issues
GitHub stars
50k
Token cost
~1.9k tokens
SKILL.md length
803 words
Files
1
Skills in repo
24
Repo updated
First seen
Licence
Apache-2.0

At a glance

Audit open "flaky test" GitHub issues and close those whose tests are no longer failing on master.

  • Works in 7 steps: List open issues → Query CI failure history → Categorize → …
  • Tasks that involve Failing and flaky tests
  • SKILL.md covers Arguments, Goal, Steps and Rules
  • Calls gh, git and jq; reaches play.clickhouse.com

What it does

Close Flaky Issues is an agent skill from ClickHouse/ClickHouse. Audit open "flaky test" GitHub issues and close those whose tests are no longer failing on master. Cross-references CI history from play.clickhouse.com with git log to attribute fixes.

Its SKILL.md is about 1.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 Data warehousing. It works with ClickHouse, Git, GitHub and SQL. The repository describes itself as: ClickHouse® is a real-time analytics database management system. The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve Failing and flaky tests
  • Tasks that involve Data warehousing

Example prompts

  • “flaky test”
  • “/close-flaky-issues”

Requirements

  • Pre-approved tools (allowed-tools): Bash, Read, Grep, Glob

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. List open issues
  2. Query CI failure history
  3. Categorize
  4. Find the fix commit (best-effort)
  5. Print the scope, then proceed
  6. Close issues
  7. Report

What it can do on your machine

Read from SKILL.md and the folder at commit cd023af. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash
    • Read
    • Grep
    • Glob

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • gh
    • git
    • jq
    • curl

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • play.clickhouse.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Close Flaky Issues loads about 1.9k tokens when it runs. Until then it costs about 51 tokens; SKILL.md has 803 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~51
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k

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.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Bash, Read, Grep, Glob

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.

SKILL.md

The full file from ClickHouse/ClickHouse at commit cd023af, republished under its Apache-2.0 licence (© ClickHouse). 803 words, ~1,941 tokens.

Download SKILL.mdSave it as .claude/skills/close-flaky-issues/SKILL.md (or your agent's skills folder).
name
close-flaky-issues
description
Audit open "flaky test" GitHub issues and close those whose tests are no longer failing on master. Cross-references CI history from play.clickhouse.com with git log to attribute fixes.
allowed-tools
Bash, Read, Grep, Glob
argument-hint
[threshold-days] [dry-run]
disable-model-invocation
false

Close Flaky Test Issues Skill

Arguments

  • $0 (optional): number of days the test must be failure-free on master before it is eligible for closing. Default: 14.
  • $1 (optional): pass dry-run to print the table of close candidates and stop without calling gh issue close. Any other value (or none) runs the full sweep.

Goal

Sweep open flaky test issues and close ones where:

  1. The test has 0 failures on master within the threshold window, AND
  2. (Ideally) a fix commit can be linked to the closure.

These issues are auto-generated by the CI bot — closing one is safe because the bot reopens automatically if the test fails again on master.

Steps

1. List open issues
bash
mkdir -p tmp/flaky
gh issue list --repo ClickHouse/ClickHouse --label "flaky test" --state open \
  --limit 200 --json number,title,body > tmp/flaky/issues.json

Each body has the format:

Test name: <test_name>
Failure reason: <reason>
CI report: <url>
Failing test history: <play.clickhouse.com link with base64 SQL>

Extract (number, test_name) pairs:

bash
jq -r '.[] | [.number, ((.body | capture("Test name: (?<n>.+)")? | .n) // "")] | @tsv' tmp/flaky/issues.json

The trailing ? after capture is required: without it, an issue with a null body or one that doesn't contain Test name: raises an error that aborts the whole pipeline and silently drops every subsequent issue. With ?, those rows produce an empty string instead, and you can fall back to the title or to the base64 SQL after # in the Failing test history URL — some old issues use the title rather than Test name: in the body.

2. Query CI failure history

Run one batch query against play.clickhouse.com for all extracted test names. The checks table is publicly readable via the play user.

Before running the query, guard against an empty list. If jq extracted no non-empty test names (zero open flaky test issues, or all bodies missing Test name:), test_name IN () is invalid SQL and aborts the sweep. Skip the query in that case and report "nothing to close".

Escape single quotes in test names before interpolation. Per ClickHouse SQL rules, a literal ' inside a string literal is written as ''. Names that contain a quote (e.g. parametrized integration tests like test_foo[a'b]) will otherwise produce invalid SQL or, worse, parse as a different list. Apply s/'/''/g to each extracted name before joining them with , .

bash
curl -sS 'https://play.clickhouse.com/?user=play' --data-binary "
SELECT test_name,
       countIf(test_status IN ('FAIL','ERROR')) AS failures_90d,
       countIf(test_status IN ('FAIL','ERROR') AND check_start_time >= now() - INTERVAL 30 DAY) AS failures_30d,
       countIf(test_status IN ('FAIL','ERROR') AND check_start_time >= now() - INTERVAL 14 DAY) AS failures_14d,
       countIf(test_status IN ('FAIL','ERROR') AND check_start_time >= now() - INTERVAL 7 DAY)  AS failures_7d,
       maxIf(check_start_time, test_status IN ('FAIL','ERROR'))                                  AS last_fail
FROM checks
WHERE check_start_time >= now() - INTERVAL 90 DAY
  AND test_name IN ( '<test1>', '<test2>', ... )
  AND (pull_request_number = 0 OR base_ref IN ('master',''))
GROUP BY test_name
ORDER BY failures_7d DESC, failures_14d DESC
FORMAT TabSeparatedWithNames
"

Important:

  • pull_request_number = 0 OR base_ref IN ('master','') filters to master commits and PRs targeting master — fork-PR noise is dropped. The empty-string case covers older rows where base_ref was not populated for direct-master runs.
  • Tests with 0 rows returned have never failed on master in the lookback window — those are also closeable.
  • last_fail defaults to 1970-01-01 if the test never failed.
3. Categorize

For each issue, decide based on failures_<threshold-days>d:

  • 0 failures in the window → close candidate
  • >= 1 failure in the window → keep open

Default threshold is 14 days. Use 7 days for an aggressive sweep, 30 days for a conservative one.

4. Find the fix commit (best-effort)

For each close candidate, search git log:

bash
# Look for "fix flaky" commits naming the test
git log origin/master --since="<date 90 days ago>" --format="%H %s" \
  --grep="<test_name_fragment>" -i

# Look at recent direct modifications to the test file
git log origin/master --since="<date 90 days ago>" --format="%H %s" -- "<test_path>"

Not every close candidate has an explicit fix commit — some stabilize via surrounding infra changes. That's fine; close those too, just without a commit reference.

For integration tests (test_X/test.py::...), search the directory: tests/integration/test_X/. For stateless tests (NNNNN_name), search: tests/queries/0_stateless/NNNNN_name.*.

Show full SKILL.md (322 more words)Show less
5. Print the scope, then proceed

Before issuing gh issue close, print a table showing:

  • Issues to close (with linked fix commit if found)
  • Issues to keep open (with failure count)

The user already authorized closing when they invoked the skill, so do not ask follow-up questions — proceed to step 6 immediately after printing. The table is for after-the-fact spot-checking, not for interactive approval. If the user wants a preview without changes, they can pass dry-run as a second argument and the skill should stop here.

6. Close issues

For each closeable issue, post a closing comment that names what fixed it and how recent the last failure was:

bash
# With fix commit linked
gh issue close <N> --repo ClickHouse/ClickHouse \
  --comment "Fixed by <SHA> (\`<commit subject>\`). No failures on master in the last <D> days (last seen <YYYY-MM-DD>). Closing."

# Without a specific fix
gh issue close <N> --repo ClickHouse/ClickHouse \
  --comment "No failures on master in the last <D> days (last seen <YYYY-MM-DD>). Closing as no longer flaky; will reopen automatically by CI bot if it fails again."

Use full 40-char SHAs in comments — short SHAs can become ambiguous later.

Wrap test names, commit subjects, and identifiers in backticks per the project's CLAUDE.md style rule.

7. Report

End-of-task summary: how many were closed (split into "with fix linked" vs "stabilized without fix"), how many remain open, and whether any high-frequency offenders are left (e.g. tests still failing >5 times per week — those may need an owner ping rather than a sweep).

Rules

  • Never modify the issue body or labels. The body says DO NOT modify the body content. DO NOT remove labels. because CI matches against them. Closing with a comment is the only allowed action.
  • Don't close issues with any failure inside the threshold window. Even one recent failure means it's still flaky.
  • Don't reopen issues that were closed manually with rationale — let the CI bot do that.
  • Use tmp/flaky/ for working files, never /tmp (per CLAUDE.md).
  • Default to failures_14d == 0. Tests can have multi-week dormancy and then reappear — 14 days is a reasonable balance between cleaning up cruft and avoiding premature closure.
  • Don't dismiss issues based on the test file existing/not existing alone. A test can exist and still be passing; a test can be removed and the issue not yet closed. Failure history is the source of truth.

© ClickHouse, 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

Files

Just SKILL.md in .claude/skills/close-flaky-issues of ClickHouse/ClickHouse.

Open the folder on GitHubat commit cd023af

Compare with similar skills

Close Flaky Issues 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.

Close Flaky Issues compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Close Flaky Issues this skillClickHouse/ClickHouse50k—~1.9kAutomated safety check: NotesApache-2.0
Turning Engineering Analytics Into InsightsPostHog/posthog40k—~2.9kAutomated safety check: PassCustom licence
Update Keyword Engine ListsClickHouse/clickhouse-java1.6k—~457Automated safety check: PassApache-2.0
Testingar-io/ar-io-node127—~2.6kAutomated safety check: NotesAGPL-3.0
MAUI UI Test Writerdotnet/maui23k—~3kAutomated safety check: PassMIT
CI Fix MonitorZaxbyHub/opencode-swarm490—~551Automated safety check: PassMIT

Similar skills

  • Converts engineering analytics (PR / CI) data into saved PostHog insights, dashboards, and subscriptions, and explains how to query the product data directly with SQL.

    40k GitHub stars~2.9k tokensUpdated today
    Testing & QAAuto-check passed
  • Update Keyword Engine Lists

    ClickHouse/clickhouse-java

    Update ALLOWEDKEYWORDALIASES in ClickHouseSqlUtils.java and ENGINETOTABLETYPE in DatabaseMetaDataImpl.java from failing test output.

    1.6k GitHub stars~457 tokensUpdated yesterday
    DatabasesAuto-check passed
  • Testing

    ar-io/ar-io-node

    Decision guide for testing in the ar-io-node repo — which test layer to use, how to run it, and which helpers to reach for.

    127 GitHub stars~2.6k tokensUpdated yesterday
    Testing & QAAuto-check: notes
  • Official

    Writes UI tests that reproduce a GitHub issue in .NET MAUI and keeps iterating until the tests actually fail, proving they catch the bug.

    23k GitHub stars~3k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • CI Fix Monitor

    ZaxbyHub/opencode-swarm

    Codex adapter for monitoring and fixing CI failures on opencode-swarm PRs.

    490 GitHub stars~551 tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Clickhouse Logs Queries

    supabase/supabase

    Official

    Write, review, and migrate Supabase logs queries against the ClickHouse-backed logs table (the logs.all.otel analytics endpoint).

    111k GitHub stars~2.4k tokensUpdated today
    DatabasesAuto-check passed

More from ClickHouse/ClickHouse

All 24 skills in this repo
  • Keeper Stress Analysis

    ClickHouse/ClickHouse

    Analyze ClickHouse Keeper stress-test results from play.clickhouse.com / keeperstresstests data warehouse.

    50k GitHub stars~4.7k tokensUpdated today
    Auto-check passed
  • Perf Comparison

    ClickHouse/ClickHouse

    Evaluate ClickHouse performance test results from existing CI/dashboard data or local perf.py runs.

    50k GitHub stars~3.9k tokensUpdated today
    Auto-check: notes
  • Patch Release Check

    ClickHouse/ClickHouse

    Check whether ClickHouse's supported versions (last 3 majors + latest LTS) have recent stable patch releases, diagnose why the scheduled AutoReleases pipeline failed, and identify which releases…

    50k GitHub stars~4k tokensUpdated today
    Auto-check: notes
  • Alloc Profile

    ClickHouse/ClickHouse

    Analyze a jemalloc (or other) allocation profile in collapsed stack format.

    50k GitHub stars~4.3k tokensUpdated today
    Auto-check passed
  • Bisect

    ClickHouse/ClickHouse

    Bisect a ClickHouse regression using pre-built master binaries from CI.

    50k GitHub stars~1.4k tokensUpdated today
    Auto-check passed
  • Clickhouse PR Description

    ClickHouse/ClickHouse

    Generate PR descriptions for ClickHouse/ClickHouse that match maintainer expectations.

    50k GitHub stars~1.9k tokensUpdated today
    Auto-check passed

Questions about Close Flaky Issues

What does Close Flaky Issues do?

Audit open "flaky test" GitHub issues and close those whose tests are no longer failing on master. Close Flaky Issues is an agent skill from ClickHouse/ClickHouse. Audit open "flaky test" GitHub issues and close those whose tests are no longer failing on master.

When should I use Close Flaky Issues?

Close Flaky Issues fits situations like: tasks that involve Failing and flaky tests; tasks that involve Data warehousing.

How do I install Close Flaky Issues in Claude Code?

Run `npx skills add ClickHouse/ClickHouse --skill close-flaky-issues -a claude-code`. Or copy the skill folder (.claude/skills/close-flaky-issues in ClickHouse/ClickHouse) into .claude/skills/close-flaky-issues in your project. Claude Code loads it when a task matches its description.

How do I install Close Flaky Issues in Codex?

Run `npx skills add ClickHouse/ClickHouse --skill close-flaky-issues -a codex`. Or copy the skill folder (.claude/skills/close-flaky-issues in ClickHouse/ClickHouse) into .agents/skills/close-flaky-issues in your project. Codex loads it when a task matches its description.

Can I use Close Flaky Issues in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ClickHouse/ClickHouse --skill close-flaky-issues -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/close-flaky-issues, .gemini/skills/close-flaky-issues, .github/skills/close-flaky-issues and .opencode/skills/close-flaky-issues in your project.

What does Close Flaky Issues need to run?

Going by SKILL.md and its folder, Close Flaky Issues needs the command-line tools its instructions call (gh, git, jq and curl). Its frontmatter pre-approves these tools: Bash, Read, Grep, Glob.

Does Close Flaky Issues access the network?

SKILL.md names 1 domain. In commands or code: play.clickhouse.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Close Flaky Issues safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Close Flaky Issues use?

Close Flaky Issues 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.

How many tokens does Close Flaky Issues use?

About 1.9k tokens (SKILL.md is roughly 7.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Close Flaky Issues?

Skills that share tags, products or a category with Close Flaky Issues: Turning Engineering Analytics Into Insights (PostHog/posthog, 40k stars), Update Keyword Engine Lists (ClickHouse/clickhouse-java, 1.6k stars), Testing (ar-io/ar-io-node, 127 stars) and MAUI UI Test Writer (dotnet/maui, 23k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Close Flaky Issues?

ClickHouse (a GitHub organization) maintains it in ClickHouse/ClickHouse, which has 50,288 GitHub stars. The repository holds 24 skills in this directory. The repository was last updated on October 8, 2026.

Source: ClickHouse/ClickHouse on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.