Skip to content
Back to skills

Mock External Api

ASecurity

Builds a realistic mock of an external API for your tests, shaped from recorded or documented responses.

  • 3 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 15, 2026
ai-agentsapi

Works with

  • cli
  • api

Security analysis

A100/100

Scanned November 15, 2026

npx -y skills add workspace-templates/ai-agent-templates --skill mock-external-api --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Mock External Api?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Mock External Api
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/workspace-templates-mock-external-api/badge)](https://www.skillsdirectory.com/skills/workspace-templates-mock-external-api)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: mock-external-api
description: Builds a realistic mock of an external API for your tests, shaped from recorded or documented responses.
argument-hint: "[API name and the module that calls it]"
user-invocable: true
disable-model-invocation: true
---

Create a mock of this external API for tests: $ARGUMENTS

1. Find where the code calls the API (client module, SDK wrapper, fetch calls). List the endpoints, methods and fields the app actually uses.
2. Gather real shapes from, in order: fixtures or logs already in the repo, the provider's OpenAPI file or docs, and a sample response the user pastes. Do not call the live API and do not read credentials.
3. Pick the project's mocking tool (msw, nock, responses, WireMock, httpmock, vcr, Mockito) and build handlers there. Keep the mock in one folder with one file per endpoint group.
4. Cover: a success reply, an empty result, pagination, a 4xx validation error, a 429 with Retry-After, a 5xx, and a timeout. Use realistic ids and timestamps.
5. Add a contract test that checks each fixture against the schema (zod, JSON Schema or types) so drift is caught.
6. Replace one existing slow test to prove it works, then run the suite offline.

Report files created, scenarios covered and which fields were guessed rather than documented.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.