api-security-best-practices

api-security-best-practices is a skill for Claude Code from sickn33/agentic-awesome-skills. It costs 29 tokens per session (2,364 once invoked), scanned A, original, MIT.

A guide to protecting web APIs, which are programmatic interfaces that let applications exchange data. It covers checking identity and permissions, validating input, limiting request rates, and defending REST, GraphQL, and WebSocket APIs against common attacks.

In plain words
What is it for?
Use it when designing or reviewing APIs, adding authentication or role-based access, validating requests, protecting sensitive data, preparing for audits, or adding rate limits.
Why use it?
It helps prevent unauthorized access, malicious input, excessive traffic, and security weaknesses in API endpoints.

Skill for Claude Code

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

Part of the agentic-awesome-skills plugin — 196 skills shipped together

Good fit Use it when designing or reviewing APIs, adding authentication or role-based access, validating requests, protecting sensitive data, preparing for audits, or adding rate limits.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sickn33/agentic-awesome-skills/api-security-best-practices
About the project

AAS Core is a local control plane for coding agents that lets them search a large catalogue of skills, choose a stack, validate it, and create a reproducible plan. It is used to assemble and review agent workflows through its CLI, local MCP server, catalogue, plugins, and Workbench. The catalogue add-ons provide the skills, plugins, bundles, and workflows that AAS Core helps agents select and validate.

sickn33/agentic-awesome-skills · 46,184 stars · on GitHub · sickn33.github.io

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 sickn33/agentic-awesome-skills --skill api-security-best-practices
Clone the repo
git clone --depth 1 https://github.com/sickn33/agentic-awesome-skills

Made for: Claude Code.

Or install agentic-awesome-skills, the plugin that ships this one along with the rest of its 196 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 api-security-best-practices

README.md
[![agentmods](https://agentmods.dev/badge/skills/sickn33/agentic-awesome-skills/api-security-best-practices/github.svg)](https://agentmods.dev/skills/sickn33/agentic-awesome-skills/api-security-best-practices)
Your own site
<a href="https://agentmods.dev/skills/sickn33/agentic-awesome-skills/api-security-best-practices"><img src="https://agentmods.dev/badge/skills/sickn33/agentic-awesome-skills/api-security-best-practices/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 api-security-best-practices

Your own site · 80×15
<a href="https://agentmods.dev/skills/sickn33/agentic-awesome-skills/api-security-best-practices"><img src="https://agentmods.dev/badge/skills/sickn33/agentic-awesome-skills/api-security-best-practices.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 29 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,364 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. Third-party audits
  • Socket pass 5 Sept 2026
  • Snyk pass 5 Sept 2026
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 3 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Privilege Escalation · line 63
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 76
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 68
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
How audits are shown
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.00029 $0.02364
Opus 5 $0.00015 $0.01182
Sonnet 5 $0.00006 $0.00473
Haiku 4.5 $0.00003 $0.00236

Measured 3d ago against content hash f01d39fb4e2a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

api-security-best-practices 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 3d 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.

Origin

Copies of this mod

8 near-identical copies found in the catalogue:

plugins/agentic-awesome-skills-claude/skills/api-security-best-practices/SKILL.md · 216 lines

How it starts

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

API Security Best Practices

Review the request boundary from caller identity through authorization, validated input, storage and observable response. Preserve the application's actual identity provider and data model rather than introducing a second authentication system.

When to Use

Use when adding a protected endpoint, reviewing object access, replacing permissive request parsing, or investigating an API abuse path. For a concrete defect, start with the failing route and its callers; do not deploy unrelated security infrastructure.

Inputs and prerequisites

Record the routes, caller/tenant model, identity provider, token contract, runtime and locked dependency versions, database schema, proxy topology and authorized test scope. Use synthetic identities in a test environment. Existing task authorization carries forward; production scans, account writes and message sends need their own authority. The Node examples below are integration sketches for Express, jsonwebtoken and Zod; application/database adapters are deliberately named rather than presented as a full runnable service. Confirm APIs against the installed versions before integrating.

1. Authenticate the exact token contract

Prefer the established provider/session middleware. When the service owns an HMAC JWT contract, require a strong server-owned key, a fixed algorithm, exact issuer and audience, and required runtime claims. Do not infer permissions from a decoded token before signature verification. Never accept a caller-selected verification algorithm.

const jwt = require('jsonwebtoken');

// Illustrative first-party access-token contract; not a third-party OAuth adapter.
const ACCESS_POLICY = {
  algorithms: ['HS256'], issuer: 'example-auth', audience: 'example-api'
};
function verifyAccessToken(token, signingKey) {
  const claims = jwt.verify(token, signingKey, ACCESS_POLICY);
  if (!claims || typeof claims !== 'object' ||
      typeof claims.sub !== 'string' || !claims.sub ||
      typeof claims.tenantId !== 'string' || !claims.tenantId ||
      !Number.isSafeInteger(claims.exp) || !Number.isSafeInteger(claims.iat) ||
      claims.exp <= claims.iat) {
    throw new Error('Invalid access claims');
  }
  return { subject: claims.sub, tenantId: claims.tenantId };
}
function readBearer(header) {
  if (typeof header !== 'string' || header.length > 8192) return null;
  const match = /^Bearer ([A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+)$/i.exec(header);
  return match ? match[1] : null;
}

Read the full file on GitHub · 216 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. 3d ago Changed · -700 lines f01d39fb4e2a
  2. 5d ago First seen · 916 lines · 29 tokens per session scan A 1eadc9741aac

Subscribe to this mod's changes

api-security-best-practices is a skill published in the GitHub repository sickn33/agentic-awesome-skills (46,184 stars, last pushed yesterday), licensed MIT. It adds 29 tokens to every session and 2,364 once invoked, about $0.0001 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-09-05.