api-testing

A guide for testing API endpoints, which are the parts of an application that receive requests and return data. It covers checking successful responses, invalid input, permissions, edge cases, and mocked outside services.

In plain words
What is it for?
Use it to write or review integration and contract tests for API routes, including tests for validation errors, authorization failures, boundary conditions, and external-service responses.
Why use it?
It helps ensure an endpoint returns the right status, data, and structure instead of only checking that the request does not crash. It also helps expose unauthorized access and unreliable tests.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/event4u-app/agent-config/api-testing
Any agent
npx skills add event4u-app/agent-config --skill api-testing
Clone the repo
git clone --depth 1 https://github.com/event4u-app/agent-config

Made for: Claude Code, Codex.

Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,706 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00038 $0.01706
Opus 5 $0.00019 $0.00853
Sonnet 5 $0.00008 $0.00341
Haiku 4.5 $0.00004 $0.00171

Measured 2d ago against content hash 37fcfbfbceca, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

api-testing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

src/skills/api-testing/SKILL.md · 237 lines

How it starts

The opening of the file, as written. The whole thing — 237 lines — stays where its author put it; the contents beside it link to each section on GitHub.

api-testing

When to use

Use this skill when writing or reviewing API endpoint tests — integration tests, contract validation, response structure checks, or external service mocking.

Procedure: Write API tests

  1. Understand the endpoint — Read the controller, form request, and existing tests. Understand expected behavior, edge cases, and auth requirements before writing anything.
  2. Set up test data — Use seeders (preferred) or factories. Mock external services with Http::fake().
  3. Enumerate test cases — Run the test-case-discovery funnel first; cover success, validation errors, authorization failures, and edge cases — floor per behavior: 1 happy + 1 boundary + 1 error (+1 abuse case; on data-returning endpoints the three broken-access-control negative tests are mandatory).
  4. Assert response — Check status code, JSON structure, data values. Use assertJsonStructure().
  5. Verify — Run the test. Must pass. Check no flaky assertions (no time-dependent, no random ordering).

Example

describe('GET /api/v1/projects', function () {
    it('returns paginated projects for authenticated user', function () {
        $user = loginAsTestUser();

        $response = $this->getJson('/api/v1/projects');

        $response->assertOk()
            ->assertJsonStructure([
                'data' => [['id', 'title', 'status']],
                'meta' => ['current_page', 'per_page', 'total'],
            ]);
    });

    it('returns 401 for unauthenticated request', function () {
        $this->getJson('/api/v1/projects')
            ->assertUnauthorized();
    });

    it('returns 403 when user lacks permission', function () {
        loginAsRestrictedUser();

        $this->getJson('/api/v1/projects')
            ->assertForbidden();
    });
});

Test categories

Happy path

Test the expected success scenario with valid input:

it('creates a project', function () {
    loginAsTestUser();

    $this->postJson('/api/v1/projects', [
        'title' => 'New Project',
        'customer_id' => $customerId,
    ])
        ->assertCreated()
        ->assertJsonPath('data.title', 'New Project');

    $this->assertDatabaseHas('projects', ['title' => 'New Project']);
});

Read the full file on GitHub · 237 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 237 lines · 38 tokens per session scan A 37fcfbfbceca

Subscribe to this mod's changes

api-testing is a skill published in the GitHub repository event4u-app/agent-config (10 stars, last pushed 2d ago), licensed MIT. It adds 38 tokens to every session and 1,706 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

save-progress

Save current project task progress to local task state file for cross-session continuity. Use when the user asks to save progress, uses an equivalent localized trigger phrase, the session is interrupted, or the user wants to resume work later. Writes to .claude/project-task-state.json so next session can load it via…

KimYx0207/Meta_Kim · 65 tokens

meta-theory

MetaKim executable governance dispatcher. It classifies the run, loads only needed references, preserves foundational capabilities and runtime-native abilities, routes owner + weapon + dependency + runtime + OS + verification, and closes only with evidence, intent acceptance, and writeback decision.

KimYx0207/Meta_Kim · 57 tokens

same-set-reusable-flow-for-project-file-inventor

Reusable MetaKim file inventory classification flow. It helps separate durable sources, generated evidence, runtime mirrors, temporary state, and risky unknowns before cleanup or commit.

KimYx0207/Meta_Kim · 45 tokens

starreel-drama-production

Operating skill for any AI agent driving the StarReel short-drama production pipeline (script → rewrite → extract → portraits + sheets → storyboards → frames → video → voiceover → final cut) over MCP or REST. Covers the ordered workflow, the eleven operating disciplines (prepaid billing, quote-before-spend, retryable…

waydaxp/starreel-mcp · 87 tokens

seedance-20

Generate and direct cinematic AI videos with Seedance 2.0 (ByteDance/Dreamina/Jimeng). Covers text-to-video, image-to-video, video-to-video, and reference-to-video workflows with @Tag asset references, multi-character scenes, audio design, and post-processing. Use when making AI video, writing Seedance prompts…

Kingdaddy007/my-os · 96 tokens

auth-web-cloudbase

CloudBase Web Authentication Quick Guide for frontend integration after auth-tool has already been checked. Provides concise and practical Web authentication solutions with multiple login methods and complete user management.

TencentCloudBase/CloudBase-AI-Toolkit · 38 tokens