Agent skill

Testing API Overrides

by stacklok in stacklok/toolhive-studio

Test that components send correct query parameters or request arguments.

Apache-2.0Auto-check passedAgent Workflows

Install Testing API Overrides

skills CLI
$ npx skills add stacklok/toolhive-studio --skill testing-api-overrides -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install stacklok/toolhive-studio testing-api-overrides --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/stacklok/toolhive-studio.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.codex/skills/testing-api-overrides .claude/skills/testing-api-overrides && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
testing-api-overrides
GitHub stars
170
Token cost
~1.6k tokens
SKILL.md length
319 words
Files
1
Skills in repo
9
Repo updated
First seen
Licence
Apache-2.0

At a glance

Test that components send correct query parameters or request arguments.

  • Works in 2 steps: ❌ Recording the request and checking… → ❌ Asserting on internal function calls
  • Testing filtering
  • SKILL.md covers Philosophy, When to Use Conditional…, conditionalOverride() and Example: Testing Group Filter, plus 7 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Testing API Overrides is an agent skill from stacklok/toolhive-studio. Test that components send correct query parameters or request arguments. Use when testing filtering, sorting, pagination, or any read operation where request parameters matter. Use for test-scoped mock customization.

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows, covering MCP servers. It works with Model Context Protocol. The repository describes itself as: ToolHive is an application that allows you to install, manage and run MCP servers and connect them to AI agents. The licence is Apache-2.0.

When your agent uses it

  • Testing filtering
  • Any read operation where request parameters matter
  • Test-scoped mock customization

Example prompts

  • “/testing-api-overrides”

Workflow steps

2 steps, taken from the first numbered list in SKILL.md.

  1. ❌ Recording the request and checking query params
  2. ❌ Asserting on internal function calls

What it can do on your machine

Read from SKILL.md and the folder at commit 87f7a55. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Testing API Overrides loads about 1.6k tokens when it runs. Until then it costs about 60 tokens; SKILL.md has 319 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~60
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from stacklok/toolhive-studio at commit 87f7a55, republished under its Apache-2.0 licence (© stacklok). 319 words, ~1,582 tokens.

Download SKILL.mdSave it as .claude/skills/testing-api-overrides/SKILL.md (or your agent's skills folder).
name
testing-api-overrides
description
Test that components send correct query parameters or request arguments. Use when testing filtering, sorting, pagination, or any read operation where request parameters matter. Use for test-scoped mock customization.

Testing API Overrides

Test that your code sends correct API parameters by using conditional overrides that respond differently based on the request. This approach tests actual user-facing behavior rather than inspecting internal request details.

Philosophy

Good tests verify what users see, not implementation details.

Instead of:

  1. ❌ Recording the request and checking query params
  2. ❌ Asserting on internal function calls

Do this:

  1. ✅ Set up conditional mocks that respond based on params
  2. ✅ Verify the component renders the expected data

If the code sends wrong parameters, the mock returns wrong data, the UI shows wrong content, and the test fails. This catches real bugs.

When to Use Conditional Overrides

  • Testing list filtering (e.g., filter by group, status, search term)
  • Testing pagination parameters
  • Testing sort order
  • Any read operation where request parameters affect what data is returned

Note: For mutations (create/update/delete), use recordRequests() instead. See the testing-api-assertions skill.

conditionalOverride()

Returns different data based on request properties:

typescript
import { mockedGetApiV1BetaWorkloads } from '@mocks/fixtures/workloads/get'

mockedGetApiV1BetaWorkloads.conditionalOverride(
  // Predicate: when should this override apply?
  ({ query }) => query.group === 'archive',
  // Transform: what data to return?
  (data) => ({
    ...data,
    workloads: [], // Archive group is empty
  })
)
Predicate Function

The predicate receives parsed request info with easy access to query params, path params, body, and headers:

typescript
;({ query, path, body, headers }) => {
  // Query parameters (pre-parsed)
  query.group // '?group=archive' -> 'archive'
  query.status // '?status=running' -> 'running'

  // Path parameters (from route like /workloads/:name)
  path.name // for /workloads/:name

  // Request body (for POST/PUT/DELETE)
  body?.name // parsed JSON body

  // Headers
  headers.get('Authorization')

  return true // or false
}
Transform Function

The transform receives default data and returns modified data:

typescript
;(data) => ({
  ...data, // Spread defaults
  workloads: data.workloads?.filter(
    // Modify as needed
    (w) => w.status === 'running'
  ),
})

Example: Testing Group Filter

typescript
import { mockedGetApiV1BetaWorkloads } from '@mocks/fixtures/workloads/get'

it('shows only workloads from the selected group', async () => {
  // Default mock returns workloads from multiple groups
  // Add conditional override for 'production' group
  mockedGetApiV1BetaWorkloads.conditionalOverride(
    ({ query }) => query.group === 'production',
    (data) => ({
      ...data,
      workloads: [
        { name: 'prod-server-1', group: 'production', status: 'running' },
        { name: 'prod-server-2', group: 'production', status: 'running' },
      ],
    })
  )

  render(<WorkloadsList group="production" />)

  // If component sends ?group=production, it gets the filtered data
  // If component forgets the param, it gets default data with mixed groups
  await waitFor(() => {
    expect(screen.getByText('prod-server-1')).toBeVisible()
    expect(screen.getByText('prod-server-2')).toBeVisible()
  })

  // These would appear if the filter param wasn't sent correctly
  expect(screen.queryByText('dev-server')).not.toBeInTheDocument()
})

Example: Testing Empty State

typescript
it('shows empty message when group has no workloads', async () => {
  mockedGetApiV1BetaWorkloads.conditionalOverride(
    ({ query }) => query.group === 'empty-group',
    () => ({ workloads: [] })
  )

  render(<WorkloadsList group="empty-group" />)

  await waitFor(() => {
    expect(screen.getByText(/no workloads found/i)).toBeVisible()
  })
})

Multiple Conditional Overrides

Chain multiple overrides for different conditions:

typescript
mockedGetApiV1BetaWorkloads
  .conditionalOverride(
    ({ query }) => query.group === 'production',
    () => ({ workloads: productionWorkloads })
  )
  .conditionalOverride(
    ({ query }) => query.group === 'staging',
    () => ({ workloads: stagingWorkloads })
  )

Later overrides wrap earlier ones. If no predicate matches, the default fixture data is returned.

Simple Overrides (No Condition)

For test-scoped data changes without conditions, use .override():

typescript
// Override for entire test - no condition
mockedGetApiV1BetaGroups.override(() => ({
  groups: [{ name: 'only-group', registered_clients: [] }],
}))

// Modify default data
mockedGetApiV1BetaGroups.override((data) => ({
  ...data,
  groups: data.groups?.slice(0, 1),
}))

Error Responses

Use .overrideHandler() for full control over the response:

typescript
import { HttpResponse } from 'msw'

// Return error
mockedGetApiV1BetaGroups.overrideHandler(() =>
  HttpResponse.json({ error: 'Server error' }, { status: 500 })
)

// Network failure
mockedGetApiV1BetaGroups.overrideHandler(() => HttpResponse.error())

Automatic Reset

All overrides are automatically reset before each test via resetAllAutoAPIMocks() in vitest.setup.ts. No cleanup needed.

Reusable Scenarios

When the same response override is needed across many tests, define it as a scenario in the fixture instead of duplicating .override() calls.

Defining Scenarios (in fixtures)
typescript
// In fixtures/workloads/get.ts
export const mockedGetApiV1BetaWorkloads = AutoAPIMock<...>({
  workloads: [/* default data */],
}).scenario('empty', (mock) => mock.override(() => ({ workloads: [] })))
Using Scenarios (in tests)
typescript
mockedGetApiV1BetaWorkloads.activateScenario('empty')

Scenario names are defined in renderer/src/common/mocks/scenarioNames.ts. Use existing names when possible to keep scenarios consolidated.

  • testing-with-api-mocks - Auto-generated mocks and fixture basics
  • testing-api-assertions - Verifying mutations with recordRequests() (create/update/delete only)

© stacklok, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .codex/skills/testing-api-overrides of stacklok/toolhive-studio.

Open the folder on GitHubat commit 87f7a55

Compare with similar skills

Testing API Overrides next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Testing API Overrides compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Testing API Overrides this skillstacklok/toolhive-studio170—~1.6kAutomated safety check: PassApache-2.0
MCP Server Builderanthropics/skills180k62 repos~2.3kAutomated safety check: PassApache-2.0
MCP Server BuildershareAI-lab/learn-claude-code78k5 repos~1.2kAutomated safety check: PassMIT
MCP Integration for Pluginsanthropics/claude-plugins-official37k11 repos~3.1kAutomated safety check: PassApache-2.0
Fastmcp Client CLIPrefectHQ/fastmcp28k1 repos~823Automated safety check: PassApache-2.0
Crush Configurationcharmbracelet/crush29k—~3.7kAutomated safety check: PassCustom licence

Similar skills

  • MCP Server Builder

    anthropics/skills

    Official

    Guides the design and implementation of Model Context Protocol servers in TypeScript or Python, from tool naming and error messages to evaluation.

    180k GitHub starsUsed in 62 repos~2.3k tokens
    Agent WorkflowsAuto-check passed
  • MCP Server Builder

    shareAI-lab/learn-claude-code

    Walks through building MCP servers in Python or TypeScript that expose tools, resources and prompts to Claude, with templates, registration and testing.

    78k GitHub starsUsed in 5 repos~1.2k tokens
    Agent WorkflowsAuto-check passed
  • MCP Integration for Plugins

    anthropics/claude-plugins-official

    Official

    Explains how to bundle Model Context Protocol servers in a Claude Code plugin, covering config files, stdio, SSE, HTTP and WebSocket server types, and authentication.

    37k GitHub starsUsed in 11 repos~3.1k tokens
    Agent WorkflowsAuto-check passed
  • Fastmcp Client CLI

    PrefectHQ/fastmcp

    Query and invoke tools on MCP servers using fastmcp list and fastmcp call.

    28k GitHub starsUsed in 1 repo~823 tokens
    Agent WorkflowsAuto-check passed
  • Crush Configuration

    charmbracelet/crush

    Explains how to configure the Crush coding agent with crushrc or crush.json, covering providers, models, LSPs, MCP servers, hooks, permissions and config precedence.

    29k GitHub stars~3.7k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Context Mode Output Sandbox

    mksglu/context-mode

    Routes large command, file, API and browser output through context-mode tools so only the needed result enters the agent's context, instead of dumping it via Bash.

    26k GitHub stars~4.1k tokensUpdated today
    Agent WorkflowsAuto-check passed

More from stacklok/toolhive-studio

All 9 skills in this repo
  • Deep Links

    stacklok/toolhive-studio

    Deep links in ToolHive Studio. An agent skill from stacklok/toolhive-studio.

    170 GitHub stars~1.6k tokensUpdated today
    Auto-check: notes
  • Bug Fix TDD

    stacklok/toolhive-studio

    Reproduce and fix bugs using TDD. An agent skill from stacklok/toolhive-studio.

    170 GitHub stars~1.7k tokensUpdated today
    Auto-check: notes
  • Devcontainer Dev

    stacklok/toolhive-studio

    Spin up and interact with ToolHive Studio's containerized dev environment (Xvfb + noVNC + DinD).

    170 GitHub stars~3.8k tokensUpdated today
    Auto-check: notes
  • Security Vuln Remediation

    stacklok/toolhive-studio

    Remediate security vulnerabilities found by Grype or pnpm audit.

    170 GitHub stars~2.3k tokensUpdated today
    Auto-check: notes
  • Skill Creator

    stacklok/toolhive-studio

    Create new AI agent skills for Claude Code, Codex, and Cursor.

    170 GitHub stars~677 tokensUpdated today
    Auto-check passed
  • Testing API Assertions

    stacklok/toolhive-studio

    Verify API requests in tests. An agent skill from stacklok/toolhive-studio.

    170 GitHub stars~993 tokensUpdated today
    Auto-check passed

Categories

Questions about Testing API Overrides

What does Testing API Overrides do?

Test that components send correct query parameters or request arguments. Testing API Overrides is an agent skill from stacklok/toolhive-studio. Test that components send correct query parameters or request arguments.

When should I use Testing API Overrides?

Testing API Overrides fits situations like: testing filtering; any read operation where request parameters matter; test-scoped mock customization.

How do I install Testing API Overrides in Claude Code?

Run `npx skills add stacklok/toolhive-studio --skill testing-api-overrides -a claude-code`. Or copy the skill folder (.codex/skills/testing-api-overrides in stacklok/toolhive-studio) into .claude/skills/testing-api-overrides in your project. Claude Code loads it when a task matches its description.

How do I install Testing API Overrides in Codex?

Run `npx skills add stacklok/toolhive-studio --skill testing-api-overrides -a codex`. Or copy the skill folder (.codex/skills/testing-api-overrides in stacklok/toolhive-studio) into .agents/skills/testing-api-overrides in your project. Codex loads it when a task matches its description.

Can I use Testing API Overrides in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add stacklok/toolhive-studio --skill testing-api-overrides -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/testing-api-overrides, .gemini/skills/testing-api-overrides, .github/skills/testing-api-overrides and .opencode/skills/testing-api-overrides in your project.

What does Testing API Overrides need to run?

SKILL.md names no scripts, command-line tools or credentials: Testing API Overrides is instructions for the agent only.

Does Testing API Overrides access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Testing API Overrides safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Testing API Overrides use?

Testing API Overrides is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Testing API Overrides use?

About 1.6k tokens (SKILL.md is roughly 6.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Testing API Overrides?

Skills that share tags, products or a category with Testing API Overrides: MCP Server Builder (anthropics/skills, 180k stars), MCP Server Builder (shareAI-lab/learn-claude-code, 78k stars), MCP Integration for Plugins (anthropics/claude-plugins-official, 37k stars) and Fastmcp Client CLI (PrefectHQ/fastmcp, 28k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Testing API Overrides?

stacklok (a GitHub organization) maintains it in stacklok/toolhive-studio, which has 170 GitHub stars. The repository holds 9 skills in this directory. The repository was last updated on October 7, 2026.

Source: stacklok/toolhive-studio on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.