Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add Cratis/AI --skill mswgit clone --depth 1 https://github.com/Cratis/AIWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/cratis/ai/msw)<a href="https://agentmods.dev/skills/cratis/ai/msw"><img src="https://agentmods.dev/badge/skills/cratis/ai/msw/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/cratis/ai/msw"><img src="https://agentmods.dev/badge/skills/cratis/ai/msw.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00038 | $0.01225 |
| Opus 5.5 | $0.00015 | $0.00490 |
| Sonnet 5.5 | $0.00008 | $0.00245 |
| Haiku 4.5 | $0.00004 | $0.00122 |
Grade A, and why
msw scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
This is a copy
100% identical to msw — 2 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 121 lines — stays where its author put it; the contents beside it link to each section on GitHub.
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 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 v2
2. Handler Architecture (CRITICAL)
handler-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 environments
What ships with it
50 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- AGENTS.md 9.5 KB
- assets/templates/_template.md 594 B
- metadata.json 803 B
- README.md 4.5 KB
- references/_sections.md 1.9 KB
- references/advanced-bypass-requests.md 2.2 KB
- references/advanced-cookies-auth.md 2.7 KB
- references/advanced-dynamic-scenarios.md 2.8 KB
- references/advanced-file-uploads.md 2.7 KB
- references/advanced-vitest-browser.md 2.3 KB
- references/debug-common-issues.md 2.0 KB
- references/debug-lifecycle-events.md 2.4 KB
- references/debug-request-logging.md 3.0 KB
- references/debug-verify-interception.md 2.5 KB
- references/graphql-batched-queries.md 2.5 KB
- references/graphql-error-responses.md 2.7 KB
- references/graphql-operation-handlers.md 2.3 KB
- references/graphql-variables-access.md 2.9 KB
- references/handler-absolute-urls.md 1.8 KB
- references/handler-domain-grouping.md 2.3 KB
- references/handler-happy-path-first.md 1.9 KB
- references/handler-request-body-parsing.md 2.0 KB
- references/handler-resolver-argument.md 2.2 KB
- references/handler-reusability-environments.md 2.2 KB
- references/handler-shared-resolvers.md 2.6 KB
- references/handler-v2-response-syntax.md 2.0 KB
- references/match-custom-predicate.md 2.4 KB
- references/match-handler-order.md 2.4 KB
- references/match-http-methods.md 2.6 KB
- references/match-query-params.md 2.4 KB
- references/match-url-patterns.md 2.1 KB
- references/response-custom-headers.md 2.8 KB
- references/response-delay-realistic.md 2.5 KB
- references/response-error-simulation.md 2.5 KB
- references/response-http-response-helpers.md 2.2 KB
- references/response-one-time-handlers.md 2.7 KB
- references/response-streaming.md 2.9 KB
- references/setup-lifecycle-hooks.md 1.6 KB
- references/setup-node-version.md 1.3 KB
- references/setup-server-node-entrypoint.md 1.2 KB
- references/setup-typescript-config.md 1.7 KB
- references/setup-unhandled-requests.md 1.9 KB
- references/setup-worker-script-commit.md 1.5 KB
- references/test-async-utilities.md 2.3 KB
- references/test-avoid-request-assertions.md 2.5 KB
- references/test-clear-request-cache.md 2.2 KB
- references/test-concurrent-boundary.md 2.4 KB
- references/test-fake-timers-config.md 2.1 KB
- references/test-jsdom-environment.md 1.8 KB
- references/test-reset-handlers.md 1.8 KB
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- today Changed · -28 tokens per session 09335c1ac1b6
- 1mo ago First seen · 121 lines · 66 tokens per session scan A 99cdfcdcfc68
msw is a skill published in the GitHub repository Cratis/AI (4 stars, last pushed yesterday), licensed MIT. It adds 38 tokens to every session and 1,225 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 100% identical to msw, differing in 2 lines, and is treated as a copy.
Other skills, from other repositories
Event Sourcing Testing
Testing event sourcing patterns including event store validation, projection testing, saga orchestration, and event versioning compatibility.
local-ai-agents
Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…
systematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.
next-cache-components-adoption
Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…
chat-pet-sprite-creation
Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.
cpu-profile-analysis
Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…