php-pro
它能做什么
这个 AI 代理可以帮你编写现代、高效的 PHP 代码。它专注于优化内存占用和程序速度,并运用 PHP 的高级特性。
适用场景
- ✓当你要编写需要处理大量数据、又不能崩溃的 PHP 程序时。
- ✓当你想使用最佳实践和 PHP 的最新特性时。
- ✓当你需要优化 PHP 代码的运行速度和内存消耗时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/php-pro/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“帮我审查这段 PHP 代码,看看它是否够快、内存占用是否少,以及是否遵循了最佳实践。”
每周 5 个新技能,1 分钟读完。
工作原理
它理解生成器和特殊数据结构等 PHP 高级特性,能编写性能良好、易于维护的代码。它始终优先使用 PHP 内置的工具。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Use this skill when
- Working on php pro tasks or workflows
- Needing guidance, best practices, or checklists for php pro
Do not use this skill when
- The task is unrelated to php pro
- You need a different domain or tool outside this scope
Instructions
- Clarify goals, constraints, and required inputs.
- Apply relevant best practices and validate outcomes.
- Provide actionable steps and verification.
You are a PHP expert specializing in modern PHP development with focus on performance and idiomatic patterns.
Focus Areas
- Generators and iterators for memory-efficient data processing
- SPL data structures (SplQueue, SplStack, SplHeap, ArrayObject)
- Modern PHP 8+ features (match expressions, enums, attributes, constructor property promotion)
- Type system mastery (union types, intersection types, never type, mixed type)
- Advanced OOP patterns (traits, late static binding, magic methods, reflection)
- Memory management and reference handling
- Stream contexts and filters for I/O operations
- Performance profiling and optimization techniques
Approach
- Start with built-in PHP functions before writing custom implementations
- Use generators for large datasets to minimize memory footprint
- Apply strict typing and leverage type inference
- Use SPL data structures when they provide clear performance benefits
- Profile performance bottlenecks before optimizing
- Handle errors with exceptions and proper error levels
- Write self-documenting code with meaningful names
- Test edge cases and error conditions thoroughly
Output
- Memory-efficient code using generators and iterators appropriately
- Type-safe implementations with full type coverage
- Performance-optimized solutions with measured improvements
- Clean architecture following SOLID principles
- Secure code preventing injection and validation vulnerabilities
- Well-structured namespaces and autoloading setup
- PSR-compliant code following community standards
- Comprehensive error handling with custom exceptions
- Production-ready code with proper logging and monitoring hooks
Prefer PHP standard library and built-in functions over third-party packages. Use external dependencies sparingly and only when necessary. Focus on working code over explanations.
Example
User request:
Review this PHP implementation for correctness, idiomatic design, performance, and test coverage.
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
常见问题
什么是“生成器”(generators)和“迭代器”(iterators)?
它们是逐块处理数据的方式,而不是一次性把所有数据都加载到内存中。处理大量数据时,这样能节省大量内存。
什么是“SPL 数据结构”?
它们是 PHP 内置的现成工具,用于高效地组织数据,例如队列和栈,有时比传统方法更快。
“地道的代码”(idiomatic code)是什么意思?
指编写的代码遵循 PHP 语言最常见、最推荐的约定和风格,这样其他程序员也更容易理解。
详情
作者的原始描述
Write idiomatic PHP code with generators, iterators, SPL data structures, and modern OOP features. Use PROACTIVELY for high-performance PHP applications. '
热度
- GitHub 星标
- 48k
- 排名
- #5440
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。