Skip to content

Laravel API Builder

Verified

Builds Laravel REST APIs with Eloquent models, Form Requests, API Resources, and Sanctum or Passport authentication.

By Anthropic 5,200 v1.1.0 Updated 2026-03-10

Install

Claude Code

Copy the SKILL.md file to your project's .claude/skills/ directory

About This Skill

Laravel API Builder generates idiomatic Laravel REST APIs following Laravel's conventions and the "happy path" approach that makes the framework so productive. It covers the complete API development workflow.

Generated Components

Models and Migrations - Eloquent models with `$fillable`, `$casts`, and relationship methods - Database migrations with proper column types and indexes - Model factories for testing and seeding - Query scopes for common filtering patterns

Request Handling - **Form Requests** (`App\Http\Requests\`) with validation rules and authorization - Custom validation rules for business logic - Request data transformation before validation

API Resources - `JsonResource` and `ResourceCollection` classes for response shaping - Conditional attribute loading based on relationships loaded - Pagination meta integration

Routes and Controllers - RESTful resource controllers using `Route::apiResource()` - Nested resource routing for related models - Route model binding for automatic model resolution

Authentication - Laravel Sanctum SPA authentication - API token generation and management - Middleware groups for API protection

Testing - Feature tests using `RefreshDatabase` trait - HTTP assertion helpers (`assertJson`, `assertStatus`) - Test data factories chained with `->create()`

Use Cases

  • Building Laravel REST APIs for mobile and SPA frontends
  • Implementing token-based authentication with Laravel Sanctum
  • Generating Eloquent models with relationships and scopes
  • Creating API Resources for consistent JSON response transformation

Pros & Cons

Pros

  • + Generates idiomatic Laravel code following official conventions
  • + Sanctum authentication setup included and ready to use
  • + Form Request validation keeps controllers clean
  • + Model factories simplify test data setup

Cons

  • - Generated code assumes Laravel 10+ — older versions may need adjustments
  • - PHP ecosystem familiarity required to fully leverage generated patterns

Related AI Tools

Related Skills

Stay Updated on Agent Skills

Get weekly curated skills + safety alerts

每周精选 Skills + 安全预警