testing-patterns
Skill2 starsChanged 2 months 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, load testing scripts, or visual regression screenshot testing.
- Deletes or force-pushes
24 other projects use a version of this.
Adopted by
Most recently taken up by
- Dregxmoon/Kaoru-Agenttheir own version, first seen Sep 15, 2026
- xsovad06/sovatheir own version, first seen Sep 4, 2026
- VoDaiLocz/kilo-kit-mcptheir own version, first seen Aug 21, 2026
- TheHiddenDeveloper/jarvis-skillstheir own version, first seen Aug 19, 2026
- svngoku/coding-agents-skillstheir own version, first seen Aug 13, 2026
- bybren-llc/safe-agentic-workflowtheir own version, first seen Jul 20, 2026
Used with
Projects with it also use intelligent-routing, api-patterns 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.
tiendatworkSkillintelligent-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 3 projects that use this
xfstudioSkillapi-patterns
API design principles and decision-making. REST vs GraphQL vs tRPC selection, response formats, versioning, pagination.
Also in 5 projects that use this
xfstudioSkillrust-pro
Master Rust 1.75+ with modern async patterns, advanced type system
Also in 3 projects that use this
benshapyroSkilldocumentation-templates
Generates README files, API documentation, and inline code comments following best practices. Use when creating project documentation, writing READMEs, documenting APIs, or explaining complex code.
Also in 3 projects that use this
- +8 more from xfstudio
Other versions24 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 24
- ChrisWiles/claude-code-showcase★ 6.1ksame name
- bybren-llc/safe-agentic-workflow★ 419same name
- langchain-ai/skills-benchmarks★ 118same name
- VoDaiLocz/kilo-kit-mcp★ 27same name
- 4444J99/a-i--skills★ 17same name
- svngoku/coding-agents-skills★ 11same name
- wpank/ai★ 11same name
- DIL8654/claude-code-dotnet-template★ 9same name
- Dregxmoon/Kaoru-Agent★ 9same name
- xfstudio/skills★ 9same name
14 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 repository24 other files it gives its agents.
- brainstormingSkill
- codebase-designSkill
- code-reviewSkill
- conventional-commitSkill
- copy-web-designSkill
- executing-plansSkill
- frontend-designSkill
- i18nSkill
- laravelSkill
- prototypeSkill
- reactSkill
- s13nSkill
- security-auditSkill
- summarizeSkill
- systematic-debuggingSkill
- technical-writingSkill
- ui-motionSkill
- ui-ux-reviewSkill
- unslopSkill
- upsert-codebase-docsSkill
- verification-before-completionSkill
- 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 17 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:
- Distinctive: line 71
Run real database instances in ephemeral containers using Testcontainers instead of using in-memory SQL emulators like SQLite or H2.
- Distinctive: line 75
Verify schema agreements using consumer-driven contracts with Pact instead of running live downstream services.
- Distinctive: line 83
Test components and services as black boxes:
- Very specific: line 88
Use getByTestId only as a fallback for non-semantic canvas controls or complex custom graphics.
- Distinctive: line 89
Use web-first assertions for asynchronous interfaces:
- Distinctive: line 97
Verify test execution speed, determinism, and absence of intermittent failures:
“Common” is measured: kept by at least 6 in 10 of the 17 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.
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 observing 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 while keeping unit tests restricted 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. Calling
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. Tests construct domain fixtures through fluent builders, declaring only fields required for the test scenario while running deterministically in parallel.
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 using in-memory SQL emulators like SQLite or H2.
- Mount database storage directories onto in-memory filesystems (
tmpfs) to eliminate disk write latency. - 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, and backend persistence tests execute against containerized databases on tmpfs mounts.
Step 5. Declarative assertion construction
Construct assertions evaluating 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 following the priority order of
getByRole,getByLabelText,getByPlaceholderText, andgetByText. - Use
getByTestIdonly as a fallback for non-semantic canvas controls or complex custom graphics. Avoid querying by CSS classes, HTML tags, or XPath selectors.
- Query elements following the priority order of
- Use web-first assertions for asynchronous interfaces:
- Assert using auto-waiting matchers like
expect(locator).toBeVisible()orexpect(locator).toHaveText()that poll the DOM until conditions settle. - Pair element checks with auto-waiting assertions instead of executing immediate assertions against static snapshots.
- Assert using 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:
- Domain unit tests complete within sub-millisecond durations per test case.
- Integration tests complete within sub-second durations per test case using tmpfs and connection reuse.
- Browser end-to-end journeys complete within 10 to 30 seconds per journey.
- 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.
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.

