laravel-api

Generate Laravel 12 API controllers with validation and resource responses.

Updated May 2, 2026
One-click install
npx skills add https://github.com/abdallhMoukdad/laravel-agent-skills --skill laravel-api-abdallhmoukdad
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-api
Source: https://github.com/abdallhMoukdad/laravel-agent-skills/tree/main/skills/laravel-api
Command: npx skills add https://github.com/abdallhMoukdad/laravel-agent-skills --skill laravel-api-abdallhmoukdad

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

This Skill streamlines the creation of API endpoints, validation, and response formatting in Laravel 12 applications, reducing boilerplate and ensuring consistency.

Core Features & Use Cases

  • Controller Automation: Generate crisp, thin controllers that delegate validation and business logic.
  • Validation Management: Extract validation rules into dedicated Form Request classes to enhance maintainability.
  • API Resource Wrapping: Wrap responses in a standard JSON format with optional conditional attributes.
  • Routing Conventions: Use apiResource for clean route definitions and consistent naming.
  • Use Case: Develop a secure, versioned API that conforms to REST principles, with proper response codes, pagination, and nested resource support.

Quick Start

Use the laravel-api skill to create a new API controller for managing blog posts.

Frequently Asked Questions about laravel-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure RESTful API controllers in Laravel 12 to reduce boilerplate?

Structure Laravel API controllers by generating thin controllers that delegate validation to Form Request classes and formatting to API Resources. This approach reduces boilerplate, enforces consistency, and ensures scalable API services.

What is the best way to register resource routes for a Laravel API?

The best way to register resource routes is using the apiResource method for clean route definitions. This ensures consistent naming conventions and properly maps standard RESTful endpoints for your API resources.

How do I extract validation rules into dedicated classes for Laravel API endpoints?

Extract validation rules by generating dedicated Form Request classes. This separates validation logic from controllers, enhances maintainability, and keeps your API endpoint logic clean and structured.

Can I wrap Laravel API responses in a standard JSON format with conditional attributes?

Yes, you can wrap API responses in a standard JSON format using API Resources. This allows optional conditional attributes to be included, ensuring consistent response structures across your scalable API.

Does Laravel 12 support route model binding for secure API endpoint development?

Laravel 12 supports route model binding for API development. This enforces best practices by automatically injecting models into controllers, securing endpoints, and simplifying resource handling.

What HTTP status code conventions should I use for Laravel API resource responses?

Use standard HTTP status code conventions when returning API resource responses. Enforcing these conventions ensures your RESTful API conforms to principles, providing proper response codes for scalable services.