api-mocking

api-mocking is a skill for Claude Code, Codex from christopherlouet/claude-base. It costs 29 tokens per session (560 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 CodeCodex

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 skills/christopherlouet/claude-base/api-mocking
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, Codex.

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.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.svg" alt="Measured on agentmods" 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 560 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.00029 $0.00560
Opus 5 $0.00015 $0.00280
Sonnet 5 $0.00006 $0.00112
Haiku 4.5 $0.00003 $0.00056

Measured today against content hash d09667c2d884, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 today.

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 · 47 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. today 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 today), licensed MIT. It adds 29 tokens to every session and 560 once invoked, about $0.0001 per session on Opus 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

spec-manager

Spec-driven project iteration workflow — L1 PRD → L2 Design → L3 Impl → Agent Task → Deploy, with human review gates at each layer. Pure local markdown storage, no MCP, no network. Use when the user invokes /spec-manager or asks for: new feature/PRD, technical design, implementation spec, agent task, iteration plan…

loki-ai-ch/spec-manager · 92 tokens

spec-manager

Spec-driven project iteration workflow — L1 PRD → L2 Design → L3 Impl → Agent Task → Deploy, with human review gates at each layer. Pure local markdown storage, no MCP, no network. Use when the user invokes /spec-manager or asks for: new feature/PRD, technical design, implementation spec, agent task, iteration plan…

loki-ai-ch/spec-manager · 92 tokens

zhihu-publish

Use when the task is to publish a Zhihu article from Markdown using the local browser-automation pipeline in this repo. Covers the text-only publishing chain, the multimodal chain that uploads Markdown images into the Zhihu editor, cookie-based login checks, and choosing between the stable text script and the richer…

Harzva/learn-likecc · 69 tokens

full_unpackd_rep

Use when the task is to unpack a local reference repository into a Chinese structural topic page, update site navigation, stamp dates, and leave behind a reusable deconstruction note for the repo.

Harzva/learn-likecc · 42 tokens

gen-zhihu-article

Generate Zhihu article in the style of 22-庖丁解牛专题页-知乎图文终版.md.

Harzva/learn-likecc · 32 tokens

loloop

Use when a task should advance through repeated plan-driven loop cycles for an engineering project, paper, or long-running repo change. loloop wraps the official /loop idea with the repo's loop-in-loop method: read the current plan, inspect prior evolution notes, execute the current iteration, write a new evolution…

Harzva/learn-likecc · 0 tokens