Source profileQuality 91/100

event4u-app/agent-config/src/skills/laravel-api-endpoint/SKILL.md

laravel-api-endpoint

Use when creating a new Laravel API endpoint — Controller, FormRequest, Resource, route, Policy, OpenAPI annotations — versioned route layout, single-action `__invoke` controllers.

Source repository stars
7
Declared platforms
0
Static risk flags
0
Last source update
2026-08-04
Source checked
2026-08-04

Decision brief

What it does—and where it fits

Use when creating a new Laravel API endpoint — Controller, FormRequest, Resource, route, Policy, OpenAPI annotations — versioned route layout, single-action `__invoke` controllers.

Best for

  • Modifying existing endpoints — use the code-refactoring skill.
  • API design decisions — use api-design.
  • The project is Symfony / Next.js / FastAPI / etc. — go back to api-endpoint and pick the right carve-out.

Not for

  • Tasks that require unconfirmed production actions or broad system permissions.
  • Environments where the pinned source and install steps cannot be inspected.

Compatibility matrix

Platform support, with evidence labels

PlatformStatusEvidenceWhat to check
CodexNot declaredNo explicit evidencePortability before use
Claude CodeNot declaredNo explicit evidencePortability before use
CursorNot declaredNo explicit evidencePortability before use
Gemini CLINot declaredNo explicit evidencePortability before use
Open the compatibility checker

Installation

Inspect first. Install second.

The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

Source-detected install commandSource
npx skills add https://github.com/event4u-app/agent-config --skill "src/skills/laravel-api-endpoint"
Safe inspection promptEditorial

Inspect the Agent Skill "laravel-api-endpoint" from https://github.com/event4u-app/agent-config/blob/798a65522c7a73b90526641d6d1589fe0937cb5f/src/skills/laravel-api-endpoint/SKILL.md at commit 798a65522c7a73b90526641d6d1589fe0937cb5f. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

Workflow

What the source asks the agent to do

  1. 01

    Procedure: Create a Laravel API endpoint

    1. Read project docs — Check ./agents/ and AGENTS.md for controller conventions, resource patterns, routing. 2. Create route — Add to the correct routes/api.php or module route file (routes/api/v{N}/{domain}.php). 3. Create controller — Single-action invokable controller, thin,…

    Read project docs — Check ./agents/ and AGENTS.md for controller conventions, resource patterns, routing.Create route — Add to the correct routes/api.php or module route file (routes/api/v{N}/{domain}.php).Create controller — Single-action invokable controller, thin, delegate logic to a service.
  2. 02

    When to use

    Use this skill when the project is Laravel (detected via artisan + composer.json with laravel/framework) and the user asks to create a new API endpoint, REST route, or controller action.

    Modifying existing endpoints — use the code-refactoring skill.API design decisions — use api-design.The project is Symfony / Next.js / FastAPI / etc. — go back to api-endpoint and pick the right carve-out.
  3. 03

    What to generate

    1. Controller — Single Action (invokable). Read agents/reference/docs/controller.md and ../../../docs/guidelines/php/controllers.md. 2. FormRequest — Validation rules, authorize() via policies. Read ../../../docs/guidelines/php/validations.md. 3. Resource — JSON response transfo…

    Controller — Single Action (invokable). Read agents/reference/docs/controller.md and ../../../docs/guidelines/php/controllers.md.FormRequest — Validation rules, authorize() via policies. Read ../../../docs/guidelines/php/validations.md.Resource — JSON response transformation. Read agents/reference/docs/api-resources.md.
  4. 04

    Conventions

    Controllers are thin — delegate to Services.

    Controllers are thin — delegate to Services.Every controller MUST return an API Resource — never raw arrays, models, or response()-json().Controllers type-hint the return value as the Resource class (e.g. ): ProjectResource).
  5. 05

    Show endpoint example

    Review the “Show endpoint example” section in the pinned source before continuing.

    Review and apply the “Show endpoint example” source section.

Permission review

Static risk signals and limitations

No configured static risk pattern was detected

This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.

Evidence record

Why each signal appears

EvidenceSourceComputedTestedEditorial
SignalValueEvidence typeMeaning
Quality score91/100ComputedDocumentation, specificity, maintenance, and trust rules
Repository stars7SourceRepository attention, not individual Skill quality
Compatibility0 platformsSourceDeclared in the catalog source record
Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

Pinned source

Provenance and original SKILL.md

Repository
event4u-app/agent-config
Skill path
src/skills/laravel-api-endpoint/SKILL.md
Commit
798a65522c7a73b90526641d6d1589fe0937cb5f
License
MIT
Collected
2026-08-04
Default branch
main
View the original SKILL.md

laravel-api-endpoint

When to use

Use this skill when the project is Laravel (detected via artisan + composer.json with laravel/framework) and the user asks to create a new API endpoint, REST route, or controller action.

Routed in from api-endpoint once the stack is detected as Laravel.

Do NOT use when:

  • Modifying existing endpoints — use the code-refactoring skill.
  • API design decisions — use api-design.
  • The project is Symfony / Next.js / FastAPI / etc. — go back to api-endpoint and pick the right carve-out.

Procedure: Create a Laravel API endpoint

  1. Read project docs — Check ./agents/ and AGENTS.md for controller conventions, resource patterns, routing.
  2. Create route — Add to the correct routes/api.php or module route file (routes/api/v{N}/{domain}.php).
  3. Create controller — Single-action invokable controller, thin, delegate logic to a service.
  4. Create FormRequest — Validate all input at the boundary; authorize via Policy in authorize().
  5. Create Resource — Transform model output via API Resource (never raw arrays / models / response()->json()).
  6. Create Policy — If authorization is needed and no Policy exists yet.
  7. Verify — Run PHPStan, run tests, confirm response shape matches conventions.

What to generate

  1. Controller — Single Action (invokable). Read agents/reference/docs/controller.md and ../../../docs/guidelines/php/controllers.md.
  2. FormRequest — Validation rules, authorize() via policies. Read ../../../docs/guidelines/php/validations.md.
  3. Resource — JSON response transformation. Read agents/reference/docs/api-resources.md.
  4. Route — Add to the correct versioned route file.
  5. Policy — If authorization is needed.
  6. Filter classes — If it's a list endpoint with filtering. Read agents/reference/docs/query-filter.md (if it exists).

Conventions

  • Controllers are thin — delegate to Services.
  • Every controller MUST return an API Resource — never raw arrays, models, or response()->json().
  • Controllers type-hint the return value as the Resource class (e.g. ): ProjectResource).
  • Use Resource::make() for single items, Resource::collection() for lists.
  • Use method injection on __invoke() for new controllers.
  • Use DTOs for data transfer between layers.

Show endpoint example

declare(strict_types=1);

namespace App\Http\Controllers\v1\Project;

use App\Http\Controllers\Controller;
use App\Http\Requests\v1\Projects\ShowProjectRequest;
use App\Http\Resources\v1\Project\ProjectResource;
use App\Models\ExternalCustomerDatabase\Project\Project;
use App\OpenApi\Schema\Request\ShowResourceRequestSchema;
use App\OpenApi\Schema\Response\ResourceNotFoundResponse;
use App\OpenApi\Schema\Response\ShowResourceResponseSchema;

class ShowProjectController extends Controller
{
    #[ShowResourceRequestSchema(path: '/projects/{id}', version: '1', resource: ProjectResource::class)]
    #[ShowResourceResponseSchema(ProjectResource::class, wrapInDataObject: false)]
    #[ResourceNotFoundResponse(ProjectResource::class)]
    public function __invoke(ShowProjectRequest $request, Project $project): ProjectResource
    {
        return ProjectResource::make($project);
    }
}

Create endpoint with service injection

class CreateCustomerController extends Controller
{
    #[CreateCustomerRequestSchema(path: '/customers', version: '1', resource: CustomerResource::class)]
    #[CreateResourceResponseSchema(resource: CreatedCustomerResource::class, wrapInDataObject: false)]
    #[ValidationErrorResponse]
    public function __invoke(
        CreateCustomerRequest $request,
        CustomerModelService $customerService,
    ): CustomerResource {
        $result = $customerService->create(CreateCustomerDTO::fromRequest($request));

        return CreatedCustomerResource::make($result);
    }
}

FormRequest example

declare(strict_types=1);

namespace App\Http\Requests\v1\Projects;

use Illuminate\Foundation\Http\FormRequest;

class ShowProjectRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user()->can('view', $this->route('project'));
    }

    /** @return array<string, mixed> */
    public function rules(): array
    {
        return [];
    }
}

List endpoint with CollectionFormRequest

For list endpoints, extend CollectionFormRequest which provides perPage, page, and orderBy rules:

use App\Contracts\Http\Requests\CollectionFormRequest;

class ListProjectsRequest extends CollectionFormRequest
{
    public string $model = Project::class;

    /** @return array<string, mixed> */
    public function rules(): array
    {
        return [
            ...parent::rules(),
            'status' => ['sometimes', 'string'],
        ];
    }
}

File locations

ComponentPath
Controllerapp/Http/Controllers/v{N}/{Domain}/{Action}{Entity}Controller.php
FormRequestapp/Http/Requests/v{N}/{Domain}/{Action}{Entity}Request.php
Resourceapp/Http/Resources/v{N}/{Domain}/{Entity}Resource.php
Routeroutes/api/v{N}/{domain}.php
Policyapp/Policies/{Entity}Policy.php

OpenAPI documentation

Controllers use PHP 8 attributes for OpenAPI spec generation from App\OpenApi\Schema\:

  • ShowResourceRequestSchema, ListResourceRequestSchema, CreateResourceRequestSchema
  • ShowResourceResponseSchema, ListResourceResponseSchema, CreateResourceResponseSchema
  • ResourceNotFoundResponse, ValidationErrorResponse

Output format

  1. Generated files — controller, route registration, FormRequest, Resource, Policy.
  2. Test file with happy path and validation error cases.
  3. Summary of created files and their locations.

Gotcha

  • Don't forget to register the route — creating the controller without the route is a common miss.
  • Always check if a similar endpoint already exists — duplicates cause confusion.
  • FormRequest validation rules must match the OpenAPI schema — keep them in sync.
  • The model tends to forget the return type on Resource toArray() methods.

Do NOT

  • Do NOT put business logic in controllers — delegate to services.
  • Do NOT skip FormRequest validation — every controller needs a FormRequest.
  • Do NOT return raw Eloquent models — always use API Resources.
  • Do NOT create routes without proper authorization (Policy in FormRequest or middleware).
  • Do NOT create multi-action controllers — only single-action with __invoke().
  • Do NOT use response()->json() — use Resource::make().

Auto-trigger keywords

  • laravel endpoint
  • laravel controller
  • form request
  • API resource
  • laravel api route

Alternatives

Compare before choosing

Computed 9810,895

huggingface/skills

huggingface-zerogpu

AI demos and GPU compute with Gradio Spaces and Hugging Face Spaces ZeroGPU. Use when writing or reviewing code that uses `@spaces.GPU`, configuring `python_version` or `requirements.txt` for a ZeroGPU Space, or handling ZeroGPU-specific code constraints — pickle-based process isolation, `gr.State` semantics across the worker boundary, no `torch.compile` (use AoTI instead), CUDA wheel-only builds (no `nvcc` at build or runtime), large vs xlarge sizing, and dynamic duration callables. Make sure t

Computed 9732,606

K-Dense-AI/scientific-agent-skills

esm

Use when working directly with the `esm` Python SDK, ESM3 or ESMC model IDs, Forge/Biohub inference clients, or ESMFold2 folding workflows.

Computed 977

event4u-app/agent-config

project-analyzer

ONLY when user asks for single-pass tech-stack detection or `agents/evidence/analysis/` write-up. Deep multi-pass audit → `universal-project-analysis`. Raw primitives → `project-analysis-core`.

Computed 976

mgiovani/cc-arsenal

team-review

Multi-agent review team: architecture, security, performance, testing, style, docs/UX, plus an adversary that cross-examines the other 6, for security-sensitive, architectural, or large PRs (15+ files) where a single-agent pass risks missing cross-cutting issues. Use for auth/payments/PII changes, schema/pattern changes, compliance sign-off, or when asked to 'get the review team on this' / 'multi-agent review' / 'thorough review before merge'. For a standard PR or a quick pre-merge check, use /r