[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FEDPWB8REXB0M48DVT8YMD":3,"skill-same:01M6FEDPWB8REXB0M48DVT8YMD":45},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":25,"repositoryHtmlUrl":26,"repositoryHomepageUrl":27,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":29,"updatedAt":30,"install":31,"resources":44},"01M6FEDPWB8REXB0M48DVT8YMD","msw",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",66,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fpproenca\u002Fdot-skills\u002Fmsw\u002FSKILL.md",[],[5],"2026-11-10 10:12:30",false,"# MSW Best Practices\n\nComprehensive 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.\n\n## When to Apply\n\nReference these guidelines when:\n- Setting up MSW for testing or development\n- Writing or organizing request handlers\n- Configuring test environments with MSW\n- Mocking REST or GraphQL APIs\n- Debugging handler matching issues\n- Testing error states and edge cases\n\n## Rule Categories by Priority\n\n| Priority | Category | Impact | Prefix |\n|----------|----------|--------|--------|\n| 1 | Setup & Initialization | CRITICAL | `setup-` |\n| 2 | Handler Architecture | CRITICAL | `handler-` |\n| 3 | Test Integration | HIGH | `test-` |\n| 4 | Response Patterns | HIGH | `response-` |\n| 5 | Request Matching | MEDIUM-HIGH | `match-` |\n| 6 | GraphQL Mocking | MEDIUM | `graphql-` |\n| 7 | Advanced Patterns | MEDIUM | `advanced-` |\n| 8 | Debugging & Performance | LOW | `debug-` |\n\n## Quick Reference\n\n### 1. Setup & Initialization (CRITICAL)\n\n- `setup-server-node-entrypoint` - Use correct entrypoint for Node.js (msw\u002Fnode)\n- `setup-lifecycle-hooks` - Configure server lifecycle in test setup\n- `setup-worker-script-commit` - Commit worker script to version control\n- `setup-node-version` - Require Node.js 18+ for MSW v2\n- `setup-unhandled-requests` - Configure unhandled request behavior\n- `setup-typescript-config` - Configure TypeScript for MSW v2\n\n### 2. Handler Architecture (CRITICAL)\n\n- `handler-happy-path-first` - Define happy path handlers as baseline\n- `handler-domain-grouping` - Group handlers by domain\n- `handler-absolute-urls` - Use absolute URLs in handlers\n- `handler-shared-resolvers` - Extract shared response logic into resolvers\n- `handler-v2-response-syntax` - Use MSW v2 response syntax\n- `handler-request-body-parsing` - Explicitly parse request bodies\n- `handler-resolver-argument` - Destructure resolver arguments correctly\n- `handler-reusability-environments` - Share handlers across environments\n\n### 3. Test Integration (HIGH)\n\n- `test-reset-handlers` - Reset handlers after each test\n- `test-avoid-request-assertions` - Avoid direct request assertions\n- `test-concurrent-boundary` - Use server.boundary() for concurrent tests\n- `test-fake-timers-config` - Configure fake timers to preserve queueMicrotask\n- `test-async-utilities` - Use async testing utilities for mock responses\n- `test-clear-request-cache` - Clear request library caches between tests\n- `test-jsdom-environment` - Use correct JSDOM environment for Jest\n\n### 4. Response Patterns (HIGH)\n\n- `response-http-response-helpers` - Use HttpResponse static methods\n- `response-delay-realistic` - Add realistic response delays\n- `response-error-simulation` - Simulate error responses correctly\n- `response-one-time-handlers` - Use one-time handlers for sequential scenarios\n- `response-custom-headers` - Set response headers correctly\n- `response-streaming` - Mock streaming responses with ReadableStream\n\n### 5. Request Matching (MEDIUM-HIGH)\n\n- `match-url-patterns` - Use URL path parameters correctly\n- `match-query-params` - Access query parameters from request URL\n- `match-custom-predicate` - Use custom predicates for complex matching\n- `match-http-methods` - Match HTTP methods explicitly\n- `match-handler-order` - Order handlers from specific to general\n\n### 6. GraphQL Mocking (MEDIUM)\n\n- `graphql-operation-handlers` - Use operation name for GraphQL matching\n- `graphql-error-responses` - Return GraphQL errors in correct format\n- `graphql-batched-queries` - Handle batched GraphQL queries\n- `graphql-variables-access` - Access GraphQL variables correctly\n\n### 7. Advanced Patterns (MEDIUM)\n\n- `advanced-bypass-requests` - Use bypass() for passthrough requests\n- `advanced-cookies-auth` - Handle cookies and authentication\n- `advanced-dynamic-scenarios` - Implement dynamic mock scenarios\n- `advanced-vitest-browser` - Configure MSW for Vitest browser mode\n- `advanced-file-uploads` - Mock file upload endpoints\n\n### 8. Debugging & Performance (LOW)\n\n- `debug-lifecycle-events` - Use lifecycle events for debugging\n- `debug-verify-interception` - Verify request interception is working\n- `debug-common-issues` - Know common MSW issues and fixes\n- `debug-request-logging` - Log request details for debugging\n\n## How to Use\n\nRead individual reference files for detailed explanations and code examples:\n\n- [Section definitions](references\u002F_sections.md) - Category structure and impact levels\n- [Rule template](assets\u002Ftemplates\u002F_template.md) - Template for adding new rules\n- Individual rules: `references\u002F{prefix}-{slug}.md`\n\n## Related Skills\n\n- For generating MSW mocks from OpenAPI, see `orval` skill\n- For consuming mocked APIs, see `tanstack-query` skill\n- For test methodology, see `test-vitest` or `test-tdd` skills\n\n## Full Compiled Document\n\nFor the complete guide with all rules expanded: `AGENTS.md`\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Fpproenca\u002Fdot-skills\u002Fmsw",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill msw",{"tool":37,"command":38},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill msw",{"tool":40,"command":41},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill msw","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fpproenca\u002Fdot-skills\u002Fmsw\u002FSKILL.md",true,[],[46,60,70,79,85,92],{"skillNo":47,"name":48,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":56,"publishedAt":18},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[51],{"categoryNo":52,"categoryName":53,"taxonomyType":54,"taxonomyTypeDesc":55},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[57,58,59],"model","model hierarchy","model hierarchy skill",{"skillNo":61,"name":62,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":66,"publishedAt":18},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[65],{"categoryNo":52,"categoryName":53,"taxonomyType":54,"taxonomyTypeDesc":55},[67,68,69],"MCP","zoom","zoom mcp",{"skillNo":71,"name":72,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":18},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[76,77,78,68],"sdk","zoom apps sdk","apps",{"skillNo":80,"name":81,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":18},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[81],{"skillNo":86,"name":87,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":91,"publishedAt":18},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[90],{"categoryNo":52,"categoryName":53,"taxonomyType":54,"taxonomyTypeDesc":55},[87],{"skillNo":93,"name":94,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":18},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[94]]