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.zipInstalls 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.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
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:
| Guide | Contents |
|---|---|
| Node.js/Express API Security | Node.js/Express API Security |
| Python FastAPI Security | Python FastAPI Security |
| API Gateway Security Configuration | API 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.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| api-security-hardening (this skill) | 0 | 5mo | Review | Intermediate |
| backend-development | 0 | 5mo | No flags | Advanced |
| security-header-generator | 5 | 9mo | Caution | Intermediate |
| backend-security-coder | 24 | 4mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by aj-geddes
View all by aj-geddes →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.
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".
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.
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".
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".
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.