security
Implements security features following OWASP guidelines. Use when validating input, preventing XSS, adding rate limiting, verifying auth, or handling file uploads. Includes security-utils, sanitize-utils, and rate-limiter patterns.
When & Why to Use This Skill
This Claude skill provides a comprehensive suite of security tools and patterns based on OWASP guidelines. It enables developers to implement robust input validation, XSS protection, rate limiting, and authentication verification, ensuring applications are resilient against common web vulnerabilities and follow industry-standard security protocols.
Use Cases
- Input Validation: Automatically validate strings and content limits to prevent injection attacks and ensure data integrity across the application.
- XSS Prevention: Securely render user-generated content using specialized components like SafeMarkdown to mitigate cross-site scripting risks.
- API Rate Limiting: Protect endpoints from brute-force attacks and resource exhaustion by implementing configurable rate-limiting patterns.
- Authentication & Authorization: Streamline identity verification and ownership checks for protected routes and sensitive write operations.
| name | security |
|---|---|
| description | Implements security features following OWASP guidelines. Use when validating input, preventing XSS, adding rate limiting, verifying auth, or handling file uploads. Includes security-utils, sanitize-utils, and rate-limiter patterns. |
Security Skill
Instructions
- Validate all input with
security-utils.ts - Sanitize user content with
SafeMarkdownorsanitizePlainText - Rate limit all API endpoints
- Verify auth for protected routes
- Check ownership for write operations
Quick Reference
// Input validation
import { validateString, CONTENT_LIMITS } from '@/lib/security-utils'
const result = validateString(input, 'fieldName', { required: true, maxLength: 100 })
// XSS prevention
import SafeMarkdown from '@/components/SafeMarkdown'
<SafeMarkdown>{userContent}</SafeMarkdown>
// Rate limiting
import { checkRateLimit, RATE_LIMIT_CONFIGS } from '@/lib/rate-limiter'
const { allowed } = checkRateLimit(clientId, RATE_LIMIT_CONFIGS.AUTHENTICATED_WRITE)
// Auth
import { verifyAuth } from '@/lib/auth-utils'
const authUser = await verifyAuth(request)
For complete validation patterns, file upload security, and OWASP coverage, see reference.md.