Install
$ agentstack add skill-me-shaon-agent-skills-api-hardening-patterns ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
API Hardening Patterns
When to use
Use this skill when building or reviewing Laravel APIs that need stronger security, safer defaults, and better abuse resistance. It is most useful for public APIs, partner integrations, mobile backends, webhook endpoints, or any route group under routes/api.php.
Input parameters
- API routes, controllers, request classes, and policies to inspect.
- Authentication model such as Sanctum, Passport, or token-based custom auth.
- Known abuse cases, compliance requirements, or public endpoint exposure.
- Desired response format and error handling conventions.
- Whether the API uses resources, spatie/laravel-query-builder, file uploads, signed URLs, or webhooks.
Procedure
- Inspect the API surface from
routes/api.php, route groups, middleware, controllers, form requests, resources, policies, guards, and exception handling. Note which endpoints are public, authenticated, tenant-scoped, admin-only, or webhook-driven. - Check validation and authorization in Laravel-native locations first. Prefer
FormRequestclasses, policy methods, gates, route model binding constraints, signed routes, and explicit authorization checks over ad-hoc controller logic. - Focus on common Laravel API risks: inline validation, mass-assignment exposure, unsafe
$fillableor$guarded, over-broad API resources, user-controlled filters and sorts, weak pagination defaults, unconstrained uploads, and inconsistent exception rendering. - Review abuse controls and data exposure. Check throttling, token issuance, pagination caps, webhook signature verification, replay protection, rate-limited jobs, and whether hidden or sensitive attributes leak through serialization or
toArray(). - If the API uses Sanctum or Passport, review token ability checks, stateful vs stateless assumptions, CSRF/session crossover risks, and revocation or rotation handling. If it handles webhooks, explicitly review signature verification and idempotency.
- Return findings under
Critical issues,Hardening improvements, andTests to add. Point each recommendation to the Laravel file or layer where the fix belongs, and prefer concrete changes such asFormRequest, policy, middleware, resource, cast, or hidden-attribute updates. - Keep the answer practical and prioritized. Do not give generic API security advice that is not tied to the actual Laravel implementation.
Output expectations: return prioritized Laravel-specific issues first, then concrete fixes and tests to add, not a generic API security checklist.
Examples
Prompt 1:
Use api-hardening-patterns on our public Laravel API. Focus on validation, authorization, throttling, and resource/data exposure.
Prompt 2:
Review these Sanctum-protected endpoints for abuse resistance and safer error handling. Suggest concrete Laravel fixes, not just generic advice.
JSON:
{
"skill": "api-hardening-patterns",
"context": {
"auth": "sanctum",
"exposure": "public",
"focus": ["validation", "authorization", "rate_limiting", "error_contracts"],
"files": ["routes/api.php", "app/Http/Controllers/Api", "app/Http/Requests"],
"concerns": ["resource_exposure", "pagination_limits", "token_abilities"]
}
}
Code example:
public function store(StorePostRequest $request): PostResource
{
$this->authorize('create', Post::class);
return new PostResource(Post::create($request->validated()));
}
Smoke test
Run the skill on a Laravel API controller with inline validation, missing policy checks, unsafe resource serialization, and unlimited pagination. Verify that the response returns concrete Laravel fixes such as FormRequest, policy, middleware, resource, or model-visibility changes instead of generic security advice.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: me-shaon
- Source: me-shaon/agent-skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.