laravel-auth
Use when implementing user authentication, API tokens, social login, or authorization. Covers Sanctum, Passport, Socialite, Fortify, policies, and gates for Laravel 13.
What this skill does
# Laravel Authentication & Authorization
## Agent Workflow (MANDATORY)
Before ANY implementation, use `TeamCreate` to spawn 3 agents:
1. **fuse-ai-pilot:explore-codebase** - Check existing auth setup, guards, policies
2. **fuse-ai-pilot:research-expert** - Verify latest Laravel 13 auth docs via Context7
3. **mcp__context7__query-docs** - Query specific patterns (Sanctum, Passport, etc.)
After implementation, run **fuse-ai-pilot:sniper** for validation.
---
## Overview
Laravel provides a complete authentication and authorization ecosystem. Choose based on your needs:
| Package | Best For | Complexity |
|---------|----------|------------|
| **Starter Kits** | New projects, quick setup | Low |
| **Sanctum** | API tokens, SPA auth | Low |
| **Fortify** | Custom UI, headless backend | Medium |
| **Passport** | OAuth2 server, third-party access | High |
| **Socialite** | Social login (Google, GitHub) | Low |
---
## Critical Rules
1. **Use policies for model authorization** - Not inline `if` checks
2. **Always hash passwords** - `Hash::make()` or `'hashed'` cast
3. **Regenerate session after login** - Prevents fixation attacks
4. **Use HTTPS in production** - Required for secure cookies
5. **Define token abilities** - Principle of least privilege
---
## Architecture
```
app/
├── Http/
│ ├── Controllers/
│ │ └── Auth/ ← Auth controllers (if manual)
│ └── Middleware/
│ └── Authenticate.php ← Redirects unauthenticated
├── Models/
│ └── User.php ← HasApiTokens trait (Sanctum)
├── Policies/ ← Authorization policies
│ └── PostPolicy.php
├── Providers/
│ └── AppServiceProvider.php ← Gate definitions
└── Actions/
└── Fortify/ ← Fortify actions (if used)
├── CreateNewUser.php
└── ResetUserPassword.php
config/
├── auth.php ← Guards & providers
├── sanctum.php ← API token config
└── fortify.php ← Fortify features
```
---
## FuseCore Integration
When working in a **FuseCore project**, authentication follows the modular structure:
```
FuseCore/
├── Core/ # Infrastructure (priority 0)
│ └── App/Contracts/
│ └── AuthServiceInterface.php ← Auth contract
│
├── User/ # Auth module (existing)
│ ├── App/
│ │ ├── Models/User.php ← HasApiTokens trait
│ │ ├── Http/
│ │ │ ├── Controllers/
│ │ │ │ ├── AuthController.php
│ │ │ │ └── TokenController.php
│ │ │ ├── Requests/
│ │ │ │ ├── LoginRequest.php
│ │ │ │ └── RegisterRequest.php
│ │ │ └── Resources/UserResource.php
│ │ ├── Policies/UserPolicy.php
│ │ └── Services/AuthService.php
│ ├── Config/
│ │ └── sanctum.php ← Sanctum config (module-level)
│ ├── Database/Migrations/
│ ├── Routes/api.php ← Auth routes
│ └── module.json # dependencies: []
│
└── {YourModule}/ # Depends on User module
├── App/Policies/ ← Module-specific policies
└── module.json # dependencies: ["User"]
```
### FuseCore Auth Checklist
- [ ] Auth code in `/FuseCore/User/` module
- [ ] Policies in module's `/App/Policies/`
- [ ] Auth routes in `/FuseCore/User/Routes/api.php`
- [ ] Sanctum config in `/FuseCore/User/Config/sanctum.php`
- [ ] Declare `"User"` dependency in other modules' `module.json`
- [ ] Use `auth:sanctum` middleware in module routes
### Cross-Module Authorization
```php
// In FuseCore/{Module}/Routes/api.php
Route::middleware(['api', 'auth:sanctum'])->group(function () {
Route::apiResource('posts', PostController::class);
});
// In FuseCore/{Module}/App/Http/Controllers/PostController.php
public function update(UpdatePostRequest $request, Post $post)
{
$this->authorize('update', $post); // Uses PostPolicy
// ...
}
```
→ See [fusecore skill](../fusecore/SKILL.md) for complete module patterns.
---
## Decision Guide
### Authentication Method
```
Need auth scaffolding? → Starter Kit
├── Yes → Use React/Vue/Livewire starter kit
└── No → Building custom frontend?
├── Yes → Use Fortify (headless)
└── No → API only?
├── Yes → Sanctum (tokens)
└── No → Session-based
```
### Token Type
```
Third-party apps need access? → Passport (OAuth2)
├── No → Mobile app?
│ ├── Yes → Sanctum API tokens
│ └── No → SPA on same domain?
│ ├── Yes → Sanctum SPA auth (cookies)
│ └── No → Sanctum API tokens
```
---
## Key Concepts
| Concept | Description | Reference |
|---------|-------------|-----------|
| **Guards** | Define HOW users authenticate (session, token) | [authentication.md](references/authentication.md) |
| **Providers** | Define WHERE users are retrieved from (database) | [authentication.md](references/authentication.md) |
| **Gates** | Closure-based authorization for simple checks | [authorization.md](references/authorization.md) |
| **Policies** | Class-based authorization tied to models | [authorization.md](references/authorization.md) |
| **Abilities** | Token permissions (Sanctum/Passport scopes) | [sanctum.md](references/sanctum.md) |
---
## Reference Guide
### Concepts (WHY & Architecture)
| Topic | Reference | When to Consult |
|-------|-----------|-----------------|
| **Authentication** | [authentication.md](references/authentication.md) | Guards, providers, login flow |
| **Authorization** | [authorization.md](references/authorization.md) | Gates vs policies, access control |
| **Sanctum** | [sanctum.md](references/sanctum.md) | API tokens, SPA authentication |
| **Passport** | [passport.md](references/passport.md) | OAuth2 server, third-party access |
| **Fortify** | [fortify.md](references/fortify.md) | Headless auth, 2FA |
| **Socialite** | [socialite.md](references/socialite.md) | Social login providers |
| **Starter Kits** | [starter-kits.md](references/starter-kits.md) | Auth scaffolding |
| **Email Verification** | [verification.md](references/verification.md) | MustVerifyEmail, verified middleware |
| **Password Reset** | [passwords.md](references/passwords.md) | Forgot password flow |
| **Session** | [session.md](references/session.md) | Session drivers, flash data |
| **CSRF** | [csrf.md](references/csrf.md) | Form protection, AJAX tokens |
| **Encryption** | [encryption.md](references/encryption.md) | Data encryption (not passwords) |
| **Hashing** | [hashing.md](references/hashing.md) | Password hashing |
### Templates (Complete Code)
| Template | When to Use |
|----------|-------------|
| [LoginController.php.md](references/templates/LoginController.php.md) | Manual authentication controllers |
| [GatesAndPolicies.php.md](references/templates/GatesAndPolicies.php.md) | Gates and policy examples |
| [PostPolicy.php.md](references/templates/PostPolicy.php.md) | Complete policy class with before filter |
| [sanctum-setup.md](references/templates/sanctum-setup.md) | Sanctum configuration + testing |
| [PassportSetup.php.md](references/templates/PassportSetup.php.md) | OAuth2 server setup |
| [FortifySetup.php.md](references/templates/FortifySetup.php.md) | Fortify configuration + 2FA |
| [SocialiteController.php.md](references/templates/SocialiteController.php.md) | Social login + testing |
| [PasswordResetController.php.md](references/templates/PasswordResetController.php.md) | Password reset flow |
---
## Best Practices
### DO
- Use starter kits for new projects
- Define policies for all models
- Set token expiration
- Rate limit login attempts
- Use `verified` middleware for sensitive actions
- Prune expired tokens regularly
### DON'T
- Store plain text passwords
- Skip session regeneration on login
- Use Passport when Sanctum suffices
- Forget to prune expired tokens
- Ignore HTTPS in production
- Put authorization logic in controllers
---
## Laravel 13 Notes
### PreventRequestForgery (ex-VerifyCsrfToken)
Laravel 13 renomme `VerifyCsrfToken` en `PreventRequestForgery`. Le middleware utilise une véRelated in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.