跳到正文
Skillpedia
API 与服务器(后端)48k · #5440

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/php-pro/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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

  1. Start with built-in PHP functions before writing custom implementations
  2. Use generators for large datasets to minimize memory footprint
  3. Apply strict typing and leverage type inference
  4. Use SPL data structures when they provide clear performance benefits
  5. Profile performance bottlenecks before optimizing
  6. Handle errors with exceptions and proper error levels
  7. Write self-documenting code with meaningful names
  8. 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. '

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5440
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能