/woocommerce-commerce:php-modernfrom woocommerce-commerce
Guides writing modern PHP 8.x code with typed properties, enums, readonly classes, match expressions, named arguments, union/intersection types, fibers, attributes, and constructor promotion. For WooCommerce or any PHP 8.x project.
Ships in woocommerce-commerce. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Fetch live docs: Web-search site:php.net manual migration for the latest PHP migration guide and new features. Check https://www.php.net/releases/ for current supported versions.
Declare and assign properties directly in the constructor signature — eliminates boilerplate. Useful in WooCommerce extension classes.
Call functions with parameter names: array_slice(array: $arr, offset: 2). Improves readability for functions with many parameters.
Type-safe switch replacement that returns a value. No fall-through, strict comparison. Better than switch for value mapping.
int|string in parameter and return types. Allows multiple type declarations.
$obj?->method()?->property — short-circuits to null if any part is null. Replaces nested null checks.
Native metadata annotations: #[Route('/path')], #[Override]. Replace docblock annotations with first-class language support.
First-class enumerations — backed (string/int) and unit enums. Perfect for status codes, types, categories. Use backed enums for database/API values.
public readonly string $name — can only be set once (usually in constructor). Enforces immutability.
Lightweight concurrency primitives — PHP-level coroutines. Foundation for async frameworks.
TypeA&TypeB — value must satisfy ALL types. Useful for ensuring a parameter implements multiple interfaces.
strlen(...) creates a Closure from a function. Cleaner than Closure::fromCallable('strlen').
readonly class Dto { ... } — all properties are implicitly readonly. Perfect for Data Transfer Objects and value objects.
Creating properties not declared in the class is deprecated. Always declare properties.
true, false, null as standalone types in declarations.
Traits can now define constants.
const string NAME = 'value'; — type-safe constants. Strengthens contract enforcement.
#[\Override] AttributeDocuments that a method intentionally overrides a parent method. Compiler error if the parent method doesn't exist.
json_validate() FunctionValidate JSON without decoding — faster than json_decode + error check.
$class::{$constant} — dynamic constant access.
Define get/set behavior directly on properties:
public string $name {
set => strtolower($value);
get => ucfirst($this->name);
}
public private(set) string $name — readable publicly, writable only privately.
declare(strict_types=1); in all files?string or string|nullUse readonly classes for DTOs and value objects — common in service layers.
Replace string/int constants with backed enums for order statuses, product types, etc.
WPCS uses tabs for indentation and Yoda conditions ('value' === $var). This differs from PSR-12 (spaces, non-Yoda). When writing WooCommerce extensions, follow WPCS; for standalone PHP libraries, follow PSR-12.
declare(strict_types=1);#[\Override] when overriding parent methodsFetch php.net docs for exact syntax and behavior of new features before using them.
What SKILL.md sets; muted values are Claude Code's defaults
20 skills in this plugin
/php-patternsApply PHP design patterns — Singleton, Factory, Strategy, Observer, Repository, Decorator, and Dependency Injection in PHP. Use when structuring WooCommerce extension code or implementing complex business logic./php-testingWrite PHP tests with PHPUnit — unit tests, mocking, data providers, assertions, test doubles, and TDD workflow. Use when writing tests for WooCommerce extensions or PHP projects./woo-adminBuild WooCommerce admin interfaces — settings pages, admin menus, product data tabs/panels, order meta boxes, WooCommerce Admin (React analytics), and reports. Use when creating admin-facing configuration or display pages.npx claudepluginhub orcaqubits/agentic-commerce-skills-plugins --plugin woocommerce-commerceOther plugins' skills for the same job