php-specialist
PHP Specialist guides you through modern PHP 8.x development with language features like enums, readonly properties, and match expressions. It covers the complete toolchain: PSR interoperability, Composer dependency management, static analysis configuration, and coding standards enforcement. Apply it whenever you're authoring, reviewing, or refactoring PHP code to ensure type safety and architectural correctness.
PHP Specialist helps you write type-safe, modern PHP 8.x code using enums, readonly properties, PSR standards, and SOLID principles.
AI-generated summary based on this skill's SKILL.md
Decision gist · record as of 2026-03-16
PHP Specialist helps you write type-safe, modern PHP 8.x code using enums, readonly properties, PSR standards, and SOLID principles. PHP Specialist guides you through modern PHP 8.x development with language features like enums, readonly properties, and match expressions. It covers the complete toolchain: PSR interoperability, Composer dependency management, static analysis configuration, and coding standards enforcement. Apply it whenever you're authoring, reviewing, or refactoring PHP code to ensure type safety and architectural correctness.
Use it when
- PHP Specialist covers enums as type-safe alternatives to class constants, supporting both pure and backed variants (string/int).
- PHP Specialist guides PHPStan configuration from baseline through level 9 (strictest).
Verify before relying
Read SKILL.md below before installing (1 file). Open directory: indexed for reading, not audited.
Install
Pixel-Process-UG/superkit-agents/php-specialist · repository language: TypeScript
Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.
Frequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I write modern PHP 8 code with type safety?
PHP Specialist teaches you to leverage PHP 8.x's type system through union and intersection types, strict type declarations, and constructor promotion. Use `declare(strict_types=1)` at file start, apply named arguments for clarity, and adopt match expressions over switch for exhaustive pattern matching. Combine readonly properties (PHP 8.1+) and enums to build immutable, self-documenting structures that static analyzers can verify.
What are PHP 8.1 enums and readonly properties?
PHP Specialist covers enums as type-safe alternatives to class constants, supporting both pure and backed variants (string/int). Readonly properties prevent reassignment after initialization, enforcing immutability at the language level. Together they eliminate entire categories of bugs: enums guarantee valid states, readonly prevents accidental mutation. Use backed enums for database mapping; combine readonly with constructor promotion for concise, safe value objects.
How do I set up PHPStan static analysis?
PHP Specialist guides PHPStan configuration from baseline through level 9 (strictest). Create `phpstan.neon`, set your desired level, and exclude test/vendor directories. Integrate with your CI pipeline to catch type mismatches, undefined methods, and logic errors before runtime. Pair PHPStan with Psalm for complementary checks. Both tools enforce the type contracts your code declares, making refactoring safer and reducing production bugs.
How should I configure PSR-4 autoloading with Composer?
PHP Specialist recommends defining PSR-4 namespaces in your `composer.json` autoload section, mapping namespace prefixes to directory paths. Run `composer dump-autoload` to generate optimized class maps. This standard ensures your code integrates seamlessly with any PHP ecosystem tool. Combine PSR-4 with strict_types and static analysis to create a foundation where classes load predictably and type violations surface immediately.
How do I apply SOLID principles and interface-driven design in PHP?
PHP Specialist teaches dependency injection through constructor parameters typed to interfaces, not concrete classes. Define narrow, focused interfaces; implement them in multiple concrete classes. Use type hints everywhere to enforce contracts. This approach decouples components, simplifies testing (mock interfaces easily), and makes refactoring safe. Combined with static analysis, interface-driven design catches violations at analysis time, not runtime.
What's the best way to build immutable value objects and DTOs?
PHP Specialist advocates readonly properties (PHP 8.2 readonly classes for full immutability) paired with constructor promotion for compact syntax. Validate state in the constructor; throw custom exceptions for invalid input. Use backed enums for constrained fields. Build custom exception hierarchies inheriting from base exceptions for fine-grained error handling. These patterns create self-validating, type-safe data structures that static analyzers trust implicitly.
SKILL.md
Rendered from the published skill. Quoted content, verbatim.
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
- Identify PHP version
(truncated - see the full file via the links below)
File tree — 1 file
templates/skills/php-specialist/SKILL.md
Let your AI agent find skills like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.
wish › “Write type-safe, modern PHP 8.x code with enums, readonly properties, and strict types”
Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →
Related skills
PHP Pro is a senior-level specialist for modern PHP development with Laravel, Symfony, and PHP 8.3+. It enforces strict typing, dependency injection, and PSR compliance while generating typed DTOs, services, controllers, and comprehensive tests. Every implementation passes PHPStan level 9 and PHPUnit/Pest coverage thresholds before delivery.
This skill covers idiomatic PHP 8.x development, emphasizing strict typing, immutable data structures via readonly classes and enums, and domain-driven error handling. Learn named arguments, match expressions, constructor injection, and PSR-12 naming conventions alongside static analysis tools like PHPStan and Psalm.
This skill covers contemporary PHP development with PHP 7.4+ and 8.x features, including strict typing, constructor promotion, union and intersection types, and attributes. It explores object-oriented patterns through traits, interfaces, and abstract classes, plus enums and custom exception handling.
PHP Expert provides in-depth instruction on PHP 8+ language features including union types, named arguments, match expressions, attributes, and enums. Learn Laravel framework patterns, Composer dependency management, and object-oriented design principles for building robust applications.
Upgrade legacy PHP projects to current language standards using PHP 8.1+ features, strict typing, and modern patterns. This skill guides you through static analysis configuration, automated refactoring with Rector, code style fixes, and architectural improvements like DTOs and enums. It enforces best practices across PSR compliance, PHPStan levels, and framework-specific patterns while protecting critical code from unsafe transformations.
PHP guides you through modern language conventions, strict type declarations, and contemporary idioms for PHP 8.5+. It covers naming standards, type system rules, enumerations, class design patterns, and functional programming constructs to keep your code explicit and maintainable.
More skills Laravel Idioms (MIT) · php-best-practices (MIT) · php-rules (Apache-2.0) · php-development (Apache-2.0) · Php Modernization (NOASSERTION) · magento-php-specialist (MIT)