Agent skill

Testing API Assertions

by stacklok in stacklok/toolhive-studio

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

Apache-2.0Auto-check passedAgent Workflows

Install Testing API Assertions

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

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

GitHub CLI
$ gh skill install stacklok/toolhive-studio testing-api-assertions --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-assertions .claude/skills/testing-api-assertions && 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-assertions
GitHub stars
170
Token cost
~993 tokens
SKILL.md length
218 words
Files
1
Skills in repo
9
Repo updated
First seen
Licence
Apache-2.0

At a glance

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

  • Testing that correct API calls are made for create
  • SKILL.md covers When to Use Request Assertions, recordRequests(), Recorded Request Shape and Common Patterns, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Delete operations

What it does

Testing API Assertions is an agent skill from stacklok/toolhive-studio. Verify API requests in tests. Use when testing that correct API calls are made for create, update, or delete operations. Use when testing mutations, form submissions, or actions with backend side effects.

Its SKILL.md is about 990 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 that correct API calls are made for create
  • Delete operations
  • Testing mutations
  • Form submissions

Example prompts

  • “/testing-api-assertions”

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 Assertions loads about 993 tokens when it runs. Until then it costs about 57 tokens; SKILL.md has 218 words of instructions outside code blocks.

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

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). 218 words, ~993 tokens.

Download SKILL.mdSave it as .claude/skills/testing-api-assertions/SKILL.md (or your agent's skills folder).
name
testing-api-assertions
description
Verify API requests in tests. Use when testing that correct API calls are made for create, update, or delete operations. Use when testing mutations, form submissions, or actions with backend side effects.

Testing API Assertions

Verify that your code sends the correct API requests for operations with side effects.

When to Use Request Assertions

DO use for operations with side effects:

  • Creating resources (POST)
  • Updating resources (PUT/PATCH)
  • Deleting resources (DELETE)
  • Any mutation that changes backend state

DON'T use for read operations:

  • Fetching data (GET)
  • For these, just verify the component displays the data correctly
  • The mock API is not stateful, so verifying GET requests adds no value

recordRequests()

Use recordRequests() to capture all API requests made during a test:

typescript
import { recordRequests } from '@/common/mocks/node'

it('creates a group with correct payload', async () => {
  const rec = recordRequests()

  // ... perform action that triggers API call ...
  await userEvent.click(screen.getByRole('button', { name: /create/i }))

  // Find the request
  const request = rec.recordedRequests.find(
    (r) => r.method === 'POST' && r.pathname === '/api/v1beta/groups'
  )

  // Assert it was made with correct data
  expect(request).toBeDefined()
  expect(request?.payload).toEqual({ name: 'my-group' })
})

Recorded Request Shape

Each recorded request contains:

typescript
{
  pathname: '/api/v1beta/groups',      // URL path
  method: 'POST',                       // HTTP method
  payload: { name: 'my-group' },        // Parsed JSON body (if present)
  search: { filter: 'active' },         // Query parameters
}

Common Patterns

Verify POST payload
typescript
const rec = recordRequests()

// ... trigger create action ...

const createRequest = rec.recordedRequests.find(
  (r) => r.method === 'POST' && r.pathname === '/api/v1beta/workloads'
)
expect(createRequest?.payload).toMatchObject({
  name: 'my-server',
  group: 'default',
})
Verify DELETE was called
typescript
const rec = recordRequests()

// ... trigger delete action ...

const deleteRequest = rec.recordedRequests.find(
  (r) =>
    r.method === 'DELETE' && r.pathname === '/api/v1beta/workloads/my-server'
)
expect(deleteRequest).toBeDefined()
Verify request order
typescript
const rec = recordRequests()

// ... trigger actions ...

const postRequests = rec.recordedRequests.filter((r) => r.method === 'POST')
const groupIndex = postRequests.findIndex((r) => r.pathname.includes('/groups'))
const workloadIndex = postRequests.findIndex((r) =>
  r.pathname.includes('/workloads')
)

// Group must be created before workload
expect(groupIndex).toBeLessThan(workloadIndex)
Verify request count
typescript
const rec = recordRequests()

// ... trigger batch action ...

const deleteRequests = rec.recordedRequests.filter(
  (r) =>
    r.method === 'DELETE' && r.pathname.startsWith('/api/v1beta/workloads/')
)
expect(deleteRequests).toHaveLength(3)

Important Notes

  • recordRequests() clears previous recordings when called
  • Call it at the start of your test, before triggering actions
  • Each test starts fresh - recordings don't persist between tests
  • Use toMatchObject() for partial matching when payload has extra fields

When NOT to Use This

For read operations (GET) where you need to verify query parameters are sent correctly, don't use recordRequests(). Instead, use conditional overrides that return different data based on params, then verify the UI shows the expected data. See testing-api-overrides skill.

This approach is more robust because it tests actual user-facing behavior.

  • testing-with-api-mocks - Auto-generated mocks and fixture basics
  • testing-api-overrides - Conditional responses for testing filters/params (read operations)

© 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-assertions of stacklok/toolhive-studio.

Open the folder on GitHubat commit 87f7a55

Compare with similar skills

Testing API Assertions 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 Assertions compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Testing API Assertions this skillstacklok/toolhive-studio170—~993Automated 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 Overrides

    stacklok/toolhive-studio

    Test that components send correct query parameters or request arguments.

    170 GitHub stars~1.6k tokensUpdated today
    Auto-check passed

Categories

Questions about Testing API Assertions

What does Testing API Assertions do?

Verify API requests in tests. An agent skill from stacklok/toolhive-studio. Testing API Assertions is an agent skill from stacklok/toolhive-studio. Verify API requests in tests.

When should I use Testing API Assertions?

Testing API Assertions fits situations like: testing that correct API calls are made for create; delete operations; testing mutations; form submissions.

How do I install Testing API Assertions in Claude Code?

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

How do I install Testing API Assertions in Codex?

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

Can I use Testing API Assertions 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-assertions -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-assertions, .gemini/skills/testing-api-assertions, .github/skills/testing-api-assertions and .opencode/skills/testing-api-assertions in your project.

What does Testing API Assertions need to run?

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

Does Testing API Assertions 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 Assertions 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 Assertions use?

Testing API Assertions 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 Assertions use?

About 993 tokens (SKILL.md is roughly 4k 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 Assertions?

Skills that share tags, products or a category with Testing API Assertions: 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 Assertions?

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.