[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6XD2ZCHP6PXGEVR6Q7X9ASV":3,"skill-same:01M6XD2ZCHP6PXGEVR6Q7X9ASV":64},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":36,"linkOnly":37,"markdownContent":38,"markdownBody":39,"frontMatter":40,"refName":43,"commitSha":44,"skillDirectory":45,"forksCount":14,"repositoryHtmlUrl":46,"repositoryHomepageUrl":6,"ownerHtmlUrl":47,"ownerBlogUrl":6,"ownerDescription":48,"updatedAt":49,"install":50,"resources":63},"01M6XD2ZCHP6PXGEVR6Q7X9ASV","detect-flaky",null,"Detect, diagnose, and fix flaky tests in Python, Go, or JavaScript\u002FTypeScript codebases by repeated execution + root-cause analysis. Triggers on: \"detect flaky tests\", \"find flaky tests\", \"diagnose flaky tests\".","kaiohenricunha\u002Fdotbabel","kaiohenricunha","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F69804490?v=4","01M6XCZD37W0KPCDGEA40Y610V","Kaio Cunha","01M6XCZD7SX714D114H3ZPNW09",0,"MIT","https:\u002F\u002Fgithub.com\u002Fkaiohenricunha\u002Fdotbabel\u002Fblob\u002Fmain\u002Fexamples\u002Fminimal-consumer\u002F.claude\u002Fskills\u002Fdetect-flaky\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35],"detect flaky","detect","find","root","triggers","tests","root-cause","fix","command","typescript","analysis","execution","diagnose","test","javascript","python","go","2026-11-10 10:12:30",false,"---\n# dotbabel:generated projection=sha256:0b1af7b2ac70c19151f58ccd5fce9e5ed644e4d50e9af871271ca0dbb7052641 source=skills\u002Fdetect-flaky\u002FSKILL.md — do not edit directly\nargument-hint: \"[test-command]\"\ndescription: |\n  Detect, diagnose, and fix flaky tests in Python, Go, or JavaScript\u002FTypeScript codebases by repeated execution + root-cause analysis. Triggers on: \"detect flaky tests\", \"find flaky tests\", \"diagnose flaky tests\".\nname: detect-flaky\n---\n\n# \u002Fdetect-flaky — Flaky Test Detection and Diagnosis Agent\n\nThis agent detects, diagnoses, and fixes flaky tests in **Python**, **Go**, and **JavaScript\u002FTypeScript** codebases.\n\nA test is **flaky** when it non-deterministically passes or fails without code changes.\n\n---\n\n## Mission (North Star)\n\nIdentify flaky tests through:\n\n1. **Static pattern scanning** — Regex-based detection of known anti-patterns\n2. **Empirical detection** — Run tests N times to catch intermittent failures\n3. **Root cause diagnosis** — Map findings to a curated catalog of causes\n4. **Fix generation** — Produce concrete before\u002Fafter code fixes\n\nYour primary outcome is **deterministic, trustworthy test suites**.\n\n---\n\n## Invocation Examples\n\n```text\n\u002Fdetect-flaky scan this codebase for flaky test patterns\n\n\u002Fdetect-flaky focus on the Python tests, especially around the API client module\n\n\u002Fdetect-flaky run Go tests 15 times with race detector and find intermittent failures\n\n\u002Fdetect-flaky I have a test_payment_flow that fails ~10% of the time in CI, diagnose it\n\n\u002Fdetect-flaky scan elt\u002Ftests\u002F for timing-related issues\n```\n\n---\n\n## Pattern Catalog (Reference During Analysis)\n\n### High Severity (Frequently Flaky)\n\n| ID                   | Language | Anti-Pattern                            | Detection                                                  | Fix                                             |\n| -------------------- | -------- | --------------------------------------- | ---------------------------------------------------------- | ----------------------------------------------- |\n| `CROSS-TIME`         | All      | Time-dependent assertions               | `time.Sleep`, `setTimeout`, `datetime.now()` in assertions | Use deterministic time injection or freeze time |\n| `CROSS-RACE`         | All      | Race conditions in concurrent test code | Shared mutable state across goroutines\u002Fthreads             | Use proper synchronization or test isolation    |\n| `CROSS-EXTDEP`       | All      | Unmocked external dependencies          | `requests.get()`, `http.Get()`, `fetch()` in test files    | Mock all network calls                          |\n| `PY-MOCK-LEAK`       | Python   | Mock not cleaned up                     | `patch().start()` without `stop()`                         | Use context manager or `addCleanup()`           |\n| `PY-REAL-HTTP`       | Python   | Real HTTP in tests                      | `requests`, `httpx`, `urllib` calls                        | Use `responses`, `httpretty`, or `respx`        |\n| `PY-RANDOM-SEED`     | Python   | Unseeded random                         | `random.choice()`, `random.randint()`                      | Set `random.seed()` in fixture                  |\n| `GO-PARALLEL-STATE`  | Go       | Shared state in parallel tests          | `t.Parallel()` with package-level vars                     | Use test-local state or sync primitives         |\n| `GO-GOROUTINE-LEAK`  | Go       | Goroutines outliving test               | `go func()` without cleanup                                | Use `t.Cleanup()` or `errgroup`                 |\n| `GO-SETENV-PARALLEL` | Go       | `os.Setenv` in parallel tests           | Environment mutation + `t.Parallel()`                      | Use `t.Setenv()` (Go 1.17+)                     |\n| `GO-RACE-CONDITION`  | Go       | Data race in test                       | Concurrent map\u002Fslice access                                | Run with `-race` flag                           |\n| `JS-WAITFOR-TIMING`  | JS\u002FTS    | Wrong async query                       | `getBy*` on async content                                  | Use `findBy*` or `waitFor()`                    |\n| `JS-TIMER-LEAK`      | JS\u002FTS    | Fake timers not restored                | `jest.useFakeTimers()` without restore                     | Call `jest.useRealTimers()` in afterEach        |\n| `JS-MOCK-RESTORE`    | JS\u002FTS    | Mock not restored                       | `jest.spyOn()` without cleanup                             | Use `restoreAllMocks()` in afterEach            |\n| `JS-ACT-MISSING`     | JS\u002FTS    | State update outside act()              | Component updates without `act()` wrapper                  | Wrap state-triggering code in `act()`           |\n\n### Medium Severity (Sometimes Flaky)\n\n| ID                    | Language | Anti-Pattern                               | Detection                                               | Fix                                              |\n| --------------------- | -------- | ------------------------------------------ | ------------------------------------------------------- | ------------------------------------------------ |\n| `CROSS-RANDOM`        | All      | Unseeded RNG                               | `rand`, `random`, `Math.random()`                       | Seed RNG or inject deterministic values          |\n| `CROSS-FLOAT`         | All      | Exact float equality                       | `==` on float results                                   | Use `pytest.approx()`, tolerance comparisons     |\n| `CROSS-ENV`           | All      | Environment variable mutation              | `os.Setenv`, `process.env.X =`                          | Restore original values in cleanup               |\n| `CROSS-ORDER`         | All      | Test order dependency                      | Tests pass alone, fail together                         | Isolate state, use fresh fixtures                |\n| `PY-FIXTURE-SCOPE`    | Python   | Session\u002Fmodule fixtures with mutable state | `scope=\"session\"` with list\u002Fdict                        | Use function scope or immutable fixtures         |\n| `PY-ASYNC-LOOP`       | Python   | Manual event loop management               | `asyncio.get_event_loop()`, `loop.run_until_complete()` | Use `pytest-asyncio` with `@pytest.mark.asyncio` |\n| `PY-TEMPFILE`         | Python   | Hardcoded temp paths                       | `\u002Ftmp\u002Ftest_file.txt`                                    | Use `tmp_path` fixture or `tempfile`             |\n| `GO-CHANNEL-TIMING`   | Go       | Short channel timeouts                     | `select` with `time.After(10ms)`                        | Use longer timeouts or remove timing dependency  |\n| `GO-MAP-ORDER`        | Go       | Map iteration order assertions             | Loop over map, assert order                             | Sort keys first or use deterministic structure   |\n| `GO-HTTP-SERVER`      | Go       | Test server port conflicts                 | Hardcoded ports in tests                                | Use `httptest.NewServer()` with dynamic ports    |\n| `JS-SNAPSHOT-FRAGILE` | JS\u002FTS    | Brittle snapshots                          | Large objects, timestamps in snapshots                  | Exclude volatile fields, use smaller snapshots   |\n| `JS-ASYNC-UNMOUNT`    | JS\u002FTS    | State update after unmount                 | Async callback on unmounted component                   | Use cleanup functions, abort controllers         |\n| `JS-FETCH-MOCK`       | JS\u002FTS    | Incomplete fetch mock                      | Missing error\u002Ftimeout cases                             | Mock all fetch scenarios                         |\n\n### Low Severity (Occasionally Flaky)\n\n| ID                     | Language | Anti-Pattern                | Detection                             | Fix                                                  |\n| ---------------------- | -------- | --------------------------- | ------------------------------------- | ---------------------------------------------------- |\n| `CROSS-HARDCODED-PATH` | All      | Hardcoded absolute paths    | `\u002Fhome\u002F`, `\u002FUsers\u002F`, `C:\\` in tests   | Use relative paths or fixtures                       |\n| `PY-PARAMETRIZE-ID`    | Python   | Non-deterministic test IDs  | `@pytest.mark.parametrize` with dicts | Use explicit `ids=` parameter                        |\n| `PY-MONKEYPATCH-SCOPE` | Python   | Monkeypatch scope mismatch  | Monkeypatch in wrong scope            | Match monkeypatch scope to fixture scope             |\n| `GO-TESTMAIN-EXIT`     | Go       | Missing os.Exit in TestMain | `TestMain` without `os.Exit(m.Run())` | Always call `os.Exit(m.Run())`                       |\n| `GO-BUILD-TAGS`        | Go       | Build tag inconsistency     | Tests pass locally, fail in CI        | Ensure consistent build tags                         |\n| `JS-SNAPSHOT-LARGE`    | JS\u002FTS    | Large snapshot files        | `toMatchSnapshot()` on complex output | Use `toMatchInlineSnapshot()` or targeted assertions |\n| `JS-CONSOLE-MOCK`      | JS\u002FTS    | Console methods not mocked  | Tests output noise, may have timing   | Mock `console.*` methods                             |\n\n---\n\n## Analysis Protocol\n\n### Phase 1: Understand the Request\n\nParse the user's request to determine:\n\n1. **Scope**: Specific directory, file, test name, or entire codebase?\n2. **Language**: Python, Go, JS\u002FTS, or all?\n3. **Mode**: Static scan, empirical detection, or diagnosis of known flaky test?\n4. **Symptoms**: If diagnosing, what failure rate, error messages, CI context?\n\n### Phase 2: Static Pattern Scan\n\nFor static analysis, scan test files for patterns from the catalog.\n\n**Python test files**: `**\u002Ftest_*.py`, `**\u002F*_test.py`, `**\u002Ftests\u002F**\u002F*.py`\n**Go test files**: `**\u002F*_test.go`\n**JS\u002FTS test files**: `**\u002F*.test.{js,ts,jsx,tsx}`, `**\u002F*.spec.{js,ts,jsx,tsx}`, `**\u002F__tests__\u002F**\u002F*.{js,ts,jsx,tsx}`\n\nFor each match:\n\n1. Identify the pattern ID\n2. Extract the offending code snippet\n3. Explain why it causes flakiness\n4. Provide a concrete fix\n\n### Phase 3: Empirical Detection (If Requested)\n\nRun the test suite multiple times to detect intermittent failures:\n\n```bash\n# Python\nfor i in {1..10}; do pytest \u003Cpath> --tb=no -q 2>&1; done | tee results.txt\n\n# Go\nfor i in {1..10}; do go test -race -count=1 \u003Cpackage> 2>&1; done | tee results.txt\n\n# JavaScript (Jest)\nfor i in {1..10}; do npm test -- --testPathPattern=\u003Cpattern> 2>&1; done | tee results.txt\n```\n\nAnalyze results for:\n\n- Tests that flip between pass\u002Ffail\n- Tests that timeout inconsistently\n- Tests with different failure messages across runs\n\n### Phase 4: Root Cause Diagnosis\n\nFor each identified flaky test:\n\n1. Map to pattern catalog entry\n2. Explain the non-determinism source\n3. Identify the specific line(s) causing flakiness\n4. Consider test dependencies and execution order\n\n### Phase 5: Fix Generation\n\nProduce concrete fixes:\n\n````markdown\n### Fix for `test_user_creation` (PY-MOCK-LEAK)\n\n**Before:**\n\n```python\ndef test_user_creation():\n    mock_db = patch('app.db.connection').start()\n    # test code...\n    # Missing: mock_db.stop()\n```\n````\n\n**After:**\n\n```python\ndef test_user_creation():\n    with patch('app.db.connection') as mock_db:\n        # test code...\n        # Automatically cleaned up\n```\n\n**Why this fixes it:** The context manager ensures the mock is always stopped, even if the test fails or raises an exception.\n\n````\n\n---\n\n## Tool Usage\n\n### Scripts (If Available)\n\n```bash\n# Fast static scan\npython scripts\u002Fscan_patterns.py --lang python --format text\n\n# Empirical detection\npython scripts\u002Fdetect_flaky.py --lang python --runs 10 --output report.json\n````\n\n### Direct Commands\n\n```bash\n# Python - find time-dependent code in tests\ngrep -rn \"time.sleep\\|datetime.now\\|time.time\" --include=\"test_*.py\"\n\n# Go - find parallel tests with shared state\ngrep -rn \"t.Parallel()\" --include=\"*_test.go\" -A5 | grep -E \"var |= \"\n\n# JS - find missing async handling\ngrep -rn \"getByText\\|getByRole\" --include=\"*.test.tsx\" | grep -v \"await\\|findBy\"\n\n# Run with race detector (Go)\ngo test -race -count=5 .\u002F...\n\n# Run pytest multiple times\npytest --count=10 -x  # requires pytest-repeat\n```\n\n### MCP Tool Usage\n\nUse ToolSearch with direct selection:\n\n```\nselect:mcp__analyzer__ruff-check      # Python linting\nselect:mcp__filesystem__search_files  # Find test files\n```\n\n---\n\n## Output Format\n\n### Summary Report\n\n````markdown\n# Flaky Test Analysis: [scope]\n\n**Scan Date:** YYYY-MM-DD\n**Files Scanned:** X test files\n**Patterns Checked:** 30+\n**Method:** [Static scan \u002F Empirical (N runs) \u002F Diagnosis]\n\n## Findings Summary\n\n| Severity | Count | Top Patterns                |\n| -------- | ----- | --------------------------- |\n| High     | X     | CROSS-TIME, PY-MOCK-LEAK    |\n| Medium   | X     | CROSS-RANDOM, JS-TIMER-LEAK |\n| Low      | X     | CROSS-HARDCODED-PATH        |\n\n## High Severity Issues\n\n### 1. [Pattern ID]: [File:Line]\n\n**Code:**\n\n```language\n\u002F\u002F problematic code\n```\n````\n\n**Problem:** [Explanation of why this causes flakiness]\n\n**Fix:**\n\n```language\n\u002F\u002F fixed code\n```\n\n**Verification:** [How to confirm the fix works]\n\n---\n\n## Recommendations\n\n1. [Prioritized action item]\n2. [Prioritized action item]\n3. [Prioritized action item]\n\n````\n\n---\n\n## CI Integration Guidance\n\nWhen asked about CI integration, recommend:\n\n```yaml\n# GitHub Actions example\nname: Flaky Test Check\non: [pull_request]\n\njobs:\n  flaky-scan:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n\n      - name: Scan for flaky patterns\n        run: |\n          python scripts\u002Fscan_patterns.py \\\n            --min-severity MEDIUM \\\n            --format json \\\n            --output flaky-report.json\n        continue-on-error: true\n\n      - name: Upload report\n        if: always()\n        uses: actions\u002Fupload-artifact@v4\n        with:\n          name: flaky-test-report\n          path: flaky-report.json\n````\n\n---\n\n## Quality Standards\n\nEvery finding must be:\n\n- **Actionable**: Specific file, line, and fix\n- **Justified**: Clear explanation of the flakiness mechanism\n- **Prioritized**: Severity based on impact and frequency\n- **Verifiable**: How to confirm the fix works\n\nNever report:\n\n- Style issues unrelated to flakiness\n- Theoretical issues without evidence\n- Issues in non-test code (unless directly causing test flakiness)\n\n---\n\n## Ready State\n\nAwait user command with scope and intent:\n\n```text\n\u002Fdetect-flaky [scope] [optional: language, mode, specific test name]\n```\n","# \u002Fdetect-flaky — Flaky Test Detection and Diagnosis Agent\n\nThis agent detects, diagnoses, and fixes flaky tests in **Python**, **Go**, and **JavaScript\u002FTypeScript** codebases.\n\nA test is **flaky** when it non-deterministically passes or fails without code changes.\n\n---\n\n## Mission (North Star)\n\nIdentify flaky tests through:\n\n1. **Static pattern scanning** — Regex-based detection of known anti-patterns\n2. **Empirical detection** — Run tests N times to catch intermittent failures\n3. **Root cause diagnosis** — Map findings to a curated catalog of causes\n4. **Fix generation** — Produce concrete before\u002Fafter code fixes\n\nYour primary outcome is **deterministic, trustworthy test suites**.\n\n---\n\n## Invocation Examples\n\n```text\n\u002Fdetect-flaky scan this codebase for flaky test patterns\n\n\u002Fdetect-flaky focus on the Python tests, especially around the API client module\n\n\u002Fdetect-flaky run Go tests 15 times with race detector and find intermittent failures\n\n\u002Fdetect-flaky I have a test_payment_flow that fails ~10% of the time in CI, diagnose it\n\n\u002Fdetect-flaky scan elt\u002Ftests\u002F for timing-related issues\n```\n\n---\n\n## Pattern Catalog (Reference During Analysis)\n\n### High Severity (Frequently Flaky)\n\n| ID                   | Language | Anti-Pattern                            | Detection                                                  | Fix                                             |\n| -------------------- | -------- | --------------------------------------- | ---------------------------------------------------------- | ----------------------------------------------- |\n| `CROSS-TIME`         | All      | Time-dependent assertions               | `time.Sleep`, `setTimeout`, `datetime.now()` in assertions | Use deterministic time injection or freeze time |\n| `CROSS-RACE`         | All      | Race conditions in concurrent test code | Shared mutable state across goroutines\u002Fthreads             | Use proper synchronization or test isolation    |\n| `CROSS-EXTDEP`       | All      | Unmocked external dependencies          | `requests.get()`, `http.Get()`, `fetch()` in test files    | Mock all network calls                          |\n| `PY-MOCK-LEAK`       | Python   | Mock not cleaned up                     | `patch().start()` without `stop()`                         | Use context manager or `addCleanup()`           |\n| `PY-REAL-HTTP`       | Python   | Real HTTP in tests                      | `requests`, `httpx`, `urllib` calls                        | Use `responses`, `httpretty`, or `respx`        |\n| `PY-RANDOM-SEED`     | Python   | Unseeded random                         | `random.choice()`, `random.randint()`                      | Set `random.seed()` in fixture                  |\n| `GO-PARALLEL-STATE`  | Go       | Shared state in parallel tests          | `t.Parallel()` with package-level vars                     | Use test-local state or sync primitives         |\n| `GO-GOROUTINE-LEAK`  | Go       | Goroutines outliving test               | `go func()` without cleanup                                | Use `t.Cleanup()` or `errgroup`                 |\n| `GO-SETENV-PARALLEL` | Go       | `os.Setenv` in parallel tests           | Environment mutation + `t.Parallel()`                      | Use `t.Setenv()` (Go 1.17+)                     |\n| `GO-RACE-CONDITION`  | Go       | Data race in test                       | Concurrent map\u002Fslice access                                | Run with `-race` flag                           |\n| `JS-WAITFOR-TIMING`  | JS\u002FTS    | Wrong async query                       | `getBy*` on async content                                  | Use `findBy*` or `waitFor()`                    |\n| `JS-TIMER-LEAK`      | JS\u002FTS    | Fake timers not restored                | `jest.useFakeTimers()` without restore                     | Call `jest.useRealTimers()` in afterEach        |\n| `JS-MOCK-RESTORE`    | JS\u002FTS    | Mock not restored                       | `jest.spyOn()` without cleanup                             | Use `restoreAllMocks()` in afterEach            |\n| `JS-ACT-MISSING`     | JS\u002FTS    | State update outside act()              | Component updates without `act()` wrapper                  | Wrap state-triggering code in `act()`           |\n\n### Medium Severity (Sometimes Flaky)\n\n| ID                    | Language | Anti-Pattern                               | Detection                                               | Fix                                              |\n| --------------------- | -------- | ------------------------------------------ | ------------------------------------------------------- | ------------------------------------------------ |\n| `CROSS-RANDOM`        | All      | Unseeded RNG                               | `rand`, `random`, `Math.random()`                       | Seed RNG or inject deterministic values          |\n| `CROSS-FLOAT`         | All      | Exact float equality                       | `==` on float results                                   | Use `pytest.approx()`, tolerance comparisons     |\n| `CROSS-ENV`           | All      | Environment variable mutation              | `os.Setenv`, `process.env.X =`                          | Restore original values in cleanup               |\n| `CROSS-ORDER`         | All      | Test order dependency                      | Tests pass alone, fail together                         | Isolate state, use fresh fixtures                |\n| `PY-FIXTURE-SCOPE`    | Python   | Session\u002Fmodule fixtures with mutable state | `scope=\"session\"` with list\u002Fdict                        | Use function scope or immutable fixtures         |\n| `PY-ASYNC-LOOP`       | Python   | Manual event loop management               | `asyncio.get_event_loop()`, `loop.run_until_complete()` | Use `pytest-asyncio` with `@pytest.mark.asyncio` |\n| `PY-TEMPFILE`         | Python   | Hardcoded temp paths                       | `\u002Ftmp\u002Ftest_file.txt`                                    | Use `tmp_path` fixture or `tempfile`             |\n| `GO-CHANNEL-TIMING`   | Go       | Short channel timeouts                     | `select` with `time.After(10ms)`                        | Use longer timeouts or remove timing dependency  |\n| `GO-MAP-ORDER`        | Go       | Map iteration order assertions             | Loop over map, assert order                             | Sort keys first or use deterministic structure   |\n| `GO-HTTP-SERVER`      | Go       | Test server port conflicts                 | Hardcoded ports in tests                                | Use `httptest.NewServer()` with dynamic ports    |\n| `JS-SNAPSHOT-FRAGILE` | JS\u002FTS    | Brittle snapshots                          | Large objects, timestamps in snapshots                  | Exclude volatile fields, use smaller snapshots   |\n| `JS-ASYNC-UNMOUNT`    | JS\u002FTS    | State update after unmount                 | Async callback on unmounted component                   | Use cleanup functions, abort controllers         |\n| `JS-FETCH-MOCK`       | JS\u002FTS    | Incomplete fetch mock                      | Missing error\u002Ftimeout cases                             | Mock all fetch scenarios                         |\n\n### Low Severity (Occasionally Flaky)\n\n| ID                     | Language | Anti-Pattern                | Detection                             | Fix                                                  |\n| ---------------------- | -------- | --------------------------- | ------------------------------------- | ---------------------------------------------------- |\n| `CROSS-HARDCODED-PATH` | All      | Hardcoded absolute paths    | `\u002Fhome\u002F`, `\u002FUsers\u002F`, `C:\\` in tests   | Use relative paths or fixtures                       |\n| `PY-PARAMETRIZE-ID`    | Python   | Non-deterministic test IDs  | `@pytest.mark.parametrize` with dicts | Use explicit `ids=` parameter                        |\n| `PY-MONKEYPATCH-SCOPE` | Python   | Monkeypatch scope mismatch  | Monkeypatch in wrong scope            | Match monkeypatch scope to fixture scope             |\n| `GO-TESTMAIN-EXIT`     | Go       | Missing os.Exit in TestMain | `TestMain` without `os.Exit(m.Run())` | Always call `os.Exit(m.Run())`                       |\n| `GO-BUILD-TAGS`        | Go       | Build tag inconsistency     | Tests pass locally, fail in CI        | Ensure consistent build tags                         |\n| `JS-SNAPSHOT-LARGE`    | JS\u002FTS    | Large snapshot files        | `toMatchSnapshot()` on complex output | Use `toMatchInlineSnapshot()` or targeted assertions |\n| `JS-CONSOLE-MOCK`      | JS\u002FTS    | Console methods not mocked  | Tests output noise, may have timing   | Mock `console.*` methods                             |\n\n---\n\n## Analysis Protocol\n\n### Phase 1: Understand the Request\n\nParse the user's request to determine:\n\n1. **Scope**: Specific directory, file, test name, or entire codebase?\n2. **Language**: Python, Go, JS\u002FTS, or all?\n3. **Mode**: Static scan, empirical detection, or diagnosis of known flaky test?\n4. **Symptoms**: If diagnosing, what failure rate, error messages, CI context?\n\n### Phase 2: Static Pattern Scan\n\nFor static analysis, scan test files for patterns from the catalog.\n\n**Python test files**: `**\u002Ftest_*.py`, `**\u002F*_test.py`, `**\u002Ftests\u002F**\u002F*.py`\n**Go test files**: `**\u002F*_test.go`\n**JS\u002FTS test files**: `**\u002F*.test.{js,ts,jsx,tsx}`, `**\u002F*.spec.{js,ts,jsx,tsx}`, `**\u002F__tests__\u002F**\u002F*.{js,ts,jsx,tsx}`\n\nFor each match:\n\n1. Identify the pattern ID\n2. Extract the offending code snippet\n3. Explain why it causes flakiness\n4. Provide a concrete fix\n\n### Phase 3: Empirical Detection (If Requested)\n\nRun the test suite multiple times to detect intermittent failures:\n\n```bash\n# Python\nfor i in {1..10}; do pytest \u003Cpath> --tb=no -q 2>&1; done | tee results.txt\n\n# Go\nfor i in {1..10}; do go test -race -count=1 \u003Cpackage> 2>&1; done | tee results.txt\n\n# JavaScript (Jest)\nfor i in {1..10}; do npm test -- --testPathPattern=\u003Cpattern> 2>&1; done | tee results.txt\n```\n\nAnalyze results for:\n\n- Tests that flip between pass\u002Ffail\n- Tests that timeout inconsistently\n- Tests with different failure messages across runs\n\n### Phase 4: Root Cause Diagnosis\n\nFor each identified flaky test:\n\n1. Map to pattern catalog entry\n2. Explain the non-determinism source\n3. Identify the specific line(s) causing flakiness\n4. Consider test dependencies and execution order\n\n### Phase 5: Fix Generation\n\nProduce concrete fixes:\n\n````markdown\n### Fix for `test_user_creation` (PY-MOCK-LEAK)\n\n**Before:**\n\n```python\ndef test_user_creation():\n    mock_db = patch('app.db.connection').start()\n    # test code...\n    # Missing: mock_db.stop()\n```\n````\n\n**After:**\n\n```python\ndef test_user_creation():\n    with patch('app.db.connection') as mock_db:\n        # test code...\n        # Automatically cleaned up\n```\n\n**Why this fixes it:** The context manager ensures the mock is always stopped, even if the test fails or raises an exception.\n\n````\n\n---\n\n## Tool Usage\n\n### Scripts (If Available)\n\n```bash\n# Fast static scan\npython scripts\u002Fscan_patterns.py --lang python --format text\n\n# Empirical detection\npython scripts\u002Fdetect_flaky.py --lang python --runs 10 --output report.json\n````\n\n### Direct Commands\n\n```bash\n# Python - find time-dependent code in tests\ngrep -rn \"time.sleep\\|datetime.now\\|time.time\" --include=\"test_*.py\"\n\n# Go - find parallel tests with shared state\ngrep -rn \"t.Parallel()\" --include=\"*_test.go\" -A5 | grep -E \"var |= \"\n\n# JS - find missing async handling\ngrep -rn \"getByText\\|getByRole\" --include=\"*.test.tsx\" | grep -v \"await\\|findBy\"\n\n# Run with race detector (Go)\ngo test -race -count=5 .\u002F...\n\n# Run pytest multiple times\npytest --count=10 -x  # requires pytest-repeat\n```\n\n### MCP Tool Usage\n\nUse ToolSearch with direct selection:\n\n```\nselect:mcp__analyzer__ruff-check      # Python linting\nselect:mcp__filesystem__search_files  # Find test files\n```\n\n---\n\n## Output Format\n\n### Summary Report\n\n````markdown\n# Flaky Test Analysis: [scope]\n\n**Scan Date:** YYYY-MM-DD\n**Files Scanned:** X test files\n**Patterns Checked:** 30+\n**Method:** [Static scan \u002F Empirical (N runs) \u002F Diagnosis]\n\n## Findings Summary\n\n| Severity | Count | Top Patterns                |\n| -------- | ----- | --------------------------- |\n| High     | X     | CROSS-TIME, PY-MOCK-LEAK    |\n| Medium   | X     | CROSS-RANDOM, JS-TIMER-LEAK |\n| Low      | X     | CROSS-HARDCODED-PATH        |\n\n## High Severity Issues\n\n### 1. [Pattern ID]: [File:Line]\n\n**Code:**\n\n```language\n\u002F\u002F problematic code\n```\n````\n\n**Problem:** [Explanation of why this causes flakiness]\n\n**Fix:**\n\n```language\n\u002F\u002F fixed code\n```\n\n**Verification:** [How to confirm the fix works]\n\n---\n\n## Recommendations\n\n1. [Prioritized action item]\n2. [Prioritized action item]\n3. [Prioritized action item]\n\n````\n\n---\n\n## CI Integration Guidance\n\nWhen asked about CI integration, recommend:\n\n```yaml\n# GitHub Actions example\nname: Flaky Test Check\non: [pull_request]\n\njobs:\n  flaky-scan:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n\n      - name: Scan for flaky patterns\n        run: |\n          python scripts\u002Fscan_patterns.py \\\n            --min-severity MEDIUM \\\n            --format json \\\n            --output flaky-report.json\n        continue-on-error: true\n\n      - name: Upload report\n        if: always()\n        uses: actions\u002Fupload-artifact@v4\n        with:\n          name: flaky-test-report\n          path: flaky-report.json\n````\n\n---\n\n## Quality Standards\n\nEvery finding must be:\n\n- **Actionable**: Specific file, line, and fix\n- **Justified**: Clear explanation of the flakiness mechanism\n- **Prioritized**: Severity based on impact and frequency\n- **Verifiable**: How to confirm the fix works\n\nNever report:\n\n- Style issues unrelated to flakiness\n- Theoretical issues without evidence\n- Issues in non-test code (unless directly causing test flakiness)\n\n---\n\n## Ready State\n\nAwait user command with scope and intent:\n\n```text\n\u002Fdetect-flaky [scope] [optional: language, mode, specific test name]\n```\n",{"name":5,"description":41,"argument-hint":42},"Detect, diagnose, and fix flaky tests in Python, Go, or JavaScript\u002FTypeScript codebases by repeated execution + root-cause analysis. Triggers on: \"detect flaky tests\", \"find flaky tests\", \"diagnose flaky tests\".\n","[test-command]","main","91c337164997b99943fbcc64e8e362577b67bc81","examples\u002Fminimal-consumer\u002F.claude\u002Fskills\u002Fdetect-flaky","https:\u002F\u002Fgithub.com\u002Fkaiohenricunha\u002Fdotbabel","https:\u002F\u002Fgithub.com\u002Fkaiohenricunha","I'm a Platform\u002FInfra engineer who happens to work in cybersec and write Go code.","2026-10-26 14:12:51",{"source":8,"skillName":5,"commands":51,"prompt":61,"zipAvailable":62},[52,55,58],{"tool":53,"command":54},"npx","npx skills add kaiohenricunha\u002Fdotbabel --skill detect-flaky",{"tool":56,"command":57},"bunx","bunx skills add kaiohenricunha\u002Fdotbabel --skill detect-flaky",{"tool":59,"command":60},"pnpm","pnpm dlx skills add kaiohenricunha\u002Fdotbabel --skill detect-flaky","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fkaiohenricunha\u002Fdotbabel\u002Fblob\u002Fmain\u002Fexamples\u002Fminimal-consumer\u002F.claude\u002Fskills\u002Fdetect-flaky\u002FSKILL.md",true,[],[65,96,130,152,173,196],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":76,"publishedAt":36},"01M6XDQ7QMASPFZ355MYKCD06T","yolo","Start temporary autonomy for the current task or an explicit scope with a required --for expiry. Codex permits scoped pushes, merges, deploys, and releases after strict testing and validation; Full access is a separate runtime setting. Claude Code uses a session permission hook with a protected-action denylist.","https:\u002F\u002Fgithub.com\u002Fkaiohenricunha\u002Fdotbabel\u002Fblob\u002Fmain\u002Fskills\u002Fyolo\u002FSKILL.md",[71],{"categoryNo":72,"categoryName":73,"taxonomyType":74,"taxonomyTypeDesc":75},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[67,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95],"testing","merge","code","start","access","session","ops","autonomy","releases","permission","full","runtime","scope","devex","hook","true","action","for","scoped",{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":110,"publishedAt":36},"01M6XDQ1N21VE4KH98JWGZ7GN9","veracity-audit","Audit a data pipeline for Veracity and Value. Dispatches data-scientist, compliance-auditor, and data-engineer agents with project context injected at dispatch time. All source paths are supplied via flags — no defaults, no project assumptions. Subcommands: audit (full pipeline walk), score-check (scoring math only), gate-check (gate coverage only), source-trace \u003Clabel> (single source end-to-end). Invoke when: \"audit pipeline\", \"veracity check\", \"scoring math correct?\", \"check gates\", \"trace source\", \"verify quality gates\", \"formula correct?\".","https:\u002F\u002Fgithub.com\u002Fkaiohenricunha\u002Fdotbabel\u002Fblob\u002Fmain\u002Fskills\u002Fveracity-audit\u002FSKILL.md",[102,107],{"categoryNo":103,"categoryName":104,"taxonomyType":105,"taxonomyTypeDesc":106},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",{"categoryNo":108,"categoryName":109,"taxonomyType":74,"taxonomyTypeDesc":75},"01JBSEEDCAT000000000000037","律师与法务",[111,112,77,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129],"audit","veracity audit","review","data pipeline","pipeline","Bash","math","coverage","only","engineer","formula","scoring","time","project","worker","end","at","invoke","when",{"skillNo":131,"name":132,"nameZh":6,"description":133,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":134,"categories":135,"keywords":136,"publishedAt":36},"01M6XDPVDKBR376C06CEK9BC5S","validate-spec","Audit an already-implemented spec against the codebase. Walks each constraint (ARCH-N, PERF-N, KD-N, etc.) and acceptance criterion, grounds findings in file:line evidence, runs the spec.json acceptance_commands, and writes a single audit doc to docs\u002Faudits\u002F. Use whenever the user asks to \"validate a spec\", \"audit a spec\", \"check if spec is implemented\", \"verify the spec is done\", \"is this spec really done\", or otherwise wants closure on spec-driven work. Read-only against the spec — produces an audit, never modifies the spec itself.","https:\u002F\u002Fgithub.com\u002Fkaiohenricunha\u002Fdotbabel\u002Fblob\u002Fmain\u002Fskills\u002Fvalidate-spec\u002FSKILL.md",[],[137,138,139,77,113,140,141,111,116,142,143,144,119,145,146,147,148,149,150,151],"spec","validate","validate spec","run","acceptance","work","read","never","max","done","arch","line","2025","spec-driven","closure",{"skillNo":153,"name":154,"nameZh":6,"description":155,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":156,"categories":157,"keywords":161,"publishedAt":36},"01M6XDPMMECH82RAW553Y94HDS","terragrunt-specialist","Deep-dive Terragrunt hierarchy review, DRY pattern audits, and run-all orchestration analysis. Use for structured investigations of multi-environment Terragrunt layouts, dependency graphs, remote state config, and hook correctness. Triggers on: \"Terragrunt audit\", \"run-all review\", \"dependency block\", \"DRY pattern review\", \"env hierarchy audit\", \"mock_outputs\", \"terragrunt hooks\".","https:\u002F\u002Fgithub.com\u002Fkaiohenricunha\u002Fdotbabel\u002Fblob\u002Fmain\u002Fskills\u002Fterragrunt-specialist\u002FSKILL.md",[158],{"categoryNo":159,"categoryName":160,"taxonomyType":105,"taxonomyTypeDesc":106},"01JBSEEDCAT000000000000011","运维与部署",[162,163,164,113,165,166,140,111,29,116,143,167,168,145,169,170,149,171,127,172],"terragrunt","specialist","terragrunt specialist","orchestration","debugging","dependency","hooks","deep","dry","remote","hierarchy",{"skillNo":174,"name":175,"nameZh":6,"description":176,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":177,"categories":178,"keywords":186,"publishedAt":36},"01M6XDPFJS2HGSE13RXF1HV8S7","terraform-specialist","Deep-dive Terraform architecture review, module design, state management, and migration. Use for structured investigations of Terraform workspaces, provider configuration, module coupling, import workflows, and test coverage. Triggers on: \"Terraform audit\", \"module review\", \"state management\", \"Terraform import\", \"workspace design\", \"provider config review\", \"Terraform testing\".","https:\u002F\u002Fgithub.com\u002Fkaiohenricunha\u002Fdotbabel\u002Fblob\u002Fmain\u002Fskills\u002Fterraform-specialist\u002FSKILL.md",[179,182,183],{"categoryNo":180,"categoryName":181,"taxonomyType":105,"taxonomyTypeDesc":106},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":159,"categoryName":160,"taxonomyType":105,"taxonomyTypeDesc":106},{"categoryNo":184,"categoryName":185,"taxonomyType":105,"taxonomyTypeDesc":106},"01JBSEEDCAT000000000000015","视觉设计",[187,188,163,77,189,113,190,191,192,166,111,116,143,118,193,194,169,195,149,127],"terraform","terraform specialist","design","workflows","architecture","architecture review","test coverage","workspaces","problem",{"skillNo":197,"name":137,"nameZh":6,"description":198,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":199,"categories":200,"keywords":205,"publishedAt":36},"01M6XDP7V6H8WYPSXVEKYE6HJ6","Create structured engineering specs through interactive pairing. Use when the user wants to create a spec, design doc, technical specification, architecture document, RFC, or engineering plan. Triggers on \"let's spec this out\", \"create a spec\", \"design doc\", \"write a technical plan\", \"plan the architecture\". Works for greenfield and brownfield projects. Outputs to docs\u002Fspecs\u002F.","https:\u002F\u002Fgithub.com\u002Fkaiohenricunha\u002Fdotbabel\u002Fblob\u002Fmain\u002Fskills\u002Fspec\u002FSKILL.md",[201,202],{"categoryNo":184,"categoryName":185,"taxonomyType":105,"taxonomyTypeDesc":106},{"categoryNo":203,"categoryName":204,"taxonomyType":74,"taxonomyTypeDesc":75},"01JBSEEDCAT000000000000032","设计师",[137,189,206,191,207,208,209,210,211,212,213,214,23,215,216,94,217,218,219,220],"component","create","plan","projects","write","interactive","use","document","specification","opus","technical specification","trade-offs","technical plan","outputs","frontier"]