lead-engineer-msw-mock

lead-engineer-msw-mock is an agent for Claude Code from ByeongminLee/nextjs-claude-code. It costs 0 tokens per session (562 once invoked), scanned A, original, MIT.

A lead-engineer guide for creating Mock Service Worker (MSW) setup and request-handler files. MSW lets tests and development code answer fake network requests without a real backend.

In plain words
What is it for?
Use it when a task needs files in a mocks/ directory, including server and browser setup or handlers for a feature's API requests.
Why use it?
It gives projects a consistent place for mock server, browser, and feature-specific request setup, while avoiding duplicate one-time setup.

Agent for Claude Code

Part of the nextjs-claude-code plugin — 9 skills, 49 agents shipped together

Install

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.

agentmods
npx agentmods add agents/byeongminlee/nextjs-claude-code/lead-engineer-msw-mock
Clone the repo
git clone --depth 1 https://github.com/ByeongminLee/nextjs-claude-code

Made for: Claude Code.

Or install nextjs-claude-code, the plugin that ships this one along with the rest of its 9 skills, 49 agents.

Wrote 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.

agentmods badge for lead-engineer-msw-mock

README.md
[![agentmods](https://agentmods.dev/badge/agents/byeongminlee/nextjs-claude-code/lead-engineer-msw-mock.svg)](https://agentmods.dev/agents/byeongminlee/nextjs-claude-code/lead-engineer-msw-mock)
Your own site
<a href="https://agentmods.dev/agents/byeongminlee/nextjs-claude-code/lead-engineer-msw-mock"><img src="https://agentmods.dev/badge/agents/byeongminlee/nextjs-claude-code/lead-engineer-msw-mock.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 562 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00562
Opus 5 $0.00000 $0.00281
Sonnet 5 $0.00000 $0.00112
Haiku 4.5 $0.00000 $0.00056

Measured 3d ago against content hash 6f04f447043b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

lead-engineer-msw-mock 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 3d ago.

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.

template/.claude/agents/lead-engineer-msw-mock.md · 79 lines

How it starts

The opening of the file, as written. The whole thing — 79 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Lead Engineer — MSW Mock Generation

Read when a task targets mocks/ files (mock setup or mock handler in PLAN.md).

Mock Setup (one-time, Layer 0)

Only create if mocks/ directory does not exist. Generate these files:

mocks/server.ts:

import { setupServer } from "msw/node";
import { handlers } from "./handlers";
export const server = setupServer(...handlers);

mocks/browser.ts:

import { setupWorker } from "msw/browser";
import { handlers } from "./handlers";
export const worker = setupWorker(...handlers);

mocks/index.ts:

export async function initMocks() {
  if (process.env.NEXT_PUBLIC_API_MOCKING !== "enabled") return;
  if (typeof window === "undefined") {
    const { server } = await import("./server");
    server.listen({ onUnhandledRequest: "bypass" });
  } else {
    const { worker } = await import("./browser");
    await worker.start({ onUnhandledRequest: "bypass" });
  }
}

mocks/handlers/index.ts:

export const handlers = [
  // Feature handlers will be spread here
];

After creating, check if msw is in package.json. If not: npm install msw --save-dev

Mock Handlers (per feature, Layer 2.5)

Read ## API Contracts from spec/feature/[name]/spec.md. For each endpoint:

mocks/fixtures/[feature].ts — Type-safe mock data:

  • Success, error, and edge-case fixtures from API Contract response shapes
  • Realistic but deterministic values (no Math.random)

mocks/handlers/[feature].ts — MSW request handlers:

  • Import http and HttpResponse from msw
  • One handler per endpoint
  • Default to success; include commented error variants

Update mocks/handlers/index.ts to import and spread new handlers.

Mock toggle in Next.js

App Router — add to app/layout.tsx or app/providers.tsx:

import { initMocks } from "@/mocks";

Pages Router — add to pages/_app.tsx:

import { initMocks } from "@/mocks";

Read the full file on GitHub · 79 lines

Changes

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.

  1. 3d ago First seen · 79 lines · 0 tokens per session scan A 6f04f447043b

Subscribe to this mod's changes

lead-engineer-msw-mock is an agent published in the GitHub repository ByeongminLee/nextjs-claude-code (3 stars, last pushed 5mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 562 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other agents, from other repositories

stitch-kit

Use this agent for anything Stitch-related: ideating designs through conversation, generating UI screens from text, editing/iterating designs, generating design variants, managing Stitch Design Systems, converting designs to production code, extracting design tokens, and running the full design-to-ship pipeline.…

gabelul/stitch-kit · 237 tokens

fe-a11y-auditor

Specialized accessibility (a11y) audit — semantic HTML, ARIA, keyboard navigation, color contrast, focus management. More precise than fe-reviewer's a11y axis. READ-ONLY. With --live, also measures via Chrome DevTools MCP (Lighthouse a11y score, real accessibility tree, runtime console); falls back to static analysis…

sh5623/fe-rail · 85 tokens

fe-perf-auditor

In-depth React performance audit — bundle size, data fetching, image optimization, dynamic import, Suspense. Supports both Next.js (RSC, next/image) and Vite SPA (bundle analysis, fetchpriority). More precise than fe-reviewer's performance axis. READ-ONLY. With --live, also measures via Chrome DevTools MCP…

sh5623/fe-rail · 92 tokens

fe-git-operator

Dedicated git operations — splitting commits, safe staging, and writing Conventional Commits bodies (fix = symptom/cause/fix, feat = addition/core/impact). fe-pr-author owns PRs; this agent owns commits. Destructive commands forbidden.

sh5623/fe-rail · 55 tokens

fe-reviewer

4-axis frontend code review — type safety, performance, a11y, code quality. READ-ONLY, no direct edits. Delegate after fe-build completes, before the PR stage.

sh5623/fe-rail · 41 tokens

fe-vision

Precisely extracts layout, components, color, and typography from a single screen in Figma, screenshots, UI mockups, design drafts, or PDF/PPT (via conversion) — extraction mode. Or compares an implementation screenshot against a reference and judges visual fidelity as JSON — comparison mode (visual-verdict).…

sh5623/fe-rail · 90 tokens