| name | flaky-test-management |
| description | Detect, quarantine, fix, and prevent flaky tests in your test suite. Outputs flakiness detection pipeline, quarantine workflow, root cause categories, and prevention guidelines. |
| argument-hint | ["test suite size","CI system","current flakiness rate","pain level"] |
| allowed-tools | Read, Write, Bash |
Flaky Test Management
Flaky tests — tests that pass and fail without code changes — destroy developer trust in CI. Teams learn to re-run failed builds habitually, hiding real failures. Flaky tests must be systematically detected, quarantined, fixed, and prevented.
Flakiness Detection
import sqlite3
from datetime import datetime, timedelta
class FlakinessTracker:
def __init__(self, db_path: str = "test_history.db"):
self.db = sqlite3.connect(db_path)
self.db.execute("""
CREATE TABLE IF NOT EXISTS test_runs (
test_id TEXT NOT NULL,
run_id TEXT NOT NULL,
outcome TEXT NOT NULL,
commit_hash TEXT,
recorded_at TEXT NOT NULL
)
""")
():
.db.execute(
,
[test_id, run_id, outcome, commit_hash, datetime.utcnow().isoformat()]
)
.db.commit()
() -> []:
since = (datetime.utcnow() - timedelta(days=window_days)).isoformat()
rows = .db.execute(, [since, min_runs]).fetchall()
[
{
: r[], : r[], : r[], : r[],
: r[] > r[] >
}
r rows
]