Token导航 LogoToken导航

Agent Skill · 研究检索

php-specialist(PHP specialist 搜索)

php-specialist 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

php-specialist 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 47,935。

总安装 710周安装 29GitHub Stars 1下载 227核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:php-specialist(PHP specialist 搜索)
来源仓库:https://github.com/pixel-process-ug/superkit-agents
仓库路径:skills/php-specialist
安装命令:
npx skills add https://github.com/pixel-process-ug/superkit-agents --skill php-specialist
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/pixel-process-ug/superkit-agents --skill php-specialist

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于查找和筛选与 PHP 专业开发相关的信息与资源。适合根据关键词快速定位候选结果和技术线索。php-specialist 属于研究检索类 Skill,可作为该场景下的辅助能力补充。可帮助 Agent 在复杂开发任务中检索解决方案。支持在 Codex、Claude、Cursor、Gemini CLI 中安装使用。

建议结合来源仓库进一步核验具体用法和准确性。

来源仓库内路径:skills/php-specialist

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/pixel-process-ug/superkit-agents --skill php-s…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

php-specialist 怎么安装?

在终端执行 npx skills add https://github.com/pixel-process-ug/superkit-agents --skill php-specialist。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

php-specialist 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

php-specialist 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

php-specialist 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

php-specialist 用的人多吗?

公开数据是累计安装 710 次,近一周安装 29 次,下载 227 次,GitHub 1 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

php-specialist 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
php-specialist

PHP specialist 搜索 · 本页

7101需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

PHP Specialist

Overview

Write modern, type-safe, and maintainable PHP 8.x code adhering to PSR standards and SOLID principles. This skill covers the full modern PHP toolchain: language features introduced in PHP 8.0 through 8.4, PSR interoperability standards, Composer dependency management, static analysis with PHPStan and Psalm, coding style enforcement with PHP CS Fixer and Pint, and architectural patterns that leverage the type system for correctness at compile time rather than runtime.

Apply this skill whenever PHP code is being written, reviewed, or refactored in any framework or standalone context.

Multi-Phase Process

Phase 1: Environment Assessment

  1. Identify PHP version from composer.json -> require.php
  2. Review composer.json for autoloading strategy (PSR-4 namespaces)
  3. Check for static analysis configuration (phpstan.neon, psalm.xml)
  4. Identify coding standard tool (pint.json, .php-cs-fixer.php)
  5. Catalog existing patterns: enums, DTOs, value objects, interfaces
STOP — Do NOT write code without knowing the PHP version and autoloading strategy.

Phase 2: Design

  1. Define interfaces and contracts before implementations
  2. Design value objects and DTOs with readonly properties
  3. Map domain concepts to backed enums where applicable
  4. Plan exception hierarchy for the domain
  5. Identify seams for dependency injection
STOP — Do NOT implement without interfaces defined for key boundaries.

Phase 3: Implementation

  1. Write interfaces first — contracts before concrete classes
  2. Implement with constructor promotion, readonly properties, union/intersection types
  3. Use match expressions over switch; named arguments for clarity
  4. Leverage first-class callable syntax for functional composition
  5. Apply SOLID principles at every class boundary
STOP — Do NOT skip strict_types declaration in any PHP file.

Phase 4: Quality Assurance

  1. Run PHPStan at maximum achievable level (target level 9)
  2. Enforce coding style with PHP CS Fixer or Laravel Pint
  3. Verify type coverage — no mixed without justification
  4. Review for SOLID violations and code smells
  5. Confirm Composer autoload is optimized (--classmap-authoritative)

PHP Version Feature Decision Table

FeatureMinimum VersionUse When
Constructor promotion8.0Any class with constructor parameters
Named arguments8.0Functions with 3+ params or boolean flags
Match expressions8.0Any switch statement (strict, returns value)
Union types8.0Parameter accepts multiple types
Backed enums8.1Any set of named constants with values
Readonly properties8.1Immutable DTOs, value objects
Fibers8.1Async frameworks (rarely used directly)
First-class callables8.1Functional composition, array_map/filter
Readonly classes8.2All-readonly DTOs (shorthand)
DNF types8.2Complex union + intersection combinations
Override attribute8.3Overriding parent methods (safety check)
Property hooks8.4Computed properties without separate methods

Modern PHP 8.x Features

Enums (PHP 8.1+)

// Backed enum with methods — replaces class constants and magic strings
enum OrderStatus: string
{
    case Draft     = 'draft';
    case Pending   = 'pending';
    case Confirmed = 'confirmed';
    case Shipped   = 'shipped';
    case Delivered = 'delivered';
    case Cancelled = 'cancelled';

    public function label(): string
    {
        return match ($this) {
            self::Draft     => 'Draft',
            self::Pending   => 'Pending Review',
            self::Confirmed => 'Confirmed',
            self::Shipped   => 'Shipped',
            self::Delivered => 'Delivered',
            self::Cancelled => 'Cancelled',
        };
    }

    public function isFinal(): bool
    {
        return in_array($this, [self::Delivered, self::Cancelled], true);
    }

    /** @return list<self> */
    public static function active(): array
    {
        return array_filter(self::cases(), fn (self $s) => ! $s->isFinal());
    }
}

Readonly Properties and Classes (PHP 8.1 / 8.2)

// Readonly class — all properties are implicitly readonly
readonly class Money
{
    public function __construct(
        public int    $amount,
        public string $currency,
    ) {}

    public function add(self $other): self
    {
        if ($this->currency !== $other->currency) {
            throw new CurrencyMismatchException($this->currency, $other->currency);
        }

        return new self($this->amount + $other->amount, $this->currency);
    }

    public function isPositive(): bool
    {
        return $this->amount > 0;
    }
}

Constructor Promotion

class CreateUserAction
{
    public function __construct(
        private readonly UserRepository $users,
        private readonly Hasher         $hasher,
        private readonly EventDispatcher $events,
    ) {}

    public function execute(CreateUserData $data): User
    {
        $user = $this->users->create([
            'name'     => $data->name,
            'email'    => $data->email,
            'password' => $this->hasher->make($data->password),
        ]);

        $this->events->dispatch(new UserCreated($user));

        return $user;
    }
}

Named Arguments

// Improves readability for functions with many parameters or boolean flags
$user = User::create(
    name: $request->name,
    email: $request->email,
    isAdmin: false,
    sendWelcomeEmail: true,
);

// Particularly valuable with optional parameters
$response = Http::timeout(seconds: 30)
    ->retry(times: 3, sleepMilliseconds: 500, throw: true)
    ->get($url);

Match Expressions

// match is strict (===), exhaustive, and returns a value
$discount = match (true) {
    $total >= 10000 => 0.15,
    $total >= 5000  => 0.10,
    $total >= 1000  => 0.05,
    default         => 0.00,
};

// Replaces switch with no fall-through risk
$handler = match ($event::class) {
    OrderPlaced::class   => new HandleOrderPlaced(),
    PaymentFailed::class => new HandlePaymentFailed(),
    default              => throw new UnhandledEventException($event),
};

Union and Intersection Types

// Union type — accepts either type
function findUser(int|string $identifier): User
{
    return is_int($identifier)
        ? User::findOrFail($identifier)
        : User::where('email', $identifier)->firstOrFail();
}

// Intersection type — must satisfy all interfaces
function processLoggableEntity(Loggable&Serializable $entity): void
{
    $entity->log();
    $data = $entity->serialize();
}

// DNF types (PHP 8.2) — combine union and intersection
function handle((Renderable&Countable)|string $content): string
{
    if (is_string($content)) {
        return $content;
    }

    return $content->render();
}

First-Class Callable Syntax (PHP 8.1+)

// Create closures from named functions
$slugify = Str::slug(...);
$titles  = array_map($slugify, $names);

// Method references
$validator = Validator::make(...);

// Useful for pipeline / collection patterns
$activeUsers = collect($users)
    ->filter(UserPolicy::isActive(...))
    ->map(UserTransformer::toArray(...))
    ->values();

Fibers (PHP 8.1+)

// Fibers enable cooperative multitasking — foundation for async frameworks
$fiber = new Fiber(function (): void {
    $value = Fiber::suspend('paused');
    echo "Resumed with: {$value}";
});

$result = $fiber->start();        // Returns 'paused'
$fiber->resume('hello world');    // Prints: "Resumed with: hello world"

// Practical use: async HTTP client internals, event loops (Revolt, ReactPHP)
// Application developers rarely use Fiber directly — frameworks abstract it

PSR Standards

PSRNameRelevance
PSR-1Basic Coding StandardBaseline: <?php tag, UTF-8, namespace/class conventions
PSR-4AutoloadingMap namespaces to directories in composer.json — mandatory
PSR-7HTTP Message InterfacesImmutable request/response objects for middleware pipelines
PSR-11Container InterfaceDependency injection container interoperability
PSR-12Extended Coding StyleSupersedes PSR-2: formatting, spacing, declarations
PSR-15HTTP Server MiddlewareMiddlewareInterface and RequestHandlerInterface
PSR-17HTTP FactoriesCreate PSR-7 objects (RequestFactory, ResponseFactory)
PSR-18HTTP ClientClientInterface for interoperable HTTP clients

PSR-4 Autoloading

{
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Domain\\": "src/Domain/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    }
}

Rule: namespace segment maps 1:1 to directory. App\Http\Controllers\UserController lives at app/Http/Controllers/UserController.php.

Composer Dependency Management

Essential Commands

CommandPurpose
composer require package/nameAdd production dependency
composer require package/name --devAdd development dependency
composer update --dry-runPreview what would change
composer why package/nameShow why a package is installed
composer auditCheck for known security vulnerabilities
composer bumpUpdate version constraints to installed versions
composer validate --strictValidate composer.json and composer.lock

Best Practices

  • Always commit composer.lock — reproducible installs across environments
  • Use ^ (caret) constraints: "laravel/framework": "^12.0" allows minor/patch updates
  • Separate dev dependencies: testing, static analysis, and debug tools go in require-dev
  • Run composer audit in CI to catch known vulnerabilities
  • Use composer dump-autoload --classmap-authoritative in production for speed

Static Analysis

PHPStan Levels

LevelWhat It Checks
0Basic: undefined variables, unknown classes, wrong function calls
1+ possibly undefined variables, unknown methods on $this
2+ unknown methods on all expressions (not just $this)
3+ return types verified
4+ dead code, always-true/false conditions
5+ argument types of function calls
6+ missing typehints reported
7+ union types checked exhaustively
8+ nullable types checked strictly
9+ mixed type is forbidden without explicit handling

PHPStan Configuration

# phpstan.neon
parameters:
    level: 9
    paths:
        - app
        - src
    excludePaths:
        - app/Console/Kernel.php
    ignoreErrors: []
    checkMissingIterableValueType: true
    checkGenericClassInNonGenericObjectType: true

includes:
    - vendor/larastan/larastan/extension.neon  # Laravel-specific rules

PHP CS Fixer / Pint

// .php-cs-fixer.php — for non-Laravel projects
return (new PhpCsFixer\Config())
    ->setRules([
        '@PER-CS'            => true,
        'strict_types'       => true,
        'declare_strict_types' => true,
        'ordered_imports'    => ['sort_algorithm' => 'alpha'],
        'no_unused_imports'  => true,
        'trailing_comma_in_multiline' => true,
    ])
    ->setFinder(
        PhpCsFixer\Finder::create()->in([__DIR__ . '/src', __DIR__ . '/tests'])
    );

For Laravel projects, use Pint with a pint.json preset — it wraps PHP CS Fixer with Laravel-specific defaults.

SOLID Principles in PHP

PrincipleGuidelinePHP Mechanism
S — Single ResponsibilityOne reason to change per classAction classes, small services
O — Open/ClosedExtend behavior without modifying sourceInterfaces, strategy pattern, enums
L — Liskov SubstitutionSubtypes must be substitutable for base typesCovariant returns, contravariant params
I — Interface SegregationClients depend only on methods they useSmall, focused interfaces
D — Dependency InversionDepend on abstractions, not concretionsConstructor injection, interface bindings

Dependency Inversion Example

// Contract (abstraction)
interface PaymentGateway
{
    public function charge(Money $amount, PaymentMethod $method): PaymentResult;
}

// Implementation (concretion) — can be swapped without changing consumers
final class StripeGateway implements PaymentGateway
{
    public function __construct(private readonly StripeClient $client) {}

    public function charge(Money $amount, PaymentMethod $method): PaymentResult
    {
        // Stripe-specific logic
    }
}

// Consumer depends on abstraction only
final class ProcessPaymentAction
{
    public function __construct(private readonly PaymentGateway $gateway) {}

    public function execute(Order $order): PaymentResult
    {
        return $this->gateway->charge($order->total, $order->paymentMethod);
    }
}

Error Handling Patterns

Custom Exception Hierarchy

// Base domain exception
abstract class DomainException extends \RuntimeException {}

// Specific exceptions with factory methods
final class InsufficientFundsException extends DomainException
{
    public static function forAccount(Account $account, Money $required): self
    {
        return new self(sprintf(
            'Account %s has %d %s but %d %s is required.',
            $account->id,
            $account->balance->amount,
            $account->balance->currency,
            $required->amount,
            $required->currency,
        ));
    }
}

Result Pattern (Error as Value)

/** @template T */
readonly class Result
{
    /** @param T|null $value */
    private function __construct(
        public bool    $ok,
        public mixed   $value = null,
        public ?string $error = null,
    ) {}

    /** @param T $value */
    public static function success(mixed $value): self
    {
        return new self(ok: true, value: $value);
    }

    public static function failure(string $error): self
    {
        return new self(ok: false, error: $error);
    }
}

// Usage — caller must handle both paths
$result = $action->execute($data);
if (! $result->ok) {
    return response()->json(['error' => $result->error], 422);
}

Type Safety Patterns

Branded / Opaque Types via Readonly Classes

// Prevent accidental mixing of IDs from different entities
readonly class UserId
{
    public function __construct(public int $value) {}

    public function equals(self $other): bool
    {
        return $this->value === $other->value;
    }
}

readonly class OrderId
{
    public function __construct(public int $value) {}
}

// Compiler prevents: processOrder(new UserId(1)) when OrderId is expected
function processOrder(OrderId $orderId): void { /* ... */ }

Generic Collections via PHPStan Annotations

/**
 * @template T
 * @implements \IteratorAggregate<int, T>
 */
final class TypedCollection implements \IteratorAggregate, \Countable
{
    /** @param list<T> $items */
    public function __construct(private array $items = []) {}

    /** @param T $item */
    public function add(mixed $item): void
    {
        $this->items[] = $item;
    }

    /** @return \ArrayIterator<int, T> */
    public function getIterator(): \ArrayIterator
    {
        return new \ArrayIterator($this->items);
    }

    public function count(): int
    {
        return count($this->items);
    }
}

Anti-Patterns / Common Mistakes

Anti-PatternWhy It FailsWhat To Do Instead
Using mixed as escape hatchHoles in type safety netNarrow with union types or generics
Stringly-typed codeRuntime errors from typosUse backed enums for named constants
God classes (many responsibilities)Untestable, high couplingSplit into Action classes
Suppressing static analysisHides real bugsFix the issue, add @phpstan-ignore only with explanation
Missing declare(strict_types=1)Silent type coercion bugsAdd to every PHP file
Array-shaped domain dataNo IDE support, no type safetyUse readonly DTOs or value objects
Service locator (app() in logic)Hidden dependencies, untestableConstructor injection
Catching \Exception broadlySwallows unexpected errorsCatch specific exception types
Mutable value objectsShared state bugsUse readonly classes, return new instances
Ignoring composer auditKnown vulnerabilities in productionRun in CI, treat as build failure
Deep inheritance (3+ levels)Fragile base class problemPrefer composition and interfaces
Classes not marked finalUnintended extensionDefault to final, open only when designed for it

Anti-Rationalization Guards

  • Do NOT skip declare(strict_types=1) because "it's just a small script" -- add it everywhere.
  • Do NOT use mixed without a comment justifying why a narrower type is impossible.
  • Do NOT suppress PHPStan errors without a written explanation of why the code is correct.
  • Do NOT use the service locator pattern (app()) in business logic, even in Laravel.
  • Do NOT skip interfaces for key boundaries because "there's only one implementation" -- there will be two.

Documentation Lookup (Context7)

Use mcp__context7__resolve-library-id then mcp__context7__query-docs for up-to-date docs. Returned docs override memorized knowledge.

  • php — for language features, built-in functions, or PHP 8.x syntax
  • composer — for package management, autoloading, or scripts configuration

Integration Points

SkillHow It Connects
laravel-specialistPHP 8.x features power Eloquent casts, enums, readonly DTOs, and typed collections
senior-backendSOLID architecture, interface-driven design, error handling patterns
test-driven-developmentPHPUnit/Pest testing with strong type assertions
clean-codeSOLID, DRY, code smell detection at the PHP level
security-reviewInput validation, type coercion risks, dependency vulnerabilities
laravel-boostAI-generated PHP code quality via guidelines and MCP tools

Skill Type

FLEXIBLE — Adapt the process phases to the scope of work. A single function may need only Phase 3 and 4. A new module or package should follow all four phases. Non-negotiable regardless of scope: declare(strict_types=1), PHPStan compliance at the project's configured level, and PSR-4 autoloading.

平台分布

Codex

36.13%
按下载量换算82

Claude

28.06%
按下载量换算64

Cursor

18.75%
按下载量换算43

Gemini CLI

9.52%
按下载量换算22

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills