Testing Patterns
softspark/ai-toolkit
Testing strategy: pyramid, AAA, mocks/fakes/stubs, flaky tests, coverage.
Diagnose and fix tests that pass in isolation but fail when run concurrently.
$ npx skills add rileyhilliard/claude-essentials --skill fixing-flaky-tests -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install rileyhilliard/claude-essentials fixing-flaky-tests --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/rileyhilliard/claude-essentials.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/ce/skills/fixing-flaky-tests .claude/skills/fixing-flaky-tests && 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 "fixing-flaky-tests" agent skill from https://github.com/rileyhilliard/claude-essentials/tree/main/plugins/ce/skills/fixing-flaky-tests into .claude/skills/fixing-flaky-tests/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "fixing-flaky-tests", 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/rileyhilliard/claude-essentials/tree/main/plugins/ce/skills/fixing-flaky-testsType 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 rileyhilliard/claude-essentials --skill fixing-flaky-tests -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install rileyhilliard/claude-essentials fixing-flaky-tests --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/rileyhilliard/claude-essentials.git skills-src && mkdir -p .agents/skills && cp -r skills-src/plugins/ce/skills/fixing-flaky-tests .agents/skills/fixing-flaky-tests && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "fixing-flaky-tests" agent skill from https://github.com/rileyhilliard/claude-essentials/tree/main/plugins/ce/skills/fixing-flaky-tests into .agents/skills/fixing-flaky-tests/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "fixing-flaky-tests", 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 rileyhilliard/claude-essentials --skill fixing-flaky-tests -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install rileyhilliard/claude-essentials fixing-flaky-tests --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/rileyhilliard/claude-essentials.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/plugins/ce/skills/fixing-flaky-tests .cursor/skills/fixing-flaky-tests && 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 "fixing-flaky-tests" agent skill from https://github.com/rileyhilliard/claude-essentials/tree/main/plugins/ce/skills/fixing-flaky-tests into .cursor/skills/fixing-flaky-tests/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "fixing-flaky-tests", 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/rileyhilliard/claude-essentials.git --path plugins/ce/skills/fixing-flaky-tests--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 rileyhilliard/claude-essentials --skill fixing-flaky-tests -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install rileyhilliard/claude-essentials fixing-flaky-tests --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/rileyhilliard/claude-essentials.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/plugins/ce/skills/fixing-flaky-tests .gemini/skills/fixing-flaky-tests && 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 "fixing-flaky-tests" agent skill from https://github.com/rileyhilliard/claude-essentials/tree/main/plugins/ce/skills/fixing-flaky-tests into .gemini/skills/fixing-flaky-tests/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "fixing-flaky-tests", 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 rileyhilliard/claude-essentials fixing-flaky-testsInstalls 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 rileyhilliard/claude-essentials --skill fixing-flaky-tests -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/rileyhilliard/claude-essentials.git skills-src && mkdir -p .github/skills && cp -r skills-src/plugins/ce/skills/fixing-flaky-tests .github/skills/fixing-flaky-tests && 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 "fixing-flaky-tests" agent skill from https://github.com/rileyhilliard/claude-essentials/tree/main/plugins/ce/skills/fixing-flaky-tests into .github/skills/fixing-flaky-tests/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "fixing-flaky-tests", 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 rileyhilliard/claude-essentials --skill fixing-flaky-tests -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install rileyhilliard/claude-essentials fixing-flaky-tests --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/rileyhilliard/claude-essentials.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/plugins/ce/skills/fixing-flaky-tests .opencode/skills/fixing-flaky-tests && 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 "fixing-flaky-tests" agent skill from https://github.com/rileyhilliard/claude-essentials/tree/main/plugins/ce/skills/fixing-flaky-tests into .opencode/skills/fixing-flaky-tests/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "fixing-flaky-tests", 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.
fixing-flaky-testsDiagnose and fix tests that pass in isolation but fail when run concurrently.
Fixing Flaky Tests is an agent skill from rileyhilliard/claude-essentials. Diagnose and fix tests that pass in isolation but fail when run concurrently. Covers shared state isolation, resource conflicts, and timing-based flakiness.
Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/jest.md`, `references/playwright.md` and `references/python.md`).
It sits in Testing & QA, covering Failing and flaky tests. It works with Python, Jest, Playwright and TypeScript. The licence is MIT.
3 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit 3a67a01. 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:
pytestjestFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
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.
Fixing Flaky Tests loads about 1.1k tokens when it runs, and up to ~4.6k if it reads all its reference files. Until then it costs about 44 tokens; SKILL.md has 233 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 rileyhilliard/claude-essentials at commit 3a67a01, republished under its MIT licence (© rileyhilliard). 233 words, ~1,064 tokens.
.claude/skills/fixing-flaky-tests/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.If the current repo has its own rules/skills covering this topic (check .claude/rules/ and repo CLAUDE.md), those take precedence — apply this skill only where they're silent.
Target symptom: Tests pass when run alone, fail when run with other tests.
Test passes alone, fails with others?
│
├─ Same error every time → Shared state
│ └─ Database, globals, files, singletons
│
├─ Random/timing failures → Race condition
│ └─ See async waiting patterns in `writing-tests` skill
│
└─ Resource errors (port, file lock) → Resource conflict
└─ Need unique resources per test/workerQuick diagnosis:
Tests pollute state that other tests depend on. Fix by isolating state per test.
| State Type | Isolation Pattern |
|---|---|
| Database | Transaction rollback, savepoints, worker-specific DBs |
| Global variables | Reset in beforeEach/afterEach |
| Singletons | Provide fresh instance per test |
| Module state | jest.resetModules() or equivalent |
| Files | Unique paths per test, temp directories |
| Environment vars | Save/restore in setup/teardown |
Database isolation (most common):
# Python: Savepoint rollback - each test gets rolled back
@pytest.fixture
async def db_session(db_engine):
async with db_engine.connect() as conn:
await conn.begin()
await conn.begin_nested() # Savepoint
# ... yield session ...
await conn.rollback() # All changes vanish// Jest: Reset mocks between tests
beforeEach(() => {
jest.clearAllMocks()
jest.resetModules() // Clear module cache before test
})
afterEach(() => {
jest.restoreAllMocks() // Restore spied functions
})See language-specific references for complete patterns.
Tests don't wait for async operations to complete.
See the writing-tests skill for async waiting patterns:
findBy, Playwright auto-wait)Quick summary: Wait for conditions, not time:
// Bad
await sleep(500)
// Good
await waitFor(() => expect(result).toBe('done'))Multiple tests or workers compete for same resource.
Worker-specific resources:
# Python pytest-xdist: unique DB per worker
@pytest.fixture(scope="session")
def database_url(worker_id):
if worker_id == "master":
return "postgresql://localhost/test"
return f"postgresql://localhost/test_{worker_id}"// Jest/Node: dynamic port allocation
const server = app.listen(0) // OS assigns available port
const port = server.address().portFile conflicts:
import tempfile
@pytest.fixture
def temp_dir():
with tempfile.TemporaryDirectory() as d:
yield d| Stack | Reference |
|---|---|
| Python (pytest, SQLAlchemy) | references/python.md |
| Jest / Testing Library | references/jest.md |
| Playwright E2E | references/playwright.md |
| Async waiting patterns (TypeScript) | writing-tests waiting-typescript |
| Async waiting patterns (Python) | writing-tests waiting-python |
After fixing, verify the fix worked:
# Run the specific test many times
pytest tests/test_flaky.py -x --count=20
# Run with parallelism
pytest -n auto
# Jest equivalent
jest --runInBand # First verify serial works
jest # Then verify parallel works© rileyhilliard, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 3 other files (references) in plugins/ce/skills/fixing-flaky-tests of rileyhilliard/claude-essentials.
Open the folder on GitHubat commit 3a67a01
Fixing Flaky Tests 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 |
|---|---|---|---|---|---|---|
| Fixing Flaky Tests this skillrileyhilliard/claude-essentials | 130 | — | ~1.1k | Automated safety check: Pass | MIT | |
| Testing Patternssoftspark/ai-toolkit | 179 | — | ~1.6k | Automated safety check: Pass | Apache-2.0 | |
| RStudio Selenium to Playwright Migrationrstudio/rstudio | 5.1k | — | ~3.6k | Automated safety check: Pass | Custom licence | |
| Playwright Testingchongdashu/vibejam-starter-pack | 149 | — | ~2.1k | Automated safety check: Pass | None | |
| Playwright Testingchongdashu/vibejam-starter-pack | 149 | — | ~2.2k | Automated safety check: Pass | None | |
| Testingradix-ng/primitives | 274 | — | ~3.3k | Automated safety check: Pass | MIT |
softspark/ai-toolkit
Testing strategy: pyramid, AAA, mocks/fakes/stubs, flaky tests, coverage.
rstudio/rstudio
Converts RStudio Python Selenium electron tests into TypeScript Playwright tests, checking each against a live RStudio before counting it as migrated.
chongdashu/vibejam-starter-pack
Plan, implement, and debug frontend tests: unit/integration/E2E/visual/a11y.
chongdashu/vibejam-starter-pack
Plan, implement, and debug frontend tests: unit/integration/E2E/visual/a11y.
radix-ng/primitives
Test Radix NG primitives across every layer and pick the RIGHT one for a change: Vitest unit (zoneless), jest-axe a11y, Playwright browser regression (apps/visual-regression), SSR…
travisjneuman/.claude
Test-writing patterns for JS/TS, Python, Go, and Rust (unit, integration, E2E, visual regression).
rileyhilliard/claude-essentials
Prevents silent failures and context loss in error handling.
rileyhilliard/claude-essentials
Defines product features from a PM perspective (JTBD, competitive research, scope negotiation) before technical planning.
rileyhilliard/claude-essentials
Writes behavior-focused tests using Testing Trophy model with real dependencies.
rileyhilliard/claude-essentials
Measure-first performance optimization that balances gains against complexity.
rileyhilliard/claude-essentials
Guides clean, scalable system architecture during the build phase.
rileyhilliard/claude-essentials
Enforces precise, minimal design for dashboards and admin interfaces.
Works with
Categories
Diagnose and fix tests that pass in isolation but fail when run concurrently. Fixing Flaky Tests is an agent skill from rileyhilliard/claude-essentials. Diagnose and fix tests that pass in isolation but fail when run concurrently.
Fixing Flaky Tests fits situations like: tasks that involve Failing and flaky tests.
Run `npx skills add rileyhilliard/claude-essentials --skill fixing-flaky-tests -a claude-code`. Or copy the skill folder (plugins/ce/skills/fixing-flaky-tests in rileyhilliard/claude-essentials) into .claude/skills/fixing-flaky-tests in your project. Claude Code loads it when a task matches its description.
Run `npx skills add rileyhilliard/claude-essentials --skill fixing-flaky-tests -a codex`. Or copy the skill folder (plugins/ce/skills/fixing-flaky-tests in rileyhilliard/claude-essentials) into .agents/skills/fixing-flaky-tests 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 rileyhilliard/claude-essentials --skill fixing-flaky-tests -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/fixing-flaky-tests, .gemini/skills/fixing-flaky-tests, .github/skills/fixing-flaky-tests and .opencode/skills/fixing-flaky-tests in your project.
Going by SKILL.md and its folder, Fixing Flaky Tests needs the command-line tools its instructions call (pytest and jest). Our summary lists: Python 3.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. 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.
Fixing Flaky Tests is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.1k tokens (SKILL.md is roughly 4.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.6k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Fixing Flaky Tests: Testing Patterns (softspark/ai-toolkit, 179 stars), RStudio Selenium to Playwright Migration (rstudio/rstudio, 5.1k stars), Playwright Testing (chongdashu/vibejam-starter-pack, 149 stars) and Playwright Testing (chongdashu/vibejam-starter-pack, 149 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
rileyhilliard (a GitHub user) maintains it in rileyhilliard/claude-essentials, which has 130 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on August 18, 2026.
Source: rileyhilliard/claude-essentials on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.