davila7 avatar

Api Security Best Practices

This walks you through hardening your API endpoints against the usual suspects: injection attacks, auth bypasses, rate limit abuse, and data leaks. You get concrete implementations for JWT authentication with refresh tokens, middleware for token verification, parameterized queries to prevent SQL injection, and rate limiting strategies. The examples are production-ready Node.js code, not just theory. It covers the OWASP API Security Top 10 systematically, which is exactly what you need before a security audit or when reviewing legacy endpoints that were built fast and loose. The input validation section alone could save you from a lot of pain, especially the part about sanitizing error messages so you don't leak database structure to attackers.

skills.sh installs
466
GitHub stars
33.2K
last updated
Aug 21, 2026

Install

$ npx -y skills add davila7/claude-code-templates --skill api-security-best-practices --agent claude-code

Installs into .claude/skills of the current project.

Files

API Security Best Practices

Overview

Guide developers in building secure APIs by implementing authentication, authorization, input validation, rate limiting, and protection against common vulnerabilities. This skill covers security patterns for REST, GraphQL, and WebSocket APIs.

When to Use This Skill

  • Use when designing new API endpoints
  • Use when securing existing APIs
  • Use when implementing authentication and authorization
  • Use when protecting against API attacks (injection, DDoS, etc.)
  • Use when conducting API security reviews
  • Use when preparing for security audits
  • Use when implementing rate limiting and throttling
  • Use when handling sensitive data in APIs

How It Works

Step 1: Authentication & Authorization

I'll help you implement secure authentication:

  • Choose authentication method (JWT, OAuth 2.0, API keys)
  • Implement token-based authentication
  • Set up role-based access control (RBAC)
  • Secure session management
  • Implement multi-factor authentication (MFA)

Step 2: Input Validation & Sanitization

Sponsors

Details

Repository
github.com/davila7/claude-code-templates
Categories
Backend & APIs, Security, Design & UI/UX
First seen
Jun 3, 2026

More from davila7/claude-code-templates

All 618
1secondsky avatarapi-response-optimizationsecondsky/claude-skillsOptimizes API performance through payload reduction, caching strategies, and compression techniques. Use when improving API response times, reducing bandwidth u434skills.sh installs
2levnikolaevich avatarln-775-api-docs-generatorlevnikolaevich/claude-code-skillsConfigures Swagger/OpenAPI documentation for backend APIs. Use when adding interactive API docs to a project.432skills.sh installs
3aj-geddes avatargraphql-implementationaj-geddes/useful-ai-promptsDesign and implement GraphQL APIs with schema design, resolvers, queries, mutations, subscriptions, and best practices. Use when building GraphQL servers, desig424skills.sh installs
4davila7 avatarbackend-to-frontend-handoff-docsdavila7/claude-code-templatesCreate API handoff documentation for frontend developers. Use when backend work is complete and needs to be documented for frontend integration, or user says 'c413skills.sh installs
5davila7 avatarclinicaltrials-databasedavila7/claude-code-templatesQuery ClinicalTrials.gov via API v2. Search trials by condition, drug, location, status, or phase. Retrieve trial details by NCT ID, export data, for clinical r409skills.sh installs
6umbraco avatarumbraco-auth-providerumbraco/umbraco-cms-backoffice-skillsImplement authentication providers for Umbraco backoffice using official docs399skills.sh installs