npx skills add https://github.com/pproenca/dot-skills --skill msw适用于 MSW v2 应用程序的全面 API 模拟指南,专为 AI 代理和 LLM 设计。包含 8 个类别共 45 条规则,按影响优先级排序,以指导自动化重构和代码生成。
在以下情况下参考这些指南:
| 优先级 | 类别 | 影响 | 前缀 |
|---|---|---|---|
| 1 | 设置与初始化 | 关键 | setup- |
| 2 | 处理器架构 | 关键 | handler- |
| 3 | 测试集成 | 高 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
test-| 4 | 响应模式 | 高 | response- |
| 5 | 请求匹配 | 中高 | match- |
| 6 | GraphQL 模拟 | 中 | graphql- |
| 7 | 高级模式 | 中 | advanced- |
| 8 | 调试与性能 | 低 | debug- |
setup-server-node-entrypoint - 为 Node.js 使用正确的入口点 (msw/node)setup-lifecycle-hooks - 在测试设置中配置服务器生命周期setup-worker-script-commit - 将 worker 脚本提交到版本控制setup-node-version - 要求 Node.js 18+ 以支持 MSW v2setup-unhandled-requests - 配置未处理请求的行为setup-typescript-config - 为 MSW v2 配置 TypeScripthandler-happy-path-first - 将正常路径处理器定义为基线handler-domain-grouping - 按领域对处理器进行分组handler-absolute-urls - 在处理器中使用绝对 URLhandler-shared-resolvers - 将共享的响应逻辑提取到解析器中handler-v2-response-syntax - 使用 MSW v2 响应语法handler-request-body-parsing - 显式解析请求体handler-resolver-argument - 正确解构解析器参数handler-reusability-environments - 跨环境共享处理器test-reset-handlers - 在每个测试后重置处理器test-avoid-request-assertions - 避免直接断言请求test-concurrent-boundary - 对并发测试使用 server.boundary()test-fake-timers-config - 配置模拟计时器以保留 queueMicrotasktest-async-utilities - 使用异步测试工具处理模拟响应test-clear-request-cache - 在测试之间清除请求库缓存test-jsdom-environment - 为 Jest 使用正确的 JSDOM 环境response-http-response-helpers - 使用 HttpResponse 静态方法response-delay-realistic - 添加真实的响应延迟response-error-simulation - 正确模拟错误响应response-one-time-handlers - 对顺序场景使用一次性处理器response-custom-headers - 正确设置响应头response-streaming - 使用 ReadableStream 模拟流式响应match-url-patterns - 正确使用 URL 路径参数match-query-params - 从请求 URL 访问查询参数match-custom-predicate - 对复杂匹配使用自定义谓词match-http-methods - 显式匹配 HTTP 方法match-handler-order - 将处理器从具体到一般排序graphql-operation-handlers - 使用操作名称进行 GraphQL 匹配graphql-error-responses - 以正确格式返回 GraphQL 错误graphql-batched-queries - 处理批处理的 GraphQL 查询graphql-variables-access - 正确访问 GraphQL 变量advanced-bypass-requests - 对透传请求使用 bypass()advanced-cookies-auth - 处理 Cookie 和身份验证advanced-dynamic-scenarios - 实现动态模拟场景advanced-vitest-browser - 为 Vitest 浏览器模式配置 MSWadvanced-file-uploads - 模拟文件上传端点debug-lifecycle-events - 使用生命周期事件进行调试debug-verify-interception - 验证请求拦截是否正常工作debug-common-issues - 了解常见的 MSW 问题及修复方法debug-request-logging - 记录请求详情以进行调试阅读各个参考文件以获取详细说明和代码示例:
orval 技能tanstack-query 技能test-vitest 或 test-tdd 技能要查看包含所有扩展规则的完整指南:AGENTS.md
每周安装次数
168
代码仓库
GitHub 星标数
85
首次出现
2026 年 1 月 22 日
安全审计
安装于
gemini-cli139
opencode138
codex137
github-copilot137
cursor127
claude-code117
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.
Reference these guidelines when:
| 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- |
setup-server-node-entrypoint - Use correct entrypoint for Node.js (msw/node)setup-lifecycle-hooks - Configure server lifecycle in test setupsetup-worker-script-commit - Commit worker script to version controlsetup-node-version - Require Node.js 18+ for MSW v2setup-unhandled-requests - Configure unhandled request behaviorsetup-typescript-config - Configure TypeScript for MSW v2handler-happy-path-first - Define happy path handlers as baselinehandler-domain-grouping - Group handlers by domainhandler-absolute-urls - Use absolute URLs in handlershandler-shared-resolvers - Extract shared response logic into resolvershandler-v2-response-syntax - Use MSW v2 response syntaxhandler-request-body-parsing - Explicitly parse request bodieshandler-resolver-argument - Destructure resolver arguments correctlyhandler-reusability-environments - Share handlers across environmentstest-reset-handlers - Reset handlers after each testtest-avoid-request-assertions - Avoid direct request assertionstest-concurrent-boundary - Use server.boundary() for concurrent teststest-fake-timers-config - Configure fake timers to preserve queueMicrotasktest-async-utilities - Use async testing utilities for mock responsestest-clear-request-cache - Clear request library caches between teststest-jsdom-environment - Use correct JSDOM environment for Jestresponse-http-response-helpers - Use HttpResponse static methodsresponse-delay-realistic - Add realistic response delaysresponse-error-simulation - Simulate error responses correctlyresponse-one-time-handlers - Use one-time handlers for sequential scenariosresponse-custom-headers - Set response headers correctlyresponse-streaming - Mock streaming responses with ReadableStreammatch-url-patterns - Use URL path parameters correctlymatch-query-params - Access query parameters from request URLmatch-custom-predicate - Use custom predicates for complex matchingmatch-http-methods - Match HTTP methods explicitlymatch-handler-order - Order handlers from specific to generalgraphql-operation-handlers - Use operation name for GraphQL matchinggraphql-error-responses - Return GraphQL errors in correct formatgraphql-batched-queries - Handle batched GraphQL queriesgraphql-variables-access - Access GraphQL variables correctlyadvanced-bypass-requests - Use bypass() for passthrough requestsadvanced-cookies-auth - Handle cookies and authenticationadvanced-dynamic-scenarios - Implement dynamic mock scenariosadvanced-vitest-browser - Configure MSW for Vitest browser modeadvanced-file-uploads - Mock file upload endpointsdebug-lifecycle-events - Use lifecycle events for debuggingdebug-verify-interception - Verify request interception is workingdebug-common-issues - Know common MSW issues and fixesdebug-request-logging - Log request details for debuggingRead individual reference files for detailed explanations and code examples:
references/{prefix}-{slug}.mdorval skilltanstack-query skilltest-vitest or test-tdd skillsFor the complete guide with all rules expanded: AGENTS.md
Weekly Installs
168
Repository
GitHub Stars
85
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
gemini-cli139
opencode138
codex137
github-copilot137
cursor127
claude-code117
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
33,600 周安装
LBO模型构建指南与Excel模板:杠杆收购建模规范、公式与最佳实践
152 周安装
人才招聘专家服务 | 招聘策略、候选人寻源、面试设计、录用管理全流程指南
152 周安装
iOS Vision框架开发指南:计算机视觉、OCR、姿态检测与Visual Intelligence集成
152 周安装
cc-skill-continuous-learning:Claude代码模板持续学习技能,提升开发效率与代码质量
152 周安装
Git提交工作流优化工具 - 遵循Conventional Commits规范,提升代码审查效率
152 周安装
测试自动化框架指南:Playwright与pytest最佳实践,提升测试效率与可维护性
152 周安装