laravel-knowledge
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "laravel-knowledge":https://skillpi.com/zh/skills/deepskill-2036c581635a652a62c50abff5c69647f9efea54836203582aa501cbb476c657。安装前核对上游来源和版本:https://github.com/dykyi-roman/awesome-claude-code。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
Laravel 框架知识库。覆盖架构设计、领域驱动设计(DDD) 集成、Eloquent 持久化、服务容器、安全性、队列、事件、基础设施组件、测试及项目中常见的反模式等主题。
介绍来源: third_party · dykyi-roman · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: laravel-knowledge
description: Laravel framework knowledge base. Provides architecture, DDD integration, Eloquent persistence, service container, security, queues, events, infrastructure components, testing, and antipatterns for Laravel PHP projects.Laravel Knowledge Base
Quick reference for Laravel framework patterns, DDD integration strategies, and PHP 8.4 best practices for building scalable Laravel applications.
Core Principles
Service Providers
Service Providers are the central place to configure and bootstrap the application. All bindings, event listeners, middleware, and routes are registered through providers.
Facades
Facades provide a static-like interface to classes in the service container. Prefer dependency injection over Facades in Domain and Application layers; Facades are acceptable in Presentation and Infrastructure layers.
Directory Structure
Default Laravel: DDD-Aligned Laravel:
app/ app/
├── Http/Controllers/ src/
├── Models/ ├── Domain/
├── Providers/ │ ├── Order/
├── Services/ │ │ ├── Entity/
├── Events/ │ │ ├── ValueObject/
├── Listeners/ │ │ ├── Repository/
├── Jobs/ │ │ └── Event/
├── Mail/ │ └── Customer/
└── Exceptions/ ├── Application/
│ ├── Order/UseCase/
│ └── Customer/UseCase/
└── Infrastructure/
├── Persistence/
├── Http/
└── Provider/
Quick Checklists
DDD-Compatible Laravel Project
- [ ] Domain layer has zero Laravel imports
- [ ] Eloquent Models live in Infrastructure, not Domain
- [ ] Repository interfaces in Domain, Eloquent implementations in Infrastructure
- [ ] Service Providers wire interfaces to implementations
- [ ] Domain Events decoupled from Laravel Event system
- [ ] Value Objects used instead of primitive types
- [ ] Controllers are thin, delegate to Use Cases
- [ ] Authorization uses Policies delegating to domain Specifications
- [ ] Queued jobs have retry strategy,
failed()method, and concurrency protection - [ ] Domain defines its own
EventDispatcherInterface(not LaravelEventfacade) - [ ] Infrastructure components (Cache, HTTP Client) accessed via domain ports
Clean Architecture Checks
- [ ] No
use Illuminate\...in Domain layer - [ ] No business logic in Controllers or Middleware
- [ ] FormRequest used for input validation
- [ ] API Resources used for response transformation
- [ ] Single-action controllers for complex endpoints
- [ ] No direct DB queries in Controllers
Common Violations Quick Reference
| Violation | Where to Look | Severity |
|---|---|---|
| Eloquent in Domain layer | use Illuminate\Database in Domain/ |
Critical |
| Business logic in Controller | if/switch on domain state in Controllers | Critical |
| Fat Eloquent Model | Model with 500+ lines, business methods | Critical |
| Facade in Domain | use Illuminate\Support\Facades in Domain/ |
Critical |
| Missing FormRequest | Raw $request->input() with inline validation |
Warning |
| N+1 query | Relationship access in loops without eager loading | Warning |
| Missing API Resource | Array building in Controller for responses | Warning |
| Direct DB in Controller | DB::table() or Model::where() in Controller |
Warning |
| Business logic in Policy | DB queries or complex logic in Policy class | Warning |
| Missing job retry strategy | ShouldQueue without $tries or backoff() |
Warning |
| Event facade in Domain | Event::dispatch() or event() in Domain layer |
Critical |
| Cache/HTTP in Domain | Cache:: or Http:: in Domain layer |
Critical |
PHP 8.4 Laravel Patterns
Single-Action Controller
<?php
declare(strict_types=1);
namespace App\Http\Controllers\Order;
use App\Application\Order\UseCase\CreateOrderUseCase;
use App\Http\Requests\Order\CreateOrderRequest;
use App\Http\Resources\Order\OrderResource;
use Illuminate\Http\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
final readonly class CreateOrderController
{
public function __construct(
private CreateOrderUseCase $createOrder,
) {}
public function __invoke(CreateOrderRequest $request): JsonResponse
{
$orderId = $this->createOrder->execute($request->toCommand());
return OrderResource::make($orderId)
->response()
->setStatusCode(Response::HTTP_CREATED);
}
}
FormRequest
<?php
declare(strict_types=1);
namespace App\Http\Requests\Order;
use App\Application\Order\Command\CreateOrderCommand;
use App\Domain\Order\ValueObject\CustomerId;
use Illuminate\Foundation\Http\FormRequest;
final class CreateOrderRequest extends FormRequest
{
/** @return array<string, mixed> */
public function rules(): array
{
return [
'customer_id' => ['required', 'uuid'],
'lines' => ['required', 'array', 'min:1'],
'lines.*.product_id' => ['required', 'uuid'],
'lines.*.quantity' => ['required', 'integer', 'min:1'],
];
}
public function toCommand(): CreateOrderCommand
{
return new CreateOrderCommand(
customerId: new CustomerId($this->validated('customer_id')),
lines: $this->validated('lines'),
);
}
}
Application Service (Use Case)
<?php
declare(strict_types=1);
namespace App\Application\Order\UseCase;
use App\Domain\Order\Entity\Order;
use App\Domain\Order\Repository\OrderRepositoryInterface;
use App\Domain\Order\ValueObject\OrderId;
final readonly class CreateOrderUseCase
{
public function __construct(
private OrderRepositoryInterface $orders,
) {}
public function execute(CreateOrderCommand $command): OrderId
{
$order = Order::create(
id: OrderId::generate(),
customerId: $command->customerId,
lines: $command->lines,
);
$this->orders->save($order);
return $order->id();
}
}
References
For detailed information, load these reference files:
references/architecture.md-- Service Providers, Facades, directory structure, module patternsreferences/ddd-integration.md-- Extracting Domain from app/, Eloquent separation, Domain Eventsreferences/routing-http.md-- Controllers, middleware, FormRequest, API Resources, policiesreferences/persistence.md-- Eloquent ORM, migrations, transactions, read/write splittingreferences/dependency-injection.md-- Service Container, contextual binding, interface bindingreferences/testing.md-- Feature/Unit tests, Pest, factories, mocking, database testingreferences/security.md-- Gates, Policies with Specifications, password hashing, Sanctum, User model separationreferences/queues-advanced.md-- Job middleware, batching, chaining, retry/DLQ, Horizon, unique jobs, CQRSreferences/event-system.md-- Event discovery, queued listeners, subscribers, domain event bridge, testingreferences/infrastructure-components.md-- Cache, HTTP Client, Rate Limiting, Task Scheduling, Locks with DDD portsreferences/antipatterns.md-- God Model, fat controller, Facade abuse, N+1 detection
当前收录版本
0.0.1
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供 Laravel 框架知识库,涵盖架构设计、DDD 集成、Eloquent 持久化、服务容器、安全性、队列、事件、基础设施组件、测试及反模式等内容
- 适用于 Laravel 开发者日常开发参考,具有广泛受众的实用能力
亮点
- description 明确描述了 Skill 的核心功能(Laravel 框架知识库),触发词精准完整,边界清晰
亮点
- 文档结构清晰,包含 Core Principles、Quick Checklists、Common Violations Quick Reference、PHP 8.4 Laravel Patterns 等章节
- 有具体代码示例和目录结构对比,frontmatter 完整,单文件未超过 500 行
亮点
- Skill 为知识库类型,内容来源明确(Laravel 官方最佳实践),参数和示例正确
- 覆盖主要异常场景(如 N+1 查询、Facade 滥用等)
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。