api-security-best-practices

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

A guide for designing and reviewing safer APIs, including how callers prove their identity, what they may access, how input is checked, and how request rates are limited. It is intended for existing applications and their identity and data models.

In plain words
What is it for?
Use it when protecting an endpoint, reviewing access to records, validating request data, addressing an API abuse path, or checking security assumptions before integration.
Why use it?
It helps prevent common API problems such as overly permissive access, unsafe request parsing, and abuse of endpoints without adding unrelated authentication systems.

Skill for Claude Code

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

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

Good fit Use it when protecting an endpoint, reviewing access to records, validating request data, addressing an API abuse path, or checking security assumptions before integration.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/lingxling/awesome-skills-cn/api-security-best-practices
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 lingxling/awesome-skills-cn --skill api-security-best-practices
Clone the repo
git clone --depth 1 https://github.com/lingxling/awesome-skills-cn

Made for: Claude Code.

Or install agentic-awesome-skills, the plugin that ships this one along with the rest of its 174 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/lingxling/awesome-skills-cn/api-security-best-practices/github.svg)](https://agentmods.dev/skills/lingxling/awesome-skills-cn/api-security-best-practices)
Your own site
<a href="https://agentmods.dev/skills/lingxling/awesome-skills-cn/api-security-best-practices"><img src="https://agentmods.dev/badge/skills/lingxling/awesome-skills-cn/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/lingxling/awesome-skills-cn/api-security-best-practices"><img src="https://agentmods.dev/badge/skills/lingxling/awesome-skills-cn/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.
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.5 $0.00012 $0.00946
Sonnet 5.5 $0.00006 $0.00473
Haiku 4.5 $0.00003 $0.00236

Measured 9d ago against content hash f01d39fb4e2a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 9d 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.

antigravity-awesome-skills/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. 9d ago First seen · 216 lines · 29 tokens per session scan A f01d39fb4e2a

Subscribe to this mod's changes

api-security-best-practices is a skill published in the GitHub repository lingxling/awesome-skills-cn (310 stars, last pushed 9d ago), licensed MIT. It adds 29 tokens to every session and 2,364 once invoked, about $0.0001 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-10-07.

Related

Other skills, from other repositories

api-design

Design production-grade REST, GraphQL, gRPC, and Python library APIs with correct schemas, error contracts, auth, and versioning. Use when the user asks to design an API, define endpoints, create an OpenAPI/Swagger spec, design a GraphQL schema, build a gRPC service, model request/response with Pydantic, add…

viktorbezdek/skillstack · 114 tokens

content-modelling

Design CMS content models — content types, fields, editorial workflows, governance rules, and COPE (Create Once, Publish Everywhere) patterns — for structured, multi-channel publishing. Use when the user asks to design a content model, define content types in a CMS, structure fields for editorial content, plan a…

viktorbezdek/skillstack · 114 tokens

nodejs-development

Node.js development guidelines covering Payload CMS, Vue.js with TypeScript, and general TypeScript best practices.

Mindrally/skills · 24 tokens

dotnet

Guidelines for .NET backend development with C#, ASP.NET Core, and Entity Framework Core.

Mindrally/skills · 21 tokens

microservices

Guidelines for building production-grade microservices with FastAPI/Python and Go, covering serverless patterns, clean architecture, observability, and resilience.

Mindrally/skills · 33 tokens

voice-ai-realtime-agent

Expert guide for Ultra-Low Latency Conversational Voice AI (<300ms), WebRTC bidirectional streaming, OpenAI Realtime API, Gemini Multimodal Live Audio, LiveKit Agents, and Semantic VAD / Panduan ahli AI suara percakapan real-time berlatensi ultra-rendah.

roedyrustam/vibes-plug · 68 tokens