testing-patterns
Skill2 starsChanged 51 days agoMITView on GitHub
Use when writing automated tests, creating test fixtures, configuring test mocks or testcontainers, implementing contract tests, or refactoring test suites. Don't use for manual QA testing plans (author manual QA checklists directly), load testing scripts (author load testing scripts directly), or visual regression screenshot testing (use ui-ux-review).
- Deletes or force-pushes
44 other projects use a version of this.
Adopted by
Most recently taken up by
- xsovad06/sovatheir own version, first seen Nov 8, 2026
- gopalparashar421/agent-skillstheir own version, first seen Nov 8, 2026
- soilmass/motion-design-agenttheir own version, first seen Nov 8, 2026
- seandkendall/kiro-configtheir own version, first seen Nov 1, 2026
- svngoku/coding-agents-skillstheir own version, first seen Nov 1, 2026
- piomin/claude-ai-spring-boottheir own version, first seen Oct 25, 2026
Used with
Projects with it also use intelligent-routing, bash-linux and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
SKB3002Skillintelligent-routing
Automatic agent selection and intelligent task routing. Analyzes user requests and automatically selects the best specialist agent(s) without requiring explicit user mentions.
Also in 5 projects that use this
xenitV1Skillbash-linux
Bash/Linux terminal patterns. Critical commands, piping, error handling, scripting. Use when working on macOS or Linux systems.
Also in 6 projects that use this
xenitV1Skillred-team-tactics
Red team tactics principles based on MITRE ATT&CK. Attack phases, detection evasion, reporting.
Also in 6 projects that use this
ChrisWilesSkillformik-patterns
Formik form handling with validation patterns. Use when building forms, implementing validation, or handling form submission.
Also in 3 projects that use this
SKB3002Skillnextjs-react-expert
React and Next.js performance optimization from Vercel Engineering. Use when building React components, optimizing performance, eliminating waterfalls, reducing bundle size, reviewing code for performance issues, or implementing server/client-side optimizations.
Also in 3 projects that use this
adybaSkillsafe-workflow
SAFe Agentic Workflow orchestrator. Teaches the full SAFe methodology adapted for AI agents: pattern discovery, exit states, quality gates, agent personas, and specs-driven development. Use when setting up a project with SAFe workflow, understanding the multi-agent methodology, or coordinating work across agent personas. Triggers: "SAFe workflow", "agent workflow", "safe harness", "specs-driven", "exit states", "quality gates", "multi-agent workflow".
Also in 3 projects that use this
- +4 more from xenitV1
Other versions44 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 44
- vudovn/ag-kit★ 8.2ksame name
- vudovn/antigravity-kit★ 8.2ksame name
- ChrisWiles/claude-code-showcase★ 6.1ksame name
- ag2ai/faststream★ 5.4ksame name
- piomin/claude-ai-spring-boot★ 1.4ksame name
- bybren-llc/safe-agentic-workflow★ 405same name
- dilolabs/nosia★ 211same name
- xenitV1/Antigravity-Workflows★ 130same name
- langchain-ai/skills-benchmarks★ 116same name
- leather-io/mono★ 28same name
34 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository35 other files it gives its agents.
- agent-planningSkill
- brainstormingSkill
- codebase-designSkill
- code-reviewSkill
- conventional-commitSkill
- copy-web-designSkill
- executing-plansSkill
- frontend-designSkill
- i18nSkill
- laravelSkill
- prototypeSkill
- pull-requestSkill
- reactSkill
- recursive-researchSkill
- reflect-to-skillSkill
- review-a-skillSkill
- s13nSkill
- schema-migrationSkill
- security-auditSkill
- skill-testingSkill
- summarizeSkill
- systematic-debuggingSkill
- t3-operational-guardrailSkill
- technical-writingSkill
- ui-motionSkill
- ui-ux-reviewSkill
- unslopSkill
- upsert-codebase-docsSkill
- verification-before-completionSkill
- vibe-wiseSkill
- web-advisor-promptSkill
- wizardSkill
- workspace-onboardingSkill
- writing-for-agentsSkill
- writing-plansSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 6 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 29 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Read the reference guides for domain-specific execution details:
- Very specific: line 20
Write-Target Boundary. Write only to tests/, spec/, __tests__/, and .agents/state/testing-patterns/.
- Distinctive: line 81
Run real database instances in ephemeral containers using Testcontainers instead of in-memory SQL emulators like SQLite or H2.
- Distinctive: line 85
Verify schema agreements using consumer-driven contracts with Pact instead of running live downstream services.
- Distinctive: line 93
Test components and services as black boxes:
- Distinctive: line 99
Use web-first assertions for asynchronous interfaces:
- Distinctive: line 107
Verify test execution speed, determinism, and absence of intermittent failures:
“Common” is measured: kept by at least 6 in 10 of the 29 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Testing patterns
Build deterministic, architecture-aligned test suites with clear network boundaries, isolated fixtures, and declarative assertions across frontend, backend, and browser layers.
Read the reference guides for domain-specific execution details:
- For frontend web interfaces, component trees, and accessibility auditing, read
references/frontend-patterns.md. - For backend services, containerized databases, API contracts, and property fuzzing, read
references/backend-patterns.md. - For browser user journeys, Playwright locators, and session reuse, read
references/e2e-patterns.md. - For test fixture generation, fluent builders, and tenant isolation, read
references/test-data-builders.md. - For seam boundary and mock isolation pitfalls, read
references/tdd-anti-patterns.md. - For pre-commit gates, Husky setup, and lint-staged automation, read
references/pre-commit-hooks.md. - For boundary value analysis, equivalence partitioning, and exploratory test charters, read
references/test-matrix-and-charters.md.
<HARD-GATE>
Write-Target Boundary. Write only to `tests/`, `spec/`, `__tests__/`, and `.agents/state/testing-patterns/`. Do not modify production source, database migrations, or CI configuration. `storageState` JSON files and captured credentials must be written to `.agents/state/testing-patterns/secrets/` and gitignored. Never modify production business logic to make a test pass.
</HARD-GATE>Modes
Select a testing mode before Step 1:
- Author mode (default). Write new automated test suites, contract tests, and test fixtures.
- Optimization mode. Refactor existing test suites, eliminate flaky tests, and optimize testcontainer startup latency.
Workflow
Execute the six testing steps sequentially. Complete each verification criterion before proceeding to the next step.
Step 1. Red-green loop and seam selection
Apply test-driven development through vertical slices at confirmed seam boundaries:
- Identify candidate public seams:
- Inspect the caller contract or public interface specification.
- Target public methods, API endpoints, or top-level component boundaries. Avoid reaching into private collaborators or internal state.
- Consult
references/tdd-anti-patterns.mdfor seam boundary and mock isolation pitfalls.
- Execute the Red-green loop per vertical slice:
- Red. Write a minimal failing test that observes behavior at the public seam. Run the test to confirm it fails cleanly from missing behavior rather than syntax or setup errors.
- Green. Write minimal production code to pass the test without premature optimization, unused configurability, or speculative abstractions. Run the test suite to confirm clean passes.
- Refactor. Clean up structure, remove duplication, and improve readability only after tests pass.
- Repeat the loop for subsequent vertical slices.
Completion criterion. Target seams map to public contracts, and every slice passes through verified red-green cycles before refactoring.
Step 2. Scope and tier selection
Align testing scope with system topology to prevent duplicated test coverage:
- Choose the distribution model matching target architecture:
- Testing Trophy for web applications and client components. Concentrate coverage on integration tests and restrict unit tests to pure functions and state machines.
- Testing Pyramid for backend monoliths with rich domain rules. Anchor the base with fast domain unit tests, intermediate service tests, and a small apex of end-to-end journeys.
- Testing Honeycomb for microservices and event systems. Focus on service-level integration tests, Pact boundary contracts, and minimal integrated flows.
- For browser suites, limit scope to Tier 1 business journeys whose failure blocks revenue or authentication. Delegate secondary validations, form errors, and edge layouts to component integration suites.
Completion criterion. The testing tier matches system architecture, and test scope excludes redundant coverage across tiers.
Step 3. Test data strategy via test data builders
Construct fixtures through fluent test data builders following Google DAMP (Descriptive And Meaningful Phrases) principles:
- Replace static JSON dumps and raw SQL scripts with fluent builders to keep test intent visible.
- Encapsulate valid default attributes within builders. Invoking
build()without arguments must yield a valid, persistable entity. - Chain override methods such as
withStatus()orwithTier()to declare only attributes required by the specific test. - Inject sequential counters or random identifiers into emails, primary keys, and tenant identifiers to maintain test isolation during parallel execution.
Completion criterion. .agents/state/testing-patterns/fixture-strategy.md exists on disk and records the chosen fixture authoring pattern for the primary language. grep -rn "INSERT INTO\|JSON.parse.*\.json" tests/ --include='*.test.*' --include='*.spec.*' returns zero matches in test file bodies. Matches inside shared fixture setup files listed in the state artifact are permitted.
Step 4. Network and dependency isolation
Isolate network boundaries and infrastructure dependencies through environment-native interception:
- For frontend component and integration tests:
- Intercept HTTP requests at the transport boundary using Mock Service Worker (MSW v2) instead of monkey-patching
global.fetchor Axios instances. - Configure lifecycle hooks to start MSW before tests, reset handlers after every test, and close the server on teardown.
- Set MSW to throw errors on unhandled requests to detect missing mock endpoints.
- Intercept HTTP requests at the transport boundary using Mock Service Worker (MSW v2) instead of monkey-patching
- For backend persistence tests:
- Run real database instances in ephemeral containers using Testcontainers instead of in-memory SQL emulators like SQLite or H2.
- On Linux hosts, mount database storage onto
tmpfsto eliminate disk write latency. On macOS Darwin, do not attempt to mounttmpfs; the host kernel has no tmpfs. When Docker Desktop or Colima runs Linux containers, the container's own/dev/shmis already tmpfs-backed by the Linux VM, so container-internal tmpfs works without host-side mount. Record the resolved filesystem type in.agents/state/testing-patterns/tmpfs-status.txtwith one ofcontainer-tmpfs,host-tmpfs, ordisk-fallback. - Share a singleton container instance across test files and truncate tables with cascading resets between tests.
- For distributed microservice boundaries:
- Verify schema agreements using consumer-driven contracts with Pact instead of running live downstream services.
Completion criterion. Network calls intercept cleanly through MSW. Backend persistence tests execute against containerized databases. If .agents/state/testing-patterns/tmpfs-status.txt contains container-tmpfs or host-tmpfs, the databases are mounted on tmpfs. If it contains disk-fallback, the completion criterion is satisfied without tmpfs and the file records why tmpfs was unavailable.
Step 5. Declarative assertion construction
Construct assertions that evaluate public observable behavior and accessibility trees instead of internal implementation details:
- Test components and services as black boxes:
- Assert on observable DOM output, HTTP responses, and database state instead of internal state variables or private methods.
- Reserve call count verification strictly for external side-effect boundaries like payment gateways or email dispatchers.
- Locate user interface elements through the accessibility tree:
- Query elements in the priority order of
getByRole,getByLabelText,getByPlaceholderText, andgetByText. - Locate elements through semantic role and label queries; use
getByTestIdonly as a fallback for non-semantic controls, and never query by CSS classes, HTML tags, or XPath selectors.
- Query elements in the priority order of
- Use web-first assertions for asynchronous interfaces:
- Assert with auto-waiting matchers like
expect(locator).toBeVisible()orexpect(locator).toHaveText()that poll the DOM until conditions settle. - Pair element checks with auto-waiting assertions; never execute immediate assertions against static snapshots.
- Assert with auto-waiting matchers like
Completion criterion. Assertions verify only public behavior, accessible roles, or persisted state without inspecting internal implementation mechanics.
Step 6. Speed and determinism verification
Verify test execution speed, determinism, and absence of intermittent failures:
- Meet latency budgets:
- Meet latency budgets recorded in the test tier's configuration file (such as
jest.config.js,vitest.config.ts,phpunit.xml, orpytest.ini). If a project has no configured budget, record the observed per-tier median in.agents/state/testing-patterns/latency-baseline.txtand judge only regressions against the recorded baseline. - Integration tests complete within sub-second durations per test case using connection reuse. Tmpfs mounting improves latency but is not required for the sub-second budget on a warm container runtime. Record the observed p50 per test in
.agents/state/testing-patterns/latency-baseline.txtand treat that as the baseline. - Browser end-to-end journeys complete within 10 to 30 seconds per journey.
- Meet latency budgets recorded in the test tier's configuration file (such as
- Eliminate flakiness sources:
- Replace arbitrary sleep calls like
sleep()orwaitForTimeout()with explicit assertions on visible UI states or resolved network promises. - Replace
page.waitForLoadState('networkidle')with explicit element locators or backend response listeners. - Inject pre-authenticated
storageStateJSON files into browser contexts instead of executing repetitive UI logins.
- Replace arbitrary sleep calls like
- Execute the full test suite three consecutive times across multiple worker processes without failures.
Completion criterion. The suite passes three consecutive parallel test runs with zero arbitrary sleeps and within established latency budgets.
Boundary isolation
Confine testing operations strictly to test suites (tests/, spec/), fixtures, and mock definitions. Never modify production business logic or loosen database constraints to force tests to pass.
Quick audit checklist
Audit test implementations against this table before finalizing:
| Check | Passing condition |
| Public interface assertions | Assert on public interfaces, observable DOM, and return values, never private implementation details |
| Deterministic waiting | Use web-first auto-waiting assertions on visible elements, never arbitrary sleeps such as sleep() or waitForTimeout() |
| Selector resilience | Query accessible roles (getByRole) and explicit labels, never brittle CSS class or XPath queries |
| Database isolation | Run containerized databases on tmpfs mounts with table resets, never shared flaky state |
| Network boundary mocking | Intercept network transport boundaries cleanly with MSW v2, never direct fetch monkey patches |
| Coverage distribution | Choose the distribution model that matches the target architecture instead of duplicating coverage across tiers |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

