Msw

From pproenca/dot-skills · View interactive version

Msw is an AI agent skill from the GitHub repository pproenca/dot-skills. 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.

How to use this skill

Skill file

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:

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)

2. Handler Architecture (CRITICAL)

3. Test Integration (HIGH)

4. Response Patterns (HIGH)

5. Request Matching (MEDIUM-HIGH)

6. GraphQL Mocking (MEDIUM)

7. Advanced Patterns (MEDIUM)

8. Debugging & Performance (LOW)

How to Use

Read individual reference files for detailed explanations and code examples:

Related Skills

Full Compiled Document

For the complete guide with all rules expanded: AGENTS.md

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.