Creator · pproenca
Last updated · Sep 6, 2026
MSW (Mock Service Worker) best practices for API mocking in tests (formerly test-msw). This skill should be used when setting up MSW, writing request handlers, or mocking HTTP APIs. This skill does NOT cover general testing patterns (use test-vitest or test-tdd skills) or test me
Sandbox only
Install targets
Codex install prompt
Install the "msw" agent skill from https://github.com/pproenca/dot-skills/tree/master/skills/.curated/msw. Read its SKILL.md or equivalent instructions first, install only the files needed for this workspace, and summarize any required setup before using it. Skill purpose: MSW (Mock Service Worker) best practices for API mocking in tests (formerly test-msw). This skill should be used when setting up MSW, writing request handlers, or mocking HTTP APIs. This skill does NOT cover general testing patterns (use test-vitest or test-tdd skills) or test methodology. After the install attempt, report the result to https://www.openagentskill.com/api/agent/outcome with POST JSON {"event_id":"install_<unique-id>","skill_slug":"pproenca-msw","task":"Install msw","agent":"codex","outcome":"success","install_used":true}. Replace event_id with a unique value and outcome with success or failed. Report success only after the skill is installed and a minimal verification passes.Supply asset profile
Code review, repo analysis, testing, CI, GitHub, DevOps, and developer workflow skills.
Scenario
Testing and QA
I need my agent to test a web app, reproduce bugs, and verify fixes.
Agent fit
Claude Code + Browser agents + CLI
Codex, Claude Code, Cursor, CLI, or custom agents.
Install
Ready
npx skills add pproenca/dot-skills --skill msw
Maintenance
fresh
23d since push
Risk
Safe to try
Quality score needs review
GitHub quality
202
70/100 Quality · 79/100 Trust
Coverage tags
Review notes
Quality score needs review · Stars/forks activity: 202 stars, 17 forks; issue activity unavailable in current metadata
Agent adoption scorecard
These scores combine public repository metadata, OpenAgentSkill review signals, maintenance freshness, and install readiness. They are a shortlist signal, not a replacement for human review.
Quality
StrongSolid option that is likely worth shortlisting for production workflows.
Trust
Sandbox onlyUseful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
Audit
Safe to tryA machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
OpenAgentSkill Trust Score v5
Run only in a sandbox and compare close alternatives before using it for real work.
Stars
202 GitHub stars
Repo activity
202 stars, 17 forks
Maintenance
23d since push
License
MIT
Install
npx skills add pproenca/dot-skills --skill msw
Install safety
Agent-readable metadata
Use this block or the embedded JSON to decide whether an agent should install this skill, choose an alternative, or ask for human review first.
Suited tasks
Suited agents
Install decision
Trust and risk
Outcome loop
Install command
npx skills add pproenca/dot-skills --skill mswDo not use when
Alternative
168.6K Stars
npx skills add mattpocock/skills --skill code-review
Alternative
40.8K Stars
npx skills add appsmithorg/appsmith
Alternative
175.7K Stars
npx skills add mattpocock/skills --skill implement
Alternative
30.9K Stars
npx skills add vercel-labs/agent-skills --skill vercel-react-best-practices
Agent safety v2
Sparse or mixed signals. Useful for discovery, but not for autonomous installation.
Test manually in an isolated workspace and compare against safer alternatives.
medium
Skill may drive a browser or interact with web pages.
medium
Skill likely fetches remote pages, APIs, repositories, or external services.
medium
Skill may read or write project files, documents, generated artifacts, or local workspace state.
high
Skill metadata references credentials, tokens, environment variables, or secret-bearing workflows.
Agent resolve plan
The Resolve API returns the selected skill, alternatives, safety policy, audit notes, install target, and copy-paste prompt an agent can follow without scraping this page.
Open JSON
/api/agent/resolve?task=Use%20msw%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Resolve text
/api/agent/resolve?task=Use%20msw%20for%20an%20agent%20workflow&agent=codex&max_risk=medium&format=text
Install handoff
/api/skills/pproenca-msw/install
Agent should check
Copy prompt
Task: Use msw in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20msw%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/pproenca-msw/install
Install command: npx skills add pproenca/dot-skills --skill msw
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.Agent handoff
Use the public install endpoint to fetch the command, safety checklist, target prompts, and canonical links for this skill.
Install handoff
/api/skills/pproenca-msw/install
LLM text format
/api/skills/pproenca-msw/install?format=text
Find alternatives
/api/skills/search?q=msw&limit=3
Agent prompt
Use msw for this task. Review https://www.openagentskill.com/api/skills/pproenca-msw/install, then install with: npx skills add pproenca/dot-skills --skill mswRegistry metadata
This page exposes the same decision, trust, audit, use-case, and install signals through the Registry API, so agents can rank this skill without scraping the UI.
Manifest
/api/registry/manifest/pproenca-msw
LLM text
/api/registry/manifest/pproenca-msw?format=text
Install alias
/api/registry/install/pproenca-msw
Recommend
/api/registry/recommend?task=Use%20msw%20in%20an%20agent%20workflow&limit=3
Agent fit
Testing and QA
Use-case tags
Platforms
Claude Code, Browser agents
Audit report
A machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
Agent decision cockpit
Prototype with this skill first; keep a fallback candidate ready.
Role in stack
Fallback candidate
Primary fit
Testing and QA
Trust label
Prototype first
Install path
Command ready
Use when
Evidence
review first
Implementation path
Trust profile
Useful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
GitHub adoption
INFO202 GitHub stars
Stars/forks activity
CHECK202 stars, 17 forks; issue activity unavailable in current metadata
Recent maintenance
PASS23d since push
License clarity
PASSMIT
Good signals
Review before install
Recommended action
Run only in a sandbox and compare close alternatives before using it for real work.
Quality profile
Solid option that is likely worth shortlisting for production workflows.
Workflow fit
Verify behavior
I need my agent to test a web app, reproduce bugs, and verify fixes.
Build and ship code
I need a coding agent that can understand a repository, edit code, and review pull requests.
Operate web apps
I need my agent to control a browser, fill forms, and verify web app workflows.
Workflow fit
Operate and verify web apps
A workflow for agents that navigate products, fill forms, take screenshots, and verify real user flows across web applications.
Inspect, patch, and verify code
A workflow for software agents that inspect repositories, review pull requests, generate tests, and turn findings into shippable patches.
Design, build, test, and ship interfaces
A practical workflow for agents that turn product briefs or Figma designs into polished frontend code, review the result, test it in a browser, and prepare a safe deployment.
Alternative shortlist
Similar skills that may fit this task.
Review a branch or diff against repository standards and the originating spec in two independent analysis passes.
Platform to build admin panels, internal tools, and dashboards. Integrates with 25+ databases and any API.
Implement work from an approved spec or ticket set, run focused and full tests, invoke code review, and commit the result to the current branch.
React and Next.js performance guidance for writing, reviewing, and refactoring production UI code.
--- name: msw description: MSW (Mock Service Worker) best practices for API mocking in tests (formerly test-msw). This skill should be used when setting up MSW, writing request handlers, or mocking HTTP APIs. This skill does NOT cover general testing patterns (use test-vitest or test-tdd skills) or test methodology. ---
# MSW Best Practices
Comprehensive API mocking guide for MSW v2 applications, designed for AI agents and LLMs. Contains 45 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.
## When to Apply
Reference these guidelines when: - Setting up MSW for testing or development - Writing or organizing request handlers - Configuring test environments with MSW - Mocking REST or GraphQL APIs - Debugging handler matching issues - Testing error states and edge cases
## Rule Categories by Priority
| Priority | Category | Impact | Prefix | |----------|----------|--------|--------| | 1 | Setup & Initialization | CRITICAL | `setup-` | | 2 | Handler Architecture | CRITICAL | `handler-` | | 3 | Test Integration | HIGH | `test-` | | 4 | Response Patterns | HIGH | `response-` | | 5 | Request Matching | MEDIUM-HIGH | `match-` | | 6 | GraphQL Mocking | MEDIUM | `graphql-` | | 7 | Advanced Patterns | MEDIUM | `advanced-` | | 8 | Debugging & Performance | LOW | `debug-` |
## Quick Reference
### 1. Setup & Initialization (CRITICAL)
- `setup-server-node-entrypoint` - Use correct entrypoint for Node.js (msw/node) - `setup-lifecycle-hooks` - Configure server lifecycle in test setup - `setup-worker-script-commit` - Commit worker script to version control - `setup-node-version` - Require Node.js 18+ for MSW v2 - `setup-unhandled-requests` - Configure unhandled request behavior - `setup-typescript-config` - Configure TypeScript for MSW v2
### 2. Handler Architecture (CRITICAL)
- `handler-happy-path-first` - Define happy path handlers as baseline - `handler-domain-grouping` - Group handlers by domain - `handler-absolute-urls` - Use absolute URLs in handlers - `handler-shared-resolvers` - Extract shared response logic into resolvers - `handler-v2-response-syntax` - Use MSW v2 response syntax - `handler-request-body-parsing` - Explicitly parse request bodies - `handler-resolver-argument` - Destructure resolver arguments correctly - `handler-reusability-environments` - Share handlers across environments
### 3. Test Integration (HIGH)
- `test-reset-handlers` - Reset handlers after each test - `test-avoid-request-assertions` - Avoid direct request assertions - `test-concurrent-boundary` - Use server.boundary() for concurrent tests - `test-fake-timers-config` - Configure fake timers to preserve queueMicrotask - `test-async-utilities` - Use async testing utilities for mock responses - `test-clear-request-cache` - Clear request library caches between tests - `test-jsdom-environment` - Use correct JSDOM environment for Jest
### 4. Response Patterns (HIGH)
- `response-http-response-helpers` - Use HttpResponse static methods - `response-delay-realistic` - Add realistic response delays - `response-error-simulation` - Simulate error responses correctly - `response-one-time-handlers` - Use one-time handlers for sequential scenarios - `response-custom-headers` - Set response headers correctly - `response-streaming` - Mock streaming responses with ReadableStream
### 5. Request Matching (MEDIUM-HIGH)
- `match-url-patterns` - Use URL path parameters correctly - `match-query-params` - Access query parameters from request URL - `match-custom-predicate` - Use custom predicates for complex matching - `match-http-methods` - Match HTTP methods explicitly - `match-handler-order` - Order handlers from specific to general
### 6. GraphQL Mocking (MEDIUM)
- `graphql-operation-handlers` - Use operation name for GraphQL matching - `graphql-error-responses` - Return GraphQL errors in correct format - `graphql-batched-queries` - Handle batched GraphQL queries - `graphql-variables-access` - Access GraphQL variables correctly
### 7. Advanced Patterns (MEDIUM)
- `advanced-bypass-requests` - Use bypass() for passthrough requests - `advanced-cookies-auth` - Handle cookies and authentication - `advanced-dynamic-scenarios` - Implement dynamic mock scenarios - `advanced-vitest-browser` - Configure MSW for Vitest browser mode - `advanced-file-uploads` - Mock file upload endpoints
### 8. Debugging & Performance (LOW)
- `debug-lifecycle-events` - Use lifecycle events for debugging - `debug-verify-interception` - Verify request interception is working - `debug-common-issues` - Know common MSW issues and fixes - `debug-request-logging` - Log request details for debugging
## How to Use
Read individual reference files for detailed explanations and code examples:
- [Section definitions](references/_sections.md) - Category structure and impact levels - [Rule template](assets/templates/_template.md) - Template for adding new rules - Individual rules: `references/{prefix}-{slug}.md`
## Related Skills
- For generating MSW mocks from OpenAPI, see `orval` skill - For consuming mocked APIs, see `tanstack-query` skill - For test methodology, see `test-vitest` or `test-tdd` skills
## Full Compiled Document
For the complete guide with all rules expanded: `AGENTS.md`
Source provenance
Decision snapshot
recent repository activity
Audit
Install and adoption review
Agent-proven evidence
Outcome reports after resolve, review, install, and one narrow run.
No agent outcome data yet. The first agent run can report success, setup needs, risk blocks, failure, or not-relevant through /api/agent/outcome.
Install
Free and open source. Review the report before installing into production agents.
Growth loop
Scenario-led draft for msw, ready for a manual X post.
A practical pick for the next repo task: msw: MSW (Mock Service Worker) best practices for API mocking in tests (formerly test-msw). This skill should be used when setti... 202 stars https://www.openagentskill.com/skills/pproenca-msw?ref=x
Listing + install path for msw: https://www.openagentskill.com/skills/pproenca-msw?ref=x Install: npx skills add pproenca/dot-skills --skill msw
Listing source
This listing was indexed from public sources and is not marked official until a maintainer claim is approved.
Attribution links to the public repository or creator profile. Creators can claim the listing to update ownership signals.
Claim this skillOwner claim
This Registry indexed listing is attributed to pproenca but is not marked official yet. Claim it to add a verified owner signal and make future launch, install, and audit updates easier to trust.
Creator backlink kit
Show the canonical listing, current trust and audit signals, and real Agent-Proven evidence where developers evaluate the repository.
[](https://www.openagentskill.com/skills/pproenca-msw?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/pproenca-msw?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/pproenca-msw/audit)
[](https://www.openagentskill.com/skills/pproenca-msw?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)pproenca
@pproenca
Share whether this skill looks useful for your agent workflow. Aggregated feedback improves rankings over time.
Sandbox only
Code Review
Review a branch or diff against repository standards and the originating spec in two independent analysis passes.
168.6K StarsAppsmith
Platform to build admin panels, internal tools, and dashboards. Integrates with 25+ databases and any API.
40.8K StarsImplement
Implement work from an approved spec or ticket set, run focused and full tests, invoke code review, and commit the result to the current branch.
175.7K StarsVercel React Best Practices
React and Next.js performance guidance for writing, reviewing, and refactoring production UI code.
30.9K StarsPermission surface
filesystem or document access, network or browser access
Agent outcomes
No agent outcome data yet
Docs
Strong README/SKILL.md context
Risk summary
Install readiness