yii-knowledge
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "yii-knowledge":https://skillpi.com/zh/skills/deepskill-8974c53b47781114f5448c1fab11f5a22e4b829c8e0c6ee9f90a429bf36c745c。安装前核对上游来源和版本:https://github.com/dykyi-roman/awesome-claude-code。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
建立 Yii 框架的知识库,覆盖 Yii3 模块化架构、领域驱动设计(DDD)集成、PSR-7/PSR-15 规范支持、持久化、依赖注入(DI)、安全机制(如 RBAC 和认证)、事件系统(PSR-14)、队列/任务、基础设施组件(缓存、限流器、HTTP 客户端)、测试以及常见反模式。
介绍来源: third_party · dykyi-roman · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: yii-knowledge
description: Yii framework knowledge base. Provides Yii3 modular architecture, DDD integration, PSR-7/PSR-15 compliance, persistence, DI, security (RBAC, auth), event system (PSR-14), queue/jobs, infrastructure components (cache, rate limiter, HTTP client), testing, and antipatterns for Yii PHP projects.Yii Knowledge Base
Quick reference for Yii3 framework patterns and PHP implementation guidelines. Yii3 is a complete rewrite — modular, PSR-compliant, and designed for modern PHP 8.4+ applications with clean architecture support.
Core Principles
PSR Compliance
Yii3 implements PSR-3 (log), PSR-4 (autoload), PSR-7/PSR-17 (HTTP messages/factories via yiisoft/http-message), PSR-11 (DI via yiisoft/di), PSR-12 (coding style), PSR-15 (middleware via yiisoft/middleware-dispatcher).
Middleware Pipeline
Request → [Router] → [Auth] → [CORS] → [Action] → Response
↓ ↓
yiisoft/router Application Logic
Rule: All HTTP handling flows through the PSR-15 middleware pipeline. No global state.
Modular Package Architecture
Yii3 is split into independent packages (yiisoft/*). Install only what you need. No monolithic framework dependency.
Quick Checklists
DDD-Compatible Yii3 Project
- [ ] Domain layer has zero
use Yiisoft\imports - [ ] ActiveRecord used only in Infrastructure layer
- [ ] Repository interfaces defined in Domain layer
- [ ] Value Objects used instead of primitives in Domain
- [ ] Actions/Controllers only map input and delegate to UseCases
- [ ] DI container configured via providers, not service locator
- [ ] Domain events dispatched through domain
EventDispatcherInterfaceport (not PSR-14 directly) - [ ] RBAC Rules delegate business logic to domain Specifications
- [ ] Queue handlers delegate to Application UseCases
- [ ] Infrastructure components (Cache, HTTP Client) accessed via domain ports
Clean Architecture Checks
- [ ] No
Yiisoft\ActiveRecordin Domain or Application layers - [ ] No HTTP concerns (
ServerRequestInterface) in Application layer - [ ] Middleware handles cross-cutting concerns (auth, CORS, logging)
- [ ] Config files separate from business logic
- [ ] Service providers wire interfaces to implementations
- [ ] Tests do not depend on Yii container for unit tests
Common Violations Quick Reference
| Violation | Where to Look | Severity |
|---|---|---|
| ActiveRecord in Domain | use Yiisoft\ActiveRecord in Domain layer |
Critical |
| Service Locator usage | $container->get() outside composition root |
Critical |
| Business logic in Action | if/switch on domain state in Controller/Action | Critical |
| Framework in Domain | use Yiisoft\ in Domain namespace |
Warning |
| Fat middleware | Middleware doing business logic | Warning |
| Missing input validation | Action without request validation | Warning |
| IdentityInterface in Domain | use Yiisoft\Auth in Domain layer |
Critical |
| RBAC logic in Domain | use Yiisoft\Rbac in Domain layer |
Critical |
| Queue in Domain | QueueInterface in Domain layer |
Critical |
| Cache/HTTP Client in Domain | CacheInterface or PSR-18 in Domain layer |
Critical |
| Yii2 patterns in Yii3 | Yii::$app->, global helpers |
Critical |
PHP 8.4 Yii Patterns
Action (Single Action Controller)
declare(strict_types=1);
namespace Presentation\Api\Order;
final readonly class CreateOrderAction
{
public function __construct(
private CreateOrderUseCase $createOrder,
private OrderRequestMapper $mapper,
) {}
public function __invoke(ServerRequestInterface $request): ResponseInterface
{
$dto = $this->mapper->fromRequest($request);
$result = $this->createOrder->execute($dto);
return $this->responseFactory->createJson($result->toArray(), 201);
}
}
PSR-15 Middleware
declare(strict_types=1);
namespace Infrastructure\Http\Middleware;
final readonly class CorrelationIdMiddleware implements MiddlewareInterface
{
public function process(
ServerRequestInterface $request,
RequestHandlerInterface $handler,
): ResponseInterface {
$correlationId = $request->getHeaderLine('X-Correlation-ID') ?: Uuid::v4();
$request = $request->withAttribute('correlationId', $correlationId);
return $handler->handle($request)
->withHeader('X-Correlation-ID', $correlationId);
}
}
UseCase with DI
declare(strict_types=1);
namespace Application\Order\UseCase;
final readonly class CreateOrderUseCase
{
public function __construct(
private OrderRepositoryInterface $orders,
private EventDispatcherInterface $events,
) {}
public function execute(CreateOrderDTO $dto): OrderResultDTO
{
$order = Order::create(
id: $this->orders->nextIdentity(),
customerId: $dto->customerId,
lines: $dto->lines,
);
$this->orders->save($order);
$this->events->dispatch(...$order->releaseEvents());
return OrderResultDTO::fromEntity($order);
}
}
References
For detailed information, load these reference files:
references/architecture.md— Yii3 modular architecture, middleware pipeline, config systemreferences/ddd-integration.md— Extracting Domain from Yii, Repository pattern, Domain Eventsreferences/routing-http.md— Routing, Actions, PSR-7/PSR-15 middlewarereferences/persistence.md— ActiveRecord, Cycle ORM, migrations, Repository patternreferences/dependency-injection.md— yiisoft/di container, service providers, PSR-11references/testing.md— PHPUnit, fixtures, functional testing, middleware testingreferences/security.md— RBAC, authentication, IdentityInterface adapter, password hashing, CSRFreferences/event-system.md— PSR-14 dispatcher, listeners, domain event bridge, stoppable eventsreferences/queue.md— yii-queue, messages, handlers, middleware pipelines, retry, channelsreferences/infrastructure-components.md— Cache (PSR-16), Rate Limiter, HTTP Client (PSR-18), Mailer with DDD portsreferences/antipatterns.md— Yii2-in-Yii3 detection, framework coupling, fat controllers, RBAC in Domain, missing queue resilience
当前收录版本
0.0.1
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供 Yii3 框架的完整知识体系,涵盖模块化架构、DDD 集成、PSR 规范等现代 PHP 开发核心概念
- 包含实用的检查清单和常见违规模式参考,对 Yii3 开发者具有明确指导价值
亮点
- description 精准描述了 Yii3 框架知识库的核心能力,关键词覆盖完整,边界清晰
待提升项
-
缺少 When to Use 章节 原报告严重程度:轻微
文档结构良好但缺少明确的使用场景说明章节
改进建议:建议添加 When to Use 章节,说明何时以及如何使用此知识库
-
缺少端到端完整示例 原报告严重程度:轻微
虽然有代码片段示例,但缺少一个完整的端到端使用示例
改进建议:建议添加一个完整的 Yii3 项目结构示例,展示如何应用这些知识
亮点
- 文档结构清晰,包含核心原则、检查清单、违规参考、代码模式等多个实用章节
- 提供了具体的 PHP 8.4 Yii 代码示例,便于开发者直接参考使用
待提升项
-
引用文件缺失 原报告严重程度:重大
SKILL.md 中引用了 11 个 reference 文件,但实际未传入任何引用文件
改进建议:请确保所有被引用的 reference 文件都包含在 Skill 包中,或移除对这些文件的引用
亮点
- 作为知识库型 Skill,内容本身完整且自包含,核心信息无需依赖外部文件即可使用
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。