api-security

api-security is a skill for Claude Code from LeahyCC/claude-skills. It costs 44 tokens per session (2,153 once invoked), scanned A, original, MIT.

A security guide for application programming interfaces, the endpoints software uses to exchange data, in Next.js applications.

In plain words
What is it for?
Use it to design authentication and access checks, validate requests, limit traffic, protect against server-side request forgery, and filter API responses.
Why use it?
It helps prevent unauthorized access, unsafe input, excessive data exposure, and other common API weaknesses identified by OWASP, a web-security standards group.

Skill for Claude Code

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

Part of the claude-skills plugin — 7 skills, 1 command shipped together

Good fit Use it to design authentication and access checks, validate requests, limit traffic, protect against server-side request forgery, and filter API responses.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/leahycc/claude-skills/api-security
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.

Any agent
npx skills add LeahyCC/claude-skills --skill api-security
Clone the repo
git clone --depth 1 https://github.com/LeahyCC/claude-skills

Made for: Claude Code.

Or install claude-skills, the plugin that ships this one along with the rest of its 7 skills, 1 command.

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 api-security

README.md
[![agentmods](https://agentmods.dev/badge/skills/leahycc/claude-skills/api-security.svg)](https://agentmods.dev/skills/leahycc/claude-skills/api-security)
Your own site
<a href="https://agentmods.dev/skills/leahycc/claude-skills/api-security"><img src="https://agentmods.dev/badge/skills/leahycc/claude-skills/api-security.svg" alt="Measured on agentmods" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,153 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.00044 $0.02153
Opus 5 $0.00022 $0.01077
Sonnet 5 $0.00009 $0.00431
Haiku 4.5 $0.00004 $0.00215

Measured 7d ago against content hash 5ee636274e57, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

api-security 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 7d 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/api-security/SKILL.md · 166 lines

How it starts

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

API Security — OWASP API Security Top 10 (2023) for Next.js

Production-grade API security patterns for Next.js App Router. Covers every category in the OWASP API Security Top 10 (2023) with cross-references to the OWASP Web Top 10 (2021). Verified against the official OWASP specifications.

Architecture

Request → proxy.ts (auth gate) → Route Handler / Server Action
                                       ↓
                                  Input Validation (Zod)
                                       ↓
                                  Data Access Layer (auth + authz + DTO)
                                       ↓
                                  Database (parameterized queries)
                                       ↓
                                  Filtered Response (DTO, no raw records)

The Data Access Layer (DAL) is the central security architecture recommended by Next.js. All database access, authorization checks, and response filtering happen in one server-only module — never in components or actions directly.

Quick Reference

Resource OWASP API OWASP Web What It Covers
Access Control API1, API5 A01 BOLA/IDOR, function-level auth, ownership checks
Authentication API2 A07, A02 Session management, JWT, Clerk/Auth0, proxy.ts
Input Validation API3, API8 A03 Zod schemas, SQL injection, XSS, Server Action validation
Rate Limiting API4 A04 Per-endpoint limits, cost attacks, Upstash patterns
Security Headers API8 A05 CSP, HSTS, CORS, Permissions-Policy, next.config
Data Exposure API3, API6 A04 DAL pattern, DTOs, error sanitization, response filtering
Supply Chain API9, API10 A06, A08 Dependencies, env vars, CI/CD, third-party APIs
SSRF & Logging API7 A09, A10 URL validation, fetch safety, secure logging, audit trails

Read the full file on GitHub · 166 lines

Files

What ships with it

9 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 7d ago First seen · 166 lines · 44 tokens per session scan A 5ee636274e57

Subscribe to this mod's changes

api-security is a skill published in the GitHub repository LeahyCC/claude-skills (3 stars, last pushed 1mo ago), licensed MIT. It adds 44 tokens to every session and 2,153 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

Accessibility Audit Helper

Reviews UI code and components for WCAG 2.1 accessibility violations and provides specific fixes.

Notysoty/openagentskills · 23 tokens

fastify-best-practices

This skill should be used when working on any Fastify project or when the user asks about Fastify best practices, conventions, or patterns. Trigger when: working on a Fastify project, creating Fastify plugins, registering routes, using decorators, organizing Fastify application structure, using @fastify/autoload…

RadOrigin-LLC/RAD-Claude-Skills · 110 tokens

fastify-hooks-lifecycle

This skill should be used when implementing Fastify hooks, understanding hook execution order, using onRequest/preParsing/preValidation/preHandler/preSerialization/onError/onSend/onResponse hooks, using onReady/onListen/onClose/onRoute/onRegister application hooks, debugging hook chain issues, adding authentication…

RadOrigin-LLC/RAD-Claude-Skills · 85 tokens

fastify-production

This skill should be used when deploying Fastify to production, configuring Fastify security headers, setting up reverse proxy with Fastify, implementing graceful shutdown, configuring @fastify/helmet, @fastify/cors, @fastify/rate-limit, trustProxy settings, Kubernetes Fastify deployment, Fastify performance tuning…

RadOrigin-LLC/RAD-Claude-Skills · 97 tokens

fastify-schemas-validation

This skill should be used when writing Fastify JSON schemas, configuring Ajv validation, using fast-json-stringify serialization, defining request body/querystring/params/headers schemas, sharing schemas with addSchema and $ref, using fluent-json-schema, configuring response schemas, handling validation errors…

RadOrigin-LLC/RAD-Claude-Skills · 87 tokens

fastify-troubleshooting

This skill should be used when debugging Fastify issues, identifying Fastify anti-patterns, diagnosing common Fastify mistakes, performing Fastify error troubleshooting, investigating request.body undefined in hook, fixing decorator shared across requests, resolving hook executing twice, handling reply already sent…

RadOrigin-LLC/RAD-Claude-Skills · 103 tokens