aj-geddes avatar

Api Security Hardening

This is a solid foundation for locking down REST APIs with all the essentials in one place: authentication with JWT, rate limiting, helmet for security headers, input sanitization against XSS and NoSQL injection, and proper CORS configuration. You get reference implementations for Node.js/Express, Python FastAPI, and API gateway setups. Use this when you're hardening an existing API before going to production or building a new one that needs to pass a security audit from day one. The quick start example pulls together the usual suspects (helmet, express-rate-limit, xss-clean) so you don't have to remember which npm packages to combine. It won't write your security policy for you, but it handles the technical implementation of common defenses.

skills.sh installs
868
GitHub stars
379
last updated
Aug 21, 2026

Install

$ npx -y skills add aj-geddes/useful-ai-prompts --skill api-security-hardening --agent claude-code

Installs into .claude/skills of the current project.

Files

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();
  }

Sponsors

Details

Repository
github.com/aj-geddes/useful-ai-prompts
Categories
Backend & APIs, Security, AI & Agent Building
First seen
May 16, 2026

More from aj-geddes/useful-ai-prompts

All 258
1encoredev avatarencore-authencoredev/skillsProtect Encore.ts endpoints with authentication and authorize callers. Covers `authHandler`, `Gateway`, `getAuthData`, and `auth: true`.864skills.sh installs
2docyrus avatardocyrus-api-devdocyrus/agent-skillsDevelop applications using the Docyrus API with @docyrus/api-client and @docyrus/signin libraries. Use when building apps that authenticate with Docyrus OAuth2 847skills.sh installs
3alirezarezvani avatarsql-database-assistantalirezarezvani/claude-skillsUse when the user asks to write SQL queries, optimize database performance, generate migrations, explore database schemas, or work with ORMs like Prisma, Drizzl763skills.sh installs
4bobmatnyc avatarnodejs-backend-typescriptbobmatnyc/claude-mpm-skillsNode.js backend development with TypeScript, Express/Fastify servers, routing, middleware, and database integration745skills.sh installs
5mindrally avatarsupabase-developmentmindrally/skillsSupabase development guidelines for database, authentication, real-time subscriptions, and Edge Functions.724skills.sh installs
6davila7 avatarpubmed-databasedavila7/claude-code-templatesDirect REST API access to PubMed. Advanced Boolean/MeSH queries, E-utilities API, batch processing, citation management. For Python workflows, prefer biopython 713skills.sh installs