create-bridge

为 PHP 8.4 生成桥接模式实现。将抽象与实现解耦,便于独立扩展抽象和具体实现。包含单元测试。

仓库最近推送
GitHub Stars
109
Forks
26
Issues / PRs
1

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "create-bridge":https://skillpi.com/zh/skills/deepskill-4e0a234a2759c865bdc031d7c81804ae79db4e7018dbced79008f57bab49e5e0。安装前核对上游来源和版本:https://github.com/dykyi-roman/awesome-claude-code。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

为 PHP 8.4 生成桥接模式实现。将抽象与实现解耦,便于独立扩展抽象和具体实现。包含单元测试。

0 下载

介绍来源: third_party · dykyi-roman · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: create-bridge
description: Generates Bridge pattern for PHP 8.4. Decouples abstraction from implementation. Includes unit tests.

Bridge Pattern Generator

Creates Bridge pattern infrastructure for separating abstraction from implementation.

When to Use

Scenario Example
Multiple dimensions of variation Notification types × channels
Avoid class explosion Shape × rendering method
Runtime implementation switching Database drivers
Platform independence UI × OS

Component Characteristics

Abstraction

  • High-level interface
  • Uses implementor
  • Domain layer

RefinedAbstraction

  • Extends abstraction
  • Adds specialized behavior

Implementor Interface

  • Low-level operations
  • Multiple implementations

ConcreteImplementor

  • Actual implementation
  • Platform-specific code

Generation Process

Step 1: Generate Implementor Interface

Path: src/Domain/{BoundedContext}/

  1. {Name}ImplementorInterface.php — Low-level operations

Step 2: Generate Abstraction

Path: src/Domain/{BoundedContext}/

  1. Abstract{Name}.php — High-level interface

Step 3: Generate RefinedAbstraction

Path: src/Domain/{BoundedContext}/

  1. {Type}{Name}.php — Specialized abstractions

Step 4: Generate ConcreteImplementors

Path: src/Infrastructure/{BoundedContext}/

  1. {Platform}{Name}Implementor.php — Platform implementations

Step 5: Generate Tests

  1. {ClassName}Test.php — Bridge behavior verification

File Placement

Component Path
Abstraction src/Domain/{BoundedContext}/
RefinedAbstraction src/Domain/{BoundedContext}/
Implementor Interface src/Domain/{BoundedContext}/
ConcreteImplementor src/Infrastructure/{BoundedContext}/
Unit Tests tests/Unit/

Naming Conventions

Component Pattern Example
Abstraction Abstract{Name} AbstractNotification
RefinedAbstraction {Type}{Name} UrgentNotification
Implementor Interface {Name}ImplementorInterface NotificationImplementorInterface
ConcreteImplementor {Platform}{Name}Implementor EmailNotificationImplementor

Quick Template Reference

Abstraction

abstract readonly class Abstract{Name}
{
    public function __construct(
        protected {Name}ImplementorInterface $implementor
    ) {}

    abstract public function {operation}({params}): {returnType};
}

RefinedAbstraction

final readonly class {Type}{Name} extends Abstract{Name}
{
    public function {operation}({params}): {returnType}
    {
        {preprocessing}
        return $this->implementor->{implementorMethod}({params});
    }
}

Usage Example

$email = new EmailNotificationImplementor();
$urgent = new UrgentNotification($email);
$urgent->send($message);

// Switch implementation
$sms = new SmsNotificationImplementor();
$urgent = new UrgentNotification($sms);
$urgent->send($message);

Common Bridges

Bridge Purpose
NotificationBridge Type × Channel (Email/SMS/Push)
ReportBridge Format × Generator (PDF/Excel/CSV)
DatabaseBridge Query × Driver (MySQL/PostgreSQL)
PaymentBridge Gateway × Provider (Stripe/PayPal)

Anti-patterns to Avoid

Anti-pattern Problem Solution
Missing Abstraction Direct implementor use Use abstraction layer
Tight Coupling Abstraction knows concrete implementor Depend on interface
Single Implementation No variation Use simple inheritance
Leaky Abstraction Exposes implementor details Hide implementation

References

For complete PHP templates and examples, see:

  • references/templates.md — Abstraction, refined abstraction, implementor templates
  • references/examples.md — Notification, report bridges with unit tests

当前收录版本

0.0.1

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值85/100

亮点

  • 提供完整的桥接模式生成流程,涵盖抽象、实现、测试全流程
  • 包含多种常见桥接场景(通知、报表、数据库、支付)和最佳实践
触发精准65/100

待提升项

  • description写错位置 原报告严重程度:轻微

    顶层 frontmatter 中 description 字段为空,实际描述内容位于 skill_body 内部

    改进建议:将 description 内容移至顶层 frontmatter 的 description 字段

  • 触发词不全 原报告严重程度:轻微

    仅提供英文 description,缺少中文触发词(如“桥接模式”“Bridge pattern”)

    改进建议:在 description 中添加中英文触发词,覆盖常见搜索变体

结构规范95/100

亮点

  • 生成步骤清晰(5步流程),每步有明确输出和路径
  • 提供命名规范、模板代码、使用示例和常见桥接场景
执行可靠60/100

待提升项

  • 参数依赖未说明 原报告严重程度:重大

    生成过程依赖用户输入参数(如 Name、BoundedContext、Type 等),但未说明如何获取或验证这些参数

    改进建议:添加参数说明或交互式引导,确保用户能提供必要输入

亮点

  • 文件路径和命名规范明确,减少执行歧义
证据可验 (前四项均值)76/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。