testing-with-api-mocks — ai-security testing-with-api-mocks, toolhive-studio, community, ai-security, ide skills, continue, copilot, developer-tools, mcp-client, model-context-protocol, Claude Code

v1.0.0

このスキルについて

MSWを使用した自動APIモックによる効率的なテストが必要なAIエージェントに最適 Start here for all API mocking in tests. Covers auto-generation, fixtures, and when to use other skills. Required reading before creating, refactoring, or modifying any test involving API calls.

# Core Topics

stacklok stacklok
[116]
[13]
Updated: 3/3/2026

Killer-Skills Review

Decision support comes first. Repository text comes second.

Reference-Only Page Review Score: 7/11

This page remains useful for operators, but Killer-Skills treats it as reference material instead of a primary organic landing page.

Original recommendation layer Concrete use-case guidance Explicit limitations and caution
Review Score
7/11
Quality Score
49
Canonical Locale
en
Detected Body Locale
en

MSWを使用した自動APIモックによる効率的なテストが必要なAIエージェントに最適 Start here for all API mocking in tests. Covers auto-generation, fixtures, and when to use other skills. Required reading before creating, refactoring, or modifying any test involving API calls.

このスキルを使用する理由

MSWを使用して自動生成されたスキーマベースのモックを作成することで、MCPサーバーとToolHiveアプリケーションの開発プロセスを合理化し、APIエンドポイントの効率的なテストを可能にし、開発時間を短縮するエージェントの能力を付与

おすすめ

MSWを使用した自動APIモックによる効率的なテストが必要なAIエージェントに最適

実現可能なユースケース for testing-with-api-mocks

テスト用のAPIモックの自動化
MCPサーバーの開発プロセスの合理化
自動生成されたモックを使用してToolHiveアプリケーションの効率的なテスト

! セキュリティと制限

  • MSW(モックサービスワーカー)の設定が必要
  • 既存のスキーマを持つAPIエンドポイントのみに限定

Why this page is reference-only

  • - Current locale does not satisfy the locale-governance contract.
  • - The underlying skill quality score is below the review floor.

Source Boundary

The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.

Curated Collection Review

Reviewed In Curated Collections

This section shows how Killer-Skills has already collected, reviewed, and maintained this skill inside first-party curated paths. For operators and crawlers alike, this is a stronger signal than treating the upstream README as the primary story.

Reviewed Collection

AIエージェント開発を支える注目ツール群 | AI Agent Skills

Reviewed 2026-04-17

Reviewed on 2026-04-17 against coding workflow fit, installation clarity, review and testing value, and release guardrails. This page is now positioned as an install-first developer workflow entry point instead of a vague tooling roundup.

We prioritize this page because developer-intent users usually need one toolchain they can install, validate, and prove inside a real coding loop before they standardize it across the team.

12 entries Killer-Skills editorial review within the recovery-focused authority queue.
Reviewed Collection

開発ワークフロー向け TypeScript AI ツール集 | AI Agent Skills

Reviewed 2026-04-17

Reviewed on 2026-04-17 against TypeScript workflow fit, installation clarity, operator handoff, and day-to-day product engineering usefulness. This page is now positioned as an install-first TypeScript entry point instead of a broad language roundup.

We prioritize this page because TypeScript-intent users usually need a shortlist they can install, validate, and carry into real typed delivery loops quickly.

12 entries Killer-Skills editorial review within the recovery-focused authority queue.
Reviewed Collection

Cursor対応スキル&ワークフロー連携ツール | AI Agent Skills

Reviewed 2026-04-17

Reviewed on 2026-04-17 for setup clarity, maintainer reliability, refactor support, and handoff readiness. We kept the tools that help Cursor teams move from fast local wins to repeatable team habits.

People landing here usually already code in Cursor. What they need next is a smaller list tied to refactors, review, tests, rules sync, and handoff instead of another generic integrations page.

9 entries Killer-Skills editorial review with monthly collection checks.
After The Review

Decide The Next Action Before You Keep Reading Repository Material

Killer-Skills should not stop at opening repository instructions. It should help you decide whether to install this skill, when to cross-check against trusted collections, and when to move into workflow rollout.

Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is testing-with-api-mocks?

MSWを使用した自動APIモックによる効率的なテストが必要なAIエージェントに最適 Start here for all API mocking in tests. Covers auto-generation, fixtures, and when to use other skills. Required reading before creating, refactoring, or modifying any test involving API calls.

How do I install testing-with-api-mocks?

Run the command: npx killer-skills add stacklok/toolhive-studio. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for testing-with-api-mocks?

Key use cases include: テスト用のAPIモックの自動化, MCPサーバーの開発プロセスの合理化, 自動生成されたモックを使用してToolHiveアプリケーションの効率的なテスト.

Which IDEs are compatible with testing-with-api-mocks?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for testing-with-api-mocks?

MSW(モックサービスワーカー)の設定が必要. 既存のスキーマを持つAPIエンドポイントのみに限定.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add stacklok/toolhive-studio. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use testing-with-api-mocks immediately in the current project.

! Reference-Only Mode

This page remains useful for installation and reference, but Killer-Skills no longer treats it as a primary indexable landing page. Read the review above before relying on the upstream repository instructions.

Upstream Repository Material

The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.

Upstream Source

testing-with-api-mocks

Install testing-with-api-mocks, an AI agent skill for AI agent workflows and automation. Works with Claude Code, Cursor, and Windsurf with one-command setup.

SKILL.md
Readonly
Upstream Repository Material
The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.
Supporting Evidence

Testing with API Mocks

This is the starting point for all API mocking in tests. Read this skill first before working on any test that involves API calls.

This project uses MSW (Mock Service Worker) with auto-generated schema-based mocks. When writing tests for code that calls API endpoints, mocks are created automatically.

How It Works

  1. Run a test that triggers an API call (e.g., a component that fetches data)
  2. Mock auto-generates if no fixture exists for that endpoint
  3. Fixture saved to renderer/src/common/mocks/fixtures/<endpoint>/<method>.ts
  4. Subsequent runs use the saved fixture

No manual mock setup is required for basic tests.

Fixture Location

Fixtures are organized by endpoint path and HTTP method:

renderer/src/common/mocks/fixtures/
├── groups/
│   ├── get.ts          # GET /api/v1beta/groups
│   └── post.ts         # POST /api/v1beta/groups
├── workloads/
│   └── get.ts          # GET /api/v1beta/workloads
├── workloads_name/
│   └── get.ts          # GET /api/v1beta/workloads/:name
└── ...

Path parameters like :name become _name in the directory name.

Fixture Structure

Generated fixtures use the AutoAPIMock wrapper with types from the OpenAPI schema:

typescript
1// renderer/src/common/mocks/fixtures/groups/get.ts 2import type { 3 GetApiV1BetaGroupsResponse, 4 GetApiV1BetaGroupsData, 5} from '@common/api/generated/types.gen' 6import { AutoAPIMock } from '@mocks' 7 8export const mockedGetApiV1BetaGroups = AutoAPIMock< 9 GetApiV1BetaGroupsResponse, 10 GetApiV1BetaGroupsData 11>({ 12 groups: [ 13 { name: 'default', registered_clients: ['client-a'] }, 14 { name: 'research', registered_clients: ['client-b'] }, 15 ], 16})

The second type parameter (*Data) provides typed access to request parameters (query, path, body) for conditional overrides.

Naming Convention

Export names follow the pattern: mocked + HTTP method + endpoint path in PascalCase.

  • GET /api/v1beta/groupsmockedGetApiV1BetaGroups
  • POST /api/v1beta/workloadsmockedPostApiV1BetaWorkloads
  • GET /api/v1beta/workloads/:namemockedGetApiV1BetaWorkloadsByName

Writing a Basic Test

For most tests, just render the component and the mock handles the rest:

typescript
1import { render, screen, waitFor } from '@testing-library/react' 2 3it('displays groups from the API', async () => { 4 render(<GroupsList />) 5 6 await waitFor(() => { 7 expect(screen.getByText('default')).toBeVisible() 8 }) 9})

The auto-generated mock provides realistic fake data based on the OpenAPI schema.

Customizing Fixture Data

If the auto-generated data doesn't suit your test, edit the fixture file directly:

typescript
1// renderer/src/common/mocks/fixtures/groups/get.ts 2export const mockedGetApiV1BetaGroups = AutoAPIMock< 3 GetApiV1BetaGroupsResponse, 4 GetApiV1BetaGroupsData 5>({ 6 groups: [ 7 { name: 'production', registered_clients: ['claude-code'] }, // Custom data 8 { name: 'staging', registered_clients: [] }, 9 ], 10})

This becomes the new default for all tests using this endpoint.

Regenerating a Fixture

To regenerate a fixture with fresh schema-based data:

  1. Delete the fixture file
  2. Run a test that calls that endpoint
  3. New fixture auto-generates
bash
1rm renderer/src/common/mocks/fixtures/groups/get.ts 2pnpm test -- --run <test-file>

Key Imports

typescript
1// Types for API responses and request parameters 2import type { 3 GetApiV1BetaGroupsResponse, 4 GetApiV1BetaGroupsData, 5} from '@common/api/generated/types.gen' 6 7// AutoAPIMock wrapper 8import { AutoAPIMock } from '@mocks' 9 10// Fixture mocks (for test-scoped overrides, see: testing-api-overrides skill) 11import { mockedGetApiV1BetaGroups } from '@mocks/fixtures/groups/get'

204 No Content Endpoints

For endpoints that return 204, create a minimal AutoAPIMock fixture and override the handler in each test:

typescript
1// renderer/src/common/mocks/fixtures/health/get.ts 2import type { 3 GetHealthResponse, 4 GetHealthData, 5} from '@common/api/generated/types.gen' 6import { AutoAPIMock } from '@mocks' 7 8export const mockedGetHealth = AutoAPIMock<GetHealthResponse, GetHealthData>( 9 '' as unknown as GetHealthResponse 10)

Then in tests, use .overrideHandler() to return the appropriate response:

typescript
1import { mockedGetHealth } from '@mocks/fixtures/health/get' 2import { HttpResponse } from 'msw' 3 4it('navigates on health check success', async () => { 5 mockedGetHealth.overrideHandler(() => new HttpResponse(null, { status: 204 })) 6 // ... 7}) 8 9it('handles health check failure', async () => { 10 mockedGetHealth.overrideHandler(() => HttpResponse.error()) 11 // ... 12})

Custom Mocks (Text/Plain Endpoints)

Custom mocks are only needed for text/plain endpoints. The only current example is the logs endpoint:

typescript
1// renderer/src/common/mocks/customHandlers/index.ts 2export const customHandlers = [ 3 http.get(mswEndpoint('/api/v1beta/workloads/:name/logs'), ({ params }) => { 4 const { name } = params 5 const logs = getMockLogs(name as string) 6 return new HttpResponse(logs, { status: 200 }) 7 }), 8]

To override the logs response in tests, use the exported getMockLogs mock:

typescript
1import { getMockLogs } from '@/common/mocks/customHandlers' 2 3getMockLogs.mockReturnValueOnce('Custom log content for this test')
  • testing-api-overrides - Test-scoped overrides and conditional responses for testing filters/params
  • testing-api-assertions - Verifying API calls for mutations (create/update/delete)

関連スキル

Looking for an alternative to testing-with-api-mocks or another community skill for your workflow? Explore these related open-source skills.

すべて表示

openclaw-release-maintainer

Logo of openclaw
openclaw

Your own personal AI assistant. Any OS. Any Platform. The lobster way. 🦞

333.8k
0
AI

widget-generator

Logo of f
f

カスタマイズ可能なウィジェットプラグインをprompts.chatのフィードシステム用に生成する

149.6k
0
AI

flags

Logo of vercel
vercel

React フレームワーク

138.4k
0
ブラウザ

pr-review

Logo of pytorch
pytorch

Pythonにおけるテンソルと動的ニューラルネットワーク(強力なGPUアクセラレーション)

98.6k
0
開発者