bug-fix-tdd
Reproduce and fix bugs using TDD. Use when analyzing a bug report, writing a regression test, or applying a minimal fix. Covers…
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.
Claude Code
$ npx -y skills add stacklok/toolhive-studio --skill testing-api-assertions --agent claude-code
Codex
$ npx skills add stacklok/toolhive-studio --skill testing-api-assertions -a codex -y
Cursor
$ npx skills add stacklok/toolhive-studio --skill testing-api-assertions -a cursor -y
Gemini CLI
$ npx skills add stacklok/toolhive-studio --skill testing-api-assertions -a gemini-cli -y
GitHub Copilot
$ npx skills add stacklok/toolhive-studio --skill testing-api-assertions -a github-copilot -y
OpenCode
$ npx skills add stacklok/toolhive-studio --skill testing-api-assertions -a opencode -y
Windsurf
$ npx skills add stacklok/toolhive-studio --skill testing-api-assertions -a windsurf -y
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.
Verify that your code sends the correct API requests for operations with side effects.
**DO use** for operations with side effects:
**DON'T use** for read operations:
Use `recordRequests()` to capture all API requests made during a test:
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' })
})Each recorded request contains:
{
pathname: '/api/v1beta/groups', // URL path
method: 'POST', // HTTP method
payload: { name: 'my-group' }, // Parsed JSON body (if present)
search: { filter: 'active' }, // Query parameters
}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',
})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()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)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)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.
Run any Model Context Protocol (MCP) server — securely, instantly, anywhere. ToolHive is the easiest way to discover, deploy, and manage MCP servers. Launch any MCP server in a locked-down container with just a few clicks.
Reproduce and fix bugs using TDD. Use when analyzing a bug report, writing a regression test, or applying a minimal fix. Covers…
Deep links in ToolHive Studio. Use when implementing, debugging, or asking about deep link features (toolhive-gui:// protocol),…
Spin up and interact with ToolHive Studio's containerized dev environment (Xvfb + noVNC + DinD). Use when running, testing, or…
Remediate security vulnerabilities found by Grype or pnpm audit. Use when a security scan fails, a CVE needs fixing, or you need…
Create new AI agent skills for Claude Code, Codex, and Cursor. Use when asked to create a skill, add a new agent capability, or…
REQUIRED for editing any skill file. Ensures changes sync to Claude, Codex, and Cursor. Never edit .claude/skills/ files directly…
Use when the user needs to run GitNexus CLI commands like analyze/index a repo, check status, clean the index, generate a wiki,…
Query and invoke tools on MCP servers using fastmcp list and fastmcp call. Use when you need to discover what tools a server…
Design n8n AI agents the right way. Use when building or editing any @n8n/n8n-nodes-langchain.* AI node — an AI Agent, LLM chain,…
小红书内容发布技能。支持两种发布模式:(1) 上传图文模式 - 图片+短文;(2) 写长文模式 - 长篇文章+排版模板。 支持两种输入方式:用户提供完整内容和图片/图片URL,直接发布;或提供网页URL,自动提取内容和图片。…