security-test-generator

security-test-generator is a skill for Claude Code from apisec-inc/apisec-skills. It costs 90 tokens per session (8,303 once invoked), scanned A, original, MIT.

A guide for writing security tests that act like hostile users instead of only checking valid requests. It complements ordinary tests by checking that an API fails safely.

In plain words
What is it for?
Use it when adding tests for API endpoints with Jest, Mocha, pytest, or JUnit, especially to check unauthorized access, invalid data, boundary cases, and expected error responses.
Why use it?
It exposes gaps where code works for legitimate users but mishandles malformed or dangerous input, leaks data, or returns server errors.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import app from '../../src/app.js';.

Part of the apisec plugin — 6 skills shipped together

Good fit Use it when adding tests for API endpoints with Jest, Mocha, pytest, or JUnit, especially to check unauthorized access, invalid data, boundary cases, and expected error responses.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/apisec-inc/apisec-skills
agentmods
npx agentmods add skills/apisec-inc/apisec-skills/security-test-generator

Made for: Claude Code.

Or install apisec, the plugin that ships this one along with the rest of its 6 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for security-test-generator

README.md
[![agentmods](https://agentmods.dev/badge/skills/apisec-inc/apisec-skills/security-test-generator/github.svg)](https://agentmods.dev/skills/apisec-inc/apisec-skills/security-test-generator)
Your own site
<a href="https://agentmods.dev/skills/apisec-inc/apisec-skills/security-test-generator"><img src="https://agentmods.dev/badge/skills/apisec-inc/apisec-skills/security-test-generator/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for security-test-generator

Your own site · 80×15
<a href="https://agentmods.dev/skills/apisec-inc/apisec-skills/security-test-generator"><img src="https://agentmods.dev/badge/skills/apisec-inc/apisec-skills/security-test-generator.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 90 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 8,303 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00090 $0.08303
Opus 5.5 $0.00036 $0.03321
Sonnet 5.5 $0.00018 $0.01661
Haiku 4.5 $0.00009 $0.00830

Measured 1mo ago against content hash 53b281af6e63, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

security-test-generator 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 1mo 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.

skills/security-test-generator/SKILL.md · 992 lines

How it starts

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

Security Test Generator

1. Role

You are a security test engineer who writes adversarial test cases that probe for the vulnerabilities APIsec detects in production scans. Your tests complement — never replace — the developer's existing functional test suite. Where functional tests ask "does this work for legitimate users?", your tests ask "does this fail safely when an attacker tries to break it?".

You generate complete, runnable test files organized by attack category. Every test has a descriptive name that states the attack scenario being tested, making the test suite readable as a security specification.


2. Philosophy — Why Security Tests Are Different

Functional tests vs security tests

Functional Test Security Test
Perspective Legitimate user Adversarial attacker
Goal Confirm the code works Confirm the code fails safely
Input Valid, expected data Malformed, boundary, hostile data
Success 200 OK with correct data 401, 403, 404, 400 — never 500, never data leak
Coverage gap "It works" ≠ "it's safe" Security tests close that gap

Why this matters

A typical test suite has tests like:

test('GET /orders/:id returns the order', async () => {
  const res = await request(app).get(`/api/orders/${orderId}`).set('Authorization', `Bearer ${token}`);
  expect(res.status).toBe(200);
  expect(res.body.id).toBe(orderId);
});

This test passes even if:

  • Any authenticated user can fetch any order (BOLA)
  • The endpoint accepts requests with no token at all (auth bypass)
  • An expired token still works (broken auth)
  • Sending isAdmin: true in a PUT body escalates privileges (mass assignment)
  • SQL injection in query parameters returns a 500 instead of a 400

Security tests make these attack scenarios executable and repeatable in CI/CD, catching regressions before they reach production.

The core principle

A security test passes when the application rejects the attack. A security test fails when the application allows the attack or crashes.

Read the full file on GitHub · 992 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. 1mo ago First seen · 992 lines · 90 tokens per session scan A 53b281af6e63

Subscribe to this mod's changes

security-test-generator is a skill published in the GitHub repository apisec-inc/apisec-skills (21 stars, last pushed 1mo ago), licensed MIT. It adds 90 tokens to every session and 8,303 once invoked, about $0.0004 per session on Opus 5.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-30.

Related

Other skills, from other repositories

testing-api-for-broken-object-level-authorization

Tests REST and GraphQL APIs for Broken Object Level Authorization (BOLA/IDOR) vulnerabilities where an authenticated user can access or modify resources belonging to other users by manipulating object identifiers in API requests. The tester intercepts API calls, identifies object ID parameters (numeric IDs, UUIDs…

xalgorix/xalgorix · 133 tokens

performing-graphql-introspection-attack

Performs GraphQL introspection attacks to extract the full API schema including types, queries, mutations, subscriptions, and field definitions from GraphQL endpoints. The tester uses introspection queries to map the attack surface, identifies sensitive fields and mutations, tests for query depth and complexity…

xalgorix/xalgorix · 111 tokens

detecting-api-enumeration-attacks

Detect and prevent API enumeration attacks including BOLA and IDOR exploitation by monitoring sequential identifier access patterns and authorization failures.

xalgorix/xalgorix · 32 tokens

exploiting-jwt-algorithm-confusion-attack

Exploits JWT algorithm confusion vulnerabilities where the server's token verification library accepts the algorithm specified in the JWT header rather than enforcing a fixed algorithm. The tester manipulates the alg header to switch from RS256 to HS256 (using the RSA public key as the HMAC secret), sets alg to none…

xalgorix/xalgorix · 116 tokens

performing-api-security-testing-with-postman

Uses Postman to perform structured API security testing by building collections that test for OWASP API Security Top 10 vulnerabilities including authentication bypass, authorization flaws, injection, and data exposure. The tester creates environments with multiple user roles, writes test scripts for automated…

xalgorix/xalgorix · 106 tokens

testing-api-authentication-weaknesses

Tests API authentication mechanisms for weaknesses including broken token validation, missing authentication on endpoints, weak password policies, credential stuffing susceptibility, token leakage in URLs or logs, and session management flaws. The tester evaluates JWT implementation, API key handling, OAuth flows, and…

xalgorix/xalgorix · 102 tokens