Back to Skills

laravel-security

Laravel security best practices for authn/authz, validation, CSRF, mass assignment, file uploads, secrets, rate limiting, and secure deployment.

179,595stars27,697forksUpdated 5/12/2026

Security Assessment

Safe(100/100)
Security Score100/100

About laravel-security

The laravel-security skill provides comprehensive guidance on securing Laravel applications against common vulnerabilities. It focuses on critical aspects such as authentication and authorization, input validation, CSRF protection, mass assignment, file uploads, secrets management, rate limiting, and secure deployment practices. By implementing these best practices, developers can significantly reduce the risk of security breaches, data leaks, and unauthorized access, ensuring that applications remain resilient against attacks and comply with standard security guidelines.

This skill encompasses several key features and capabilities. It leverages middleware to enforce baseline protections like CSRF tokens and security headers, while guards and policies handle fine-grained access control. Form Requests validate and sanitize input before it reaches business logic, and rate limiting mechanisms help prevent abuse. Sensitive data is protected through encrypted casts, mass-assignment guards, signed routes, and secure session and cookie configurations. Additionally, it provides guidance on password hashing, token management, SQL injection prevention, XSS mitigation, and safe file upload practices. All these measures collectively form a robust security framework within Laravel applications.

The laravel-security skill is ideal for developers building new Laravel projects or enhancing the security of existing applications. It is particularly relevant for teams handling sensitive user data, developing API endpoints, or managing authentication flows. By following these practices, developers can confidently deploy applications in production environments with hardened security configurations. This skill is suitable for both individual developers and enterprise teams looking to enforce standardized security measures in their Laravel applications.

FAQ

When should I activate laravel-security in my project?

Activate laravel-security when adding authentication or authorization, handling user input and file uploads, building new API endpoints, managing secrets, or hardening production deployments.

Which Laravel features does this skill utilize for security?

It uses middleware for CSRF and security headers, guards and policies for access control, Form Requests for input validation, rate limiting, encrypted casts, mass-assignment guards, and signed routes.

Is laravel-security compatible with both API and web applications?

Yes, it provides guidance for securing both web applications and API endpoints, including token-based authentication with Sanctum or Passport.

Does this skill handle password and token security?

Yes, it covers hashing passwords using Laravel's Hash facade, using short-lived tokens, implementing refresh flows, and revoking tokens when necessary.

Are there any special configuration requirements for production?

Yes, it recommends setting APP_DEBUG=false, configuring APP_KEY properly, enabling secure cookies, setting SameSite attributes, and configuring trusted proxies for HTTPS detection.

Install laravel-security

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill