Api Hardening
Provides API guidance and assistance for agent workflows.
Install on your platform
We auto-selected Claude Code based on this skill’s supported platforms.
Run in terminal (recommended)
claude mcp add api-hardening npx -- -y @trustedskills/api-hardening
Or manually add to ~/.claude/settings.json
{
"mcpServers": {
"api-hardening": {
"command": "npx",
"args": [
"-y",
"@trustedskills/api-hardening"
]
}
}
}Requires Claude Code (claude CLI). Run claude --version to verify your install.
About This Skill
What it does
This skill provides guidance and code examples for API hardening, focusing on defense-in-depth strategies to protect APIs from abuse, injection attacks, and data leakage. It specifically demonstrates rate limiting implementation using Express.js and Redis, offering different configurations for general API usage, authentication endpoints, and password reset requests. The goal is to prevent brute force attacks, accidental or intentional DDoS events, and unexpected cloud provider costs.
When to use it
- When building APIs that require protection against abuse and malicious attacks.
- During the development of authentication flows where limiting login attempts is crucial.
- To implement rate limits for password reset functionality to prevent misuse.
- When needing guidance on securing Express.js applications with rate limiting.
Key capabilities
- Provides code examples for implementing API rate limiting in Express.js.
- Demonstrates the use of
express-rate-limitand Redis for storing rate limit data. - Offers different rate limiting configurations based on endpoint sensitivity (general, authentication, password reset).
- Includes example logic to skip rate limiting for health check endpoints.
- Shows how to customize rate limits by combining IP address and email in the key generator for authentication.
Example prompts
- "Show me an example of implementing a general API rate limit using Express.js."
- "How can I rate limit login attempts with Express.js, considering both IP address and email?"
- "Give me code to set up a password reset rate limiter in my Express.js application."
Tips & gotchas
- Requires an active Redis server accessible via the
REDIS_URLenvironment variable. - The provided examples are specific to Express.js; adaptation may be needed for other frameworks.
- Consider carefully choosing appropriate rate limit values (
max) based on your application's needs and expected traffic.
Tags
TrustedSkills Verification
Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.
Security Audits
| Gen Agent Trust Hub | Pass |
| Socket | Pass |
| Snyk | Pass |
🌐 Community
Passed automated security scans.