About laravel:rate-limiting
A Laravel development skill for protecting endpoints with rate limits while keeping client behavior predictable. It describes user- or IP-based limits, standard response headers, retry guidance for 429 responses, and separate limiters for bursty endpoints.
Key features
- 01Limit requests by user or IP
- 02Communicate limits with standard headers
- 03Include retry hints in 429 responses
- 04Use separate limiters for bursty endpoints
Use cases
- 01Applying per-user limits to authenticated API requests
- 02Applying IP-based limits when a user is unauthenticated
- 03Configuring separate limits for bursty routes
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ jpcaparas/ superpowers-laravel --skill laravel:rate-limitingAfter installing, type/laravel:rate-limitingin Claude Code to confirm it loaded.
Details
From the project READMERate Limiting and Throttle
Protect endpoints from abuse while keeping UX predictable.
Commands
// App\Providers\RouteServiceProvider
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
});
// routes/api.php
Route::middleware(['throttle:api'])->group(function () {
// ...
});
Patterns
- Scope limits by user when authenticated; fall back to IP
- Communicate limits to clients via standard headers
- Provide sensible 429 responses with retry hints
- Separate bursty endpoints into specialized limiters
Comments
Markdown supported