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 2mo 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 2mo 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. 2mo ago Changed · -2 lines a1e088775226
  2. 2mo ago Changed · -6 lines 7721aac80d52
  3. 2mo ago Changed · -1 lines b682e64a6f95
  4. 3mo 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 (6 stars, last pushed 4d ago), 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

api-mocking compared with skills from other repositories

api-mocking next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
api-mockingchristopherlouet/claude-baseSkill64d agoMITA29Claude Code
agent-observability-engineertravisjneuman/.claudeSkill116todayMITA89Claude Code
ai-policy-generatortravisjneuman/.claudeSkill116todayMITA42Claude Code
customer-persona-buildertravisjneuman/.claudeSkill116todayMITA40Claude Code
hr-talenttravisjneuman/.claudeSkill116todayMITA47Claude Code
agent-mobile-release-managertravisjneuman/.claudeSkill116todayMITA83Claude Code
agent-product-analytics-specialisttravisjneuman/.claudeSkill116todayMITA86Claude Code