Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Php Pro

ASecurity

当用 PHP 8+ 写高性能后端、处理大数据集或重构遗留 OOP 代码时使用;产出用生成器/迭代器/SPL 节省内存、强类型且 PSR 合规、含完善异常处理的惯用实现;不适用于其他语言、仅需基础 PHP 语法解释、或无法改动运行时与依赖配置的场景;触发词:生成器、SPL、PHP 8 枚举、严格类型、性能剖析

3 stars
0 votes
0 copies
2 views
Added 9/19/2026
ai-agentsgophpapibackend

Works with

cursorcliapi

Security Analysis

A100/100

Scanned 9/19/2026

$npx -y skills add findscripter/everything-skills --skill php-pro --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Php Pro?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Php Pro
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/findscripter-php-pro/badge)](https://www.skillsdirectory.com/skills/findscripter-php-pro)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: php-pro
title: PHP 进阶开发
description: 当用 PHP 8+ 写高性能后端、处理大数据集或重构遗留 OOP 代码时使用;产出用生成器/迭代器/SPL 节省内存、强类型且 PSR 合规、含完善异常处理的惯用实现;不适用于其他语言、仅需基础 PHP 语法解释、或无法改动运行时与依赖配置的场景;触发词:生成器、SPL、PHP 8 枚举、严格类型、性能剖析
domain: 研发/backend
triggers: [PHP 8 开发, 生成器 yield, 迭代器, SPL 数据结构, match 表达式, 枚举 enum, 构造器属性提升, 联合类型, 严格类型 strict_types, 内存优化, PHP 性能剖析, PSR 规范, trait 复用, 魔术方法, 自定义异常]
tags: [php, 性能优化, 内存管理, 面向对象, 类型系统, spl, psr, 研发]
level: 精通
status: stable
agents: [claude-code, codex, cursor, gemini-cli]
tools: [php, composer, Xdebug, Blackfire, PHPStan, Psalm, PHP_CodeSniffer, PHPUnit, OPcache]
requires: []
related: []
combines_with: []
license: MIT
source: sickn33/agentic-awesome-skills
source_license: MIT
---
---
name: php-pro
title: PHP 进阶开发
description: 当用 PHP 8+ 写高性能后端、处理大数据集或重构遗留 OOP 代码时使用;产出用生成器/迭代器/SPL 节省内存、强类型且 PSR 合规、含完善异常处理的惯用实现;不适用于其他语言、仅需基础 PHP 语法解释、或无法改动运行时与依赖配置的场景;触发词:生成器、SPL、PHP 8 枚举、严格类型、性能剖析
domain: 研发/misc
triggers: [PHP 8 开发, 生成器 yield, 迭代器, SPL 数据结构, match 表达式, 枚举 enum, 构造器属性提升, 联合类型, 严格类型 strict_types, 内存优化, PHP 性能剖析, PSR 规范, trait 复用, 魔术方法, 自定义异常]
tags: [php, 性能优化, 内存管理, 面向对象, 类型系统, spl, psr, 研发]
level: 精通
status: stable
agents: [claude-code, codex, cursor, gemini-cli]
tools: [php, composer, Xdebug, Blackfire, PHPStan, Psalm, PHP_CodeSniffer, PHPUnit, OPcache]
requires: []
related: []
combines_with: []
license: MIT
source: sickn33/agentic-awesome-skills
source_license: MIT
---
## 何时使用

适用:
- 用 PHP 8+ 构建高性能后端、API、CLI,或对既有 PHP 工程做架构/生产就绪评审。
- 处理大数据集时需用生成器/迭代器把内存占用压到最低。
- 用现代特性(match、枚举、attribute、构造器属性提升、联合/交集类型)重构遗留 OOP 代码。
- 排查内存、性能瓶颈,或补强类型覆盖与异常体系。

不该用(负边界):
- 需要其他语言或运行时。
- 只需基础 PHP 语法解释。
- 无法改动 PHP 运行时、依赖或构建配置(优化与代码生成无从落地)。

## 步骤

1. 对齐前提:确认 PHP 版本(8.0/8.1/8.2+)、运行时、扩展(OPcache)与部署约束。
2. 优先内建:先用 PHP 标准库与内建函数,再考虑自己实现或引第三方包。
3. 选型:依据数据规模与访问模式选生成器 vs SPL 结构(`SplQueue`/`SplStack`/`SplHeap`/`ArrayObject`)。
4. 实现:开 `declare(strict_types=1)`,全量类型标注,异常处理显式,命名自解释。
5. 优化:先用 Xdebug/Blackfire 剖析定位热点,再针对性优化——不要凭直觉调。

## 指令

- 强类型先行:每个文件首行 `declare(strict_types=1)`,函数参数/返回值/属性全部标注类型,善用联合类型、`never`、`mixed`。
- 大数据用生成器:用 `yield` 流式处理,避免一次性把全集装进数组撑爆内存。
- 内建优先于第三方:能用标准库就别引依赖;外部依赖按需、克制。
- 错误用异常:抛自定义异常并设置正确的错误级别,不靠返回码兜底。
- 现代 OOP:构造器属性提升、`enum`、`match` 表达式、`readonly`、trait 复用、后期静态绑定,按需用 reflection。
- 遵守 PSR:编码风格 PSR-12,自动加载 PSR-4,命名空间规整。
- 关键工具:
  - 静态分析:`vendor/bin/phpstan analyse` / `vendor/bin/psalm`
  - 风格检查:`vendor/bin/phpcs` / `vendor/bin/phpcbf`(按 PSR-12)
  - 测试:`vendor/bin/phpunit`(覆盖边界与错误分支)
  - 性能剖析:Xdebug profiler 或 Blackfire 定位热点
  - 生产:开启 OPcache,接日志与监控钩子。

## 示例

用生成器流式读大文件,内存占用与文件大小解耦:

```php
<?php
declare(strict_types=1);

/** @return \Generator<int, string> */
function readLines(string $path): \Generator
{
    $fh = fopen($path, 'rb');
    if ($fh === false) {
        throw new \RuntimeException("无法打开文件: {$path}");
    }
    try {
        while (($line = fgets($fh)) !== false) {
            yield rtrim($line, "\r\n");   // 一次只驻留一行
        }
    } finally {
        fclose($fh);
    }
}

foreach (readLines('huge.log') as $line) {
    // 逐行处理,内存恒定
}
```

PHP 8 枚举 + match,替代魔法常量与 if-else 链:

```php
<?php
declare(strict_types=1);

enum Status: string
{
    case Active   = 'active';
    case Disabled = 'disabled';

    public function label(): string
    {
        return match ($this) {
            self::Active   => '已启用',
            self::Disabled => '已停用',
        };
    }
}
```

典型请求:
- "把这段加载全表的代码改成生成器,降低内存"
- "用 SPL 优先队列实现任务调度"
- "把这堆 if-else 状态判断重构成枚举 + match"
- "给这个模块补全类型标注并通过 PHPStan level max"
- "用 Blackfire 定位并优化这个接口的性能瓶颈"

## 注意事项

- 输出不能替代环境内的实测、测试与专家评审;落地前务必跑通 PHPUnit 与静态分析。
- 优化前先剖析(profile)后动手,任何性能改动都应有数据支撑。
- 注重安全:防注入、严格校验输入;专注可运行代码而非长篇解释。
- 输入、权限、安全边界或验收标准缺失时,先停下来澄清再动手。
- 仅在任务确实落在上述范围内时使用本技能。

## 互见

- 其他语言的现代工程实践技能(如 `golang-pro`)。
- 后端架构、API 设计与代码审查相关技能。
- 通用性能剖析与内存优化方法论。

---
采编自 sickn33/antigravity-awesome-skills(MIT)。

Attribution

findscripterfindscripter
View sourceSee grades on GitHubMore from findscripter →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698621 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →