AP

api-security-hardening

Implements industry-standard security middleware to protect API endpoints from common web vulnerabilities.

Install

mkdir -p .claude/skills/api-security-hardening && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/11228" && unzip -o skill.zip -d .claude/skills/api-security-hardening && rm skill.zip

Installs to .claude/skills/api-security-hardening

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Secure REST APIs with authentication, rate limiting, CORS, input validation, and security middleware. Use when building or hardening API endpoints against common attacks.
170 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Implement security headers
  • Configure rate limiting
  • Sanitize inputs
  • Secure API endpoints

How it works

It provides middleware and configuration patterns to protect APIs against common vulnerabilities like XSS and SQL injection.

Inputs & outputs

You give it
API endpoint requirements
You get back
Hardened API configuration

When to use api-security-hardening

  • Hardening public-facing API endpoints
  • Remediating security audit findings
  • Securing new API development
  • Implementing JWT-based authorization

About this skill

API Security Hardening

Table of Contents

Overview

Implement comprehensive API security measures including authentication, authorization, rate limiting, input validation, and attack prevention to protect against common vulnerabilities.

When to Use

  • New API development
  • Security audit remediation
  • Production API hardening
  • Compliance requirements
  • High-traffic API protection
  • Public API exposure

Quick Start

Minimal working example:

// secure-api.js - Comprehensive API security
const express = require("express");
const helmet = require("helmet");
const rateLimit = require("express-rate-limit");
const mongoSanitize = require("express-mongo-sanitize");
const xss = require("xss-clean");
const hpp = require("hpp");
const cors = require("cors");
const jwt = require("jsonwebtoken");
const validator = require("validator");

class SecureAPIServer {
  constructor() {
    this.app = express();
    this.setupSecurityMiddleware();
    this.setupRoutes();
  }

  setupSecurityMiddleware() {
    // 1. Helmet - Set security headers
    this.app.use(
      helmet({
        contentSecurityPolicy: {
          directives: {
            defaultSrc: ["'self'"],
// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
Node.js/Express API SecurityNode.js/Express API Security
Python FastAPI SecurityPython FastAPI Security
API Gateway Security ConfigurationAPI Gateway Security Configuration

Best Practices

✅ DO

  • Use HTTPS everywhere
  • Implement rate limiting
  • Validate all inputs
  • Use security headers
  • Log security events
  • Implement CORS properly
  • Use strong authentication
  • Version your APIs

❌ DON'T

  • Expose stack traces
  • Return detailed errors
  • Trust user input
  • Use HTTP for APIs
  • Skip input validation
  • Ignore rate limiting

When not to use it

  • When security is not required
  • When using non-Node/Python APIs

Limitations

  • Requires specific framework implementation

How it compares

It provides complete security patterns rather than just individual security headers.

Compared to similar skills

api-security-hardening side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
api-security-hardening (this skill)05moReviewIntermediate
backend-development05moNo flagsAdvanced
security-header-generator59moCautionIntermediate
backend-security-coder244moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

backend-development

hoadh

Build backends with Node.js, Python, Go (NestJS, FastAPI, Django). Use for REST/GraphQL/gRPC APIs, auth (OAuth, JWT), databases, microservices, security (OWASP), Docker/K8s.

00

security-header-generator

Dexploarer

Generates security HTTP headers (CSP, HSTS, CORS, etc.) for web applications to prevent common attacks. Use when user asks to "add security headers", "setup CSP", "configure CORS", "secure headers", or "HSTS setup".

599

backend-security-coder

sickn33

Expert in secure backend coding practices specializing in input validation, authentication, and API security. Use PROACTIVELY for backend security implementations or security code reviews.

2446

apollo-security-basics

jeremylongshore

Apply Apollo.io API security best practices. Use when securing Apollo integrations, managing API keys, or implementing secure data handling. Trigger with phrases like "apollo security", "secure apollo api", "apollo api key security", "apollo data protection".

13

vercel-data-handling

jeremylongshore

Implement Vercel PII handling, data retention, and GDPR/CCPA compliance patterns. Use when handling sensitive data, implementing data redaction, configuring retention policies, or ensuring compliance with privacy regulations for Vercel integrations. Trigger with phrases like "vercel data", "vercel PII", "vercel GDPR", "vercel data retention", "vercel privacy", "vercel CCPA".

13

azure-keyvault-keys-ts

microsoft

Manage cryptographic keys using Azure Key Vault Keys SDK for JavaScript (@azure/keyvault-keys). Use when creating, encrypting/decrypting, signing, or rotating keys.

10

Search skills

Search the agent skills registry