home / skills / secondsky / claude-skills / woocommerce-backend-dev
/plugins/woocommerce-backend-dev/skills/woocommerce-backend-dev
This skill guides backend WooCommerce PHP development, ensuring code follows project conventions, naming, hooks, tests, and WordPress standards.
npx playbooks add skill secondsky/claude-skills --skill woocommerce-backend-devReview the files below or copy the command above to add this skill to your agents.
---
name: woocommerce-backend-dev
description: Add or modify WooCommerce backend PHP code following project conventions. Use when creating new classes, methods, hooks, or modifying existing backend code in WooCommerce projects.
---
# WooCommerce Backend Development
This skill provides guidance for developing WooCommerce backend PHP code according to project standards and conventions.
## Instructions
Follow WooCommerce project conventions when adding or modifying backend PHP code:
1. **Creating new code structures**: See [file-entities.md](file-entities.md) for conventions on creating classes and organizing files (but for new unit test files see [unit-tests.md](unit-tests.md)).
2. **Naming conventions**: See [code-entities.md](code-entities.md) for naming methods, variables, and parameters
3. **Coding style**: See [coding-conventions.md](coding-conventions.md) for general coding standards and best practices
4. **Working with hooks**: See [hooks.md](hooks.md) for hook callback conventions and documentation
5. **Dependency injection**: See [dependency-injection.md](dependency-injection.md) for DI container usage
6. **Data integrity**: See [data-integrity.md](data-integrity.md) for ensuring data integrity when performing CRUD operations
7. **Writing tests**: See [unit-tests.md](unit-tests.md) for unit testing conventions
## Key Principles
- Always follow WordPress Coding Standards
- Use class methods instead of standalone functions
- Place new internal classes in `src/Internal/` by default
- Use PSR-4 autoloading with `Automattic\WooCommerce` namespace
- Write comprehensive unit tests for new functionality
- Run linting and tests before committing changes
- Prefer bun over npm/bunx for Node.js package management when applicable
## Version Information
To determine the next WooCommerce version number for `@since` annotations:
- Read the `$version` property in `includes/class-woocommerce.php` **on the trunk branch**
- Remove the `-dev` suffix if present
- Example: If trunk shows `10.4.0-dev`, use `@since 10.4.0`
- Note: When reviewing PRs against trunk, the version in trunk is correct even if it seems "future" relative to released versions
This skill guides developers to add or modify WooCommerce backend PHP code following the project conventions and standards. It focuses on class-based development, PSR-4 autoloading, dependency injection, and unit testing to ensure maintainable and production-ready backend changes.
The skill inspects the requested backend change and maps it to the project conventions: file placement, naming, hook usage, and test requirements. It enforces class-based implementations under the Automattic\WooCommerce namespace, recommends placing new internal classes in src/Internal, and provides steps for dependency injection and data integrity checks. It also explains how to determine correct @since version annotations from the trunk version.
How do I determine the @since version for a new class or method?
Read the $version property in includes/class-woocommerce.php on the trunk branch, remove any -dev suffix, and use that value for @since annotations.
Where should I put new internal classes?
Place new internal classes in src/Internal/ by default and use the Automattic\WooCommerce namespace with PSR-4 autoloading.
Are standalone functions allowed?
Prefer class methods instead of standalone functions; use standalone functions only when project conventions explicitly permit them.