anivar

Msw Skill — Testing skill for Claude Code

Testing community

AI agent skill for MSW 2.0 — 20 rules: handler design, REST/GraphQL, test patterns.

How to install Msw Skill

This entry records only its repository, not the path inside it, so there is no exact command to give. Open anivar/msw-skill and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Msw Skill does

AI agent skill for MSW 2.0 — 20 rules: handler design, REST/GraphQL, test patterns. Works with Claude Code, Cursor, Codex, Windsurf.

Alternatives in Testing

  • Spec Kitty — Spec-Driven Development for serious software developers 1.6k ★
  • Spec Driven Develop — Spec-driven development workflow for AI coding agents: architecture-first planning, task decomposition, GitHub 975 ★
  • Spec Kit Zh — 💫 帮助你快速上手规格驱动开发的工具包💫 Toolkit to help you get started with Spec-Driven Development Works seamlessly across al 238 ★

README

MSW Skill

Created by **[Anivar Aravind](https://anivar.net)**

An AI agent skill for writing, reviewing, and debugging MSW (Mock Service Worker) v3 handlers, server setup, and test patterns with modern best practices.

The Problem

AI agents often generate outdated MSW v1 patterns — `rest.get()` instead of `http.get()`, `res(ctx.json(...))` instead of `HttpResponse.json()`, `(req, res, ctx)` instead of `({ request, params })` — and miss critical testing best practices like `server.boundary()` for concurrent tests, `onUnhandledFrame: 'error'`, and proper lifecycle hook setup. These produce code that fails to compile or silently misbehaves at runtime.

This Solution

20 rules with incorrect/correct code examples that teach agents MSW v3's actual API, handler design, server lifecycle, response construction, testing patterns, GraphQL usage, and v1-to-v2 and v2-to-v3 migration. Each rule targets a specific mistake and shows exactly how to fix it.

Install

npx skills add anivar/msw-skill -g

Or with full URL:

npx skills add https://github.com/anivar/msw-skill

Baseline

  • msw ^3.0.0
  • TypeScript/JavaScript

What's Inside

20 Rules Across 7 Categories

Priority Category Rules Impact
1 Handler Design 4 CRITICAL
2 Setup & Lifecycle 3 CRITICAL
3 Request Reading 2 HIGH
4 Response Construction 3 HIGH
5 Test Patterns 4 HIGH
6 GraphQL 2 MEDIUM
7 Utilities 2 MEDIUM

Each rule file contains:

  • Why it matters
  • Incorrect code with explanation
  • Correct code with explanation
  • Decision tables and additional context

6 Deep-Dive References

Reference Covers
handler-api.md http.* and graphql.* methods, URL predicates, path params, handler options
response-api.md HttpResponse class, all 7 static methods, cookie handling
server-api.md setupServer/setupWorker