laravel-specialist — скилл для Claude Code: что делает
Настраивает агента на разработку бэкенда на Laravel 10+ и PHP 8.2+. Помогает писать модели Eloquent, очереди Horizon, API resources и тесты Pest.
npx skills add Jeffallan/claude-skills --skill laravel-specialist -a claude-codeЧто делает laravel-specialist
Скилл задаёт строгий рабочий процесс для проектов на Laravel 10+ и PHP 8.2+. Ассистент генерирует строгую типизацию параметров, применяет readonly-свойства, перечисления enums и соблюдает стандарт PSR-12. Правила запрещают сырые SQL-запросы без экранирования, перемещение бизнес-логики в контроллеры и пропуск жадной загрузки связей.
Внутри заложены шаблоны для моделей Eloquent с приведением типов к enum, миграций схемы базы данных, ресурсов API и задач в очередь с настроенным числом попыток. Для верификации скилл заставляет запускать консольные команды php artisan route:list, php artisan migrate:status и требует завершать задачи прогоном тестов через php artisan test с планкой покрытия выше 85%.
Этот скилл сломается на проектах с версией PHP ниже 8.2, поскольку его шаблоны неотделимы от строгих типов и синтаксиса свежих версий языка.
Какие задачи решает
- спроектировать модели Eloquent с enum-кастами и связями
- настроить очереди задач для Horizon с обработкой сбоев
- преобразовать ответы контроллеров в API resources
- написать функциональные тесты на Pest с фабриками
Примеры запросов агенту
- Создай модель Post со связями author и comments, кастом статуса через enum и мягким удалением
- Напиши джобу PublishPost для очереди с тремя попытками и задержкой 60 секунд
- Сделай API resource для постов, чтобы подгружать автора только при его наличии
Как установить laravel-specialist
1Через Skills CLI (Vercel)
npx skills add Jeffallan/claude-skills --skill laravel-specialist -a claude-code2Вручную: положить файлы
~/.claude/skills/laravel-specialist/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/laravel-specialist/
1Через Skills CLI (Vercel)
npx skills add Jeffallan/claude-skills --skill laravel-specialist -a codex2Вручную: положить файлы
.agents/skills/laravel-specialist/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add Jeffallan/claude-skills --skill laravel-specialist -a cursor2Вручную: положить файлы
.cursor/skills/laravel-specialist/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install Jeffallan/claude-skills laravel-specialist2Вручную: положить файлы
.github/skills/laravel-specialist/SKILL.md1Через Skills CLI (Vercel)
npx skills add Jeffallan/claude-skills --skill laravel-specialist -a gemini-cli2Командой платформы
gemini skills install https://github.com/Jeffallan/claude-skills --path skills/laravel-specialistВручную: положить файлы
.devin/skills/laravel-specialist/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add Jeffallan/claude-skills --skill laravel-specialist -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
Из того же набора5
Весь набор →Похожие
Вопросы о laravel-specialist
Как установить laravel-specialist в Claude Code?
Выполните в терминале команду npx skills add Jeffallan/claude-skills --skill laravel-specialist -a claude-code.
Что делает скилл laravel-specialist?
Он ведёт ИИ через этапы проектирования моделей, очередей, маршрутов и Livewire-компонентов в Laravel 10+. Скилл следит за оптимизацией запросов Eloquent и предотвращает проблему N+1.
Какие технические требования предъявляет скилл к коду?
Код должен использовать возможности PHP 8.2+, строгие подсказки типов для всех методов, стандарт PSR-12 и стремиться к покрытию тестами более 85%.
Исходный текст
SKILL.md · MIT
---
name: laravel-specialist
description: Build and configure Laravel 10+ applications, including creating Eloquent models and relationships, implementing Sanctum authentication, configuring Horizon queues, designing RESTful APIs with API resources, and building reactive interfaces with Livewire. Use when creating Laravel models, setting up queue workers, implementing Sanctum auth flows, building Livewire components, optimising Eloquent queries, or writing Pest/PHPUnit tests for Laravel features.
license: MIT
metadata:
author: https://github.com/Jeffallan
company: https://synergetic.solutions
version: "1.1.0"
domain: backend
triggers: Laravel, Eloquent, PHP framework, Laravel API, Artisan, Blade templates, Laravel queues, Livewire, Laravel testing, Sanctum, Horizon
role: specialist
scope: implementation
output-format: code
related-skills: fullstack-guardian, test-master, devops-engineer, security-reviewer
---
# Laravel Specialist
Senior Laravel specialist with deep expertise in Laravel 10+, Eloquent ORM, and modern PHP 8.2+ development.
## Core Workflow
1. **Analyse requirements** — Identify models, relationships, APIs, and queue needs
2. **Design architecture** — Plan database schema, service layers, and job queues
3. **Implement models** — Create Eloquent models with relationships, scopes, and casts; run `php artisan make:model` and verify with `php artisan migrate:status`
4. **Build features** — Develop controllers, services, API resources, and jobs; run `php artisan route:list` to verify routing
5. **Test thoroughly** — Write feature and unit tests; run `php artisan test` before considering any step complete (target >85% coverage)
## Reference Guide
Load detailed guidance based on context:
| Topic | Reference | Load When |
|-------|-----------|-----------|
| Eloquent ORM | `references/eloquent.md` | Models, relationships, scopes, query optimization |
| Routing & APIs | `references/routing.md` | Routes, controllers, middleware, API resources |
| Queue System | `references/queues.md` | Jobs, workers, Horizon, failed jobs, batching |
| Livewire | `references/livewire.md` | Components, wire:model, actions, real-time |
| Testing | `references/testing.md` | Feature tests, factories, mocking, Pest PHP |
## Constraints
### MUST DO
- Use PHP 8.2+ features (readonly, enums, typed properties)
- Type hint all method parameters and return types
- Use Eloquent relationships properly (avoid N+1 with eager loading)
- Implement API resources for transforming data
- Queue long-running tasks
- Write comprehensive tests (>85% coverage)
- Use service containers and dependency injection
- Follow PSR-12 coding standards
### MUST NOT DO
- Use raw queries without protection (SQL injection)
- Skip eager loading (causes N+1 problems)
- Store sensitive data unencrypted
- Mix business logic in controllers
- Hardcode configuration values
- Skip validation on user input
- Use deprecated Laravel features
- Ignore queue failures
## Code Templates
Use these as starting points for every implementation.
### Eloquent Model
```php
<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
final class Post extends Model
{
use HasFactory, SoftDeletes;
protected $fillable = ['title', 'body', 'status', 'user_id'];
protected $casts = [
'status' => PostStatus::class, // backed enum
'published_at' => 'immutable_datetime',
];
// Relationships — always eager-load via ::with() at call site
public function author(): BelongsTo
{
return $this->belongsTo(User::class, 'user_id');
}
public function comments(): HasMany
{
return $this->hasMany(Comment::class);
}
// Local scope
public function scopePublished(Builder $query): Builder
{
return $query->where('status', PostStatus::Published);
}
}
```
### Migration
```php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('posts', function (Blueprint $table): void {
$table->id();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->string('title');
$table->text('body');
$table->string('status')->default('draft');
$table->timestamp('published_at')->nullable();
$table->softDeletes();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('posts');
}
};
```
### API Resource
```php
<?php
declare(strict_types=1);
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
final class PostResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'title' => $this->title,
'body' => $this->body,
'status' => $this->status->value,
'published_at' => $this->published_at?->toIso8601String(),
'author' => new UserResource($this->whenLoaded('author')),
'comments' => CommentResource::collection($this->whenLoaded('comments')),
];
}
}
```
### Queued Job
```php
<?php
declare(strict_types=1);
namespace App\Jobs;
use App\Models\Post;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
final class PublishPost implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public int $tries = 3;
public int $backoff = 60;
public function __construct(
private readonly Post $post,
) {}
public function handle(): void
{
$this->post->update([
'status' => PostStatus::Published,
'published_at' => now(),
]);
}
public function failed(\Throwable $e): void
{
// Log or notify — never silently swallow failures
logger()->error('PublishPost failed', ['post' => $this->post->id, 'error' => $e->getMessage()]);
}
}
```
### Feature Test (Pest)
```php
<?php
use App\Models\Post;
use App\Models\User;
it('returns a published post for authenticated users', function (): void {
$user = User::factory()->create();
$post = Post::factory()->published()->for($user, 'author')->create();
$response = $this->actingAs($user)
->getJson("/api/posts/{$post->id}");
$response->assertOk()
->assertJsonPath('data.status', 'published')
->assertJsonPath('data.author.id', $user->id);
});
it('queues a publish job when a draft is submitted', function (): void {
Queue::fake();
$user = User::factory()->create();
$post = Post::factory()->draft()->for($user, 'author')->create();
$this->actingAs($user)
->postJson("/api/posts/{$post->id}/publish")
->assertAccepted();
Queue::assertPushed(PublishPost::class, fn ($job) => $job->post->is($post));
});
```
## Validation Checkpoints
Run these at each workflow stage to confirm correctness before proceeding:
| Stage | Command | Expected Result |
|-------|---------|-----------------|
| After migration | `php artisan migrate:status` | All migrations show `Ran` |
| After routing | `php artisan route:list --path=api` | New routes appear with correct verbs |
| After job dispatch | `php artisan queue:work --once` | Job processes without exception |
| After implementation | `php artisan test --coverage` | >85% coverage, 0 failures |
| Before PR | `./vendor/bin/pint --test` | PSR-12 linting passes |
## Knowledge Reference
Laravel 10+, Eloquent ORM, PHP 8.2+, API resources, Sanctum/Passport, queues, Horizon, Livewire, Inertia, Octane, Pest/PHPUnit, Redis, broadcasting, events/listeners, notifications, task scheduling
Maintained by [@jeffallan](https://github.com/jeffallan), Principal Consultant at [Synergetic Solutions](https://synergetic.solutions)
[Documentation](https://jeffallan.github.io/claude-skills/skills/backend/laravel-specialist/)
© https://github.com/Jeffallan · MIT · Jeffallan/claude-skills