api-mocking

api-mocking is a skill for Claude Code from christopherlouet/claude-base. It costs 29 tokens per session (524 once invoked), scanned A, original, MIT.

A guide to replacing real web services with fake API responses during development and testing. It covers tools such as MSW, nock, json-server, and Mirage JS.

In plain words
What is it for?
Use it to choose an API-mocking tool, configure browser or Node request interception, keep mocks aligned with TypeScript types, and reset them between tests.
Why use it?
It lets you test request handling without running or depending on a real backend, while reducing errors caused by stale or leaking test data.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Good fit Use it to choose an API-mocking tool, configure browser or Node request interception, keep mocks aligned with TypeScript types, and reset them between tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/christopherlouet/claude-base/api-mocking
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.

Any agent
npx skills add christopherlouet/claude-base --skill api-mocking
Clone the repo
git clone --depth 1 https://github.com/christopherlouet/claude-base

Made for: Claude Code.

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 api-mocking

README.md
[![agentmods](https://agentmods.dev/badge/skills/christopherlouet/claude-base/api-mocking/github.svg)](https://agentmods.dev/skills/christopherlouet/claude-base/api-mocking)
Your own site
<a href="https://agentmods.dev/skills/christopherlouet/claude-base/api-mocking"><img src="https://agentmods.dev/badge/skills/christopherlouet/claude-base/api-mocking/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.

agentmods 80×15 button for api-mocking

Your own site · 80×15
<a href="https://agentmods.dev/skills/christopherlouet/claude-base/api-mocking"><img src="https://agentmods.dev/badge/skills/christopherlouet/claude-base/api-mocking.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 29 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 524 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00029 $0.00524
Opus 5.5 $0.00012 $0.00210
Sonnet 5.5 $0.00006 $0.00105
Haiku 4.5 $0.00003 $0.00052

Measured 21d ago against content hash a1e088775226, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

api-mocking 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 21d 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.

.claude/skills/api-mocking/SKILL.md · 38 lines

What it actually says

API Mocking (pointer)

MSW handler API, browser/node setup, install commands and request-interception internals are canonical at vendor docs and drift on each release:

Tool selection (version-agnostic)

Need to mock HTTP for tests/dev?
├── Browser AND Node from one handler set → MSW
├── Node-only unit tests, low ceremony → nock
├── Need a stateful REST fake server (CRUD) → json-server
└── Browser-only with relational fixtures (factories) → Mirage JS

Foundation discipline (keep across releases)

  • Type-safe mocks: derive mock payloads from the same TypeScript types as the real API (e.g. shared types/api.ts). A mock that compiles against stale types is the #1 source of mock-prod divergence.
  • Reset between tests: always resetHandlers() (MSW) or cleanAll() (nock) in afterEach — leaked state across tests is a debugging tax.
  • Realistic failure modes: simulate 5xx/timeouts/auth errors, not just happy paths. The mock is only useful if it exercises the same edge cases as prod.
  • Unhandled = error: in tests use onUnhandledRequest: 'error' (MSW) so a typo'd URL fails loudly instead of silently passing.

See also

  • dev-tdd — mocks live in test setup; this skill activates from TDD work
  • qa-e2e — Playwright/Cypress tests often layer MSW for deterministic stubs
  • dev-tdd (test-infrastructure setup) — wires the global setupServer into vitest/jest config
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. 21d ago Changed · -2 lines a1e088775226
  2. 22d ago Changed · -6 lines 7721aac80d52
  3. 23d ago Changed · -1 lines b682e64a6f95
  4. 1mo ago First seen · 47 lines · 29 tokens per session scan A d09667c2d884

Subscribe to this mod's changes

api-mocking is a skill published in the GitHub repository christopherlouet/claude-base (5 stars, last pushed yesterday), licensed MIT. It adds 29 tokens to every session and 524 once invoked, about $0.0001 per session on Opus 5.5. 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-09-03.

Related

Other skills, from other repositories

accessibility-a11y

WCAG 2.2 compliance, ARIA patterns, keyboard navigation, screen readers, automated testing.

travisjneuman/.claude · 26 tokens

agent-e2e-test-specialist

Specialist subagent: Playwright, Cypress, and visual regression testing specialist. Use only when the user explicitly asks for E2E tests, browser test automation, or visual regression testing. Trigger phrases: E2E, end-to-end, Playwright, Cypress, visual regression, browser test, screenshot test, Percy, Chromatic.

travisjneuman/.claude · 76 tokens

agent-test-generator

Specialist subagent: Generates comprehensive test suites using TDD patterns. Use only when the user explicitly asks for tests, improved coverage, or test-first development.

travisjneuman/.claude · 36 tokens

mnm-test-author

Internal creation-side specialist for /make-no-mistakes. Invoked ONLY by the orchestrator's own Skill-tool call (disable-model-invocation: true) at M+ tier, in parallel with mnm-planner, immediately after freezedod.sh succeeds. Authors falsifying tests for every acceptance criterion in the frozen DoD, structurally…

momomuchu/make-no-mistakes · 113 tokens

skill-creator

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

travisjneuman/.claude · 64 tokens

make-no-mistakes

Zero-unverified-work execution harness for coding agents. Use when the user invokes /make-no-mistakes, says "make no mistakes", "don't get this wrong", "this must be correct", "prove it works", or hands over work where a wrong result is costly. Turns any task into a verified pipeline: freeze what "correct" means…

momomuchu/make-no-mistakes · 129 tokens