poocommerce-backend-dev

Write PooCommerce backend PHP code following WordPress Coding Standards and PSR-4.

2|Updated Nov 8, 2024
One-click install
npx skills add https://github.com/notmattpress/poocommerce --skill poocommerce-backend-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: poocommerce-backend-dev
Source: https://github.com/notmattpress/poocommerce/tree/main/.ai/skills/woocommerce-backend-dev
Command: npx skills add https://github.com/notmattpress/poocommerce --skill poocommerce-backend-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Developing backend PHP code that adheres to complex project standards can be challenging and lead to inconsistencies. This Skill provides comprehensive guidance, ensuring new or modified code follows all PooCommerce conventions, from file structure to testing, reducing errors and rework.

Core Features & Use Cases

  • Structured Code Creation: Guidelines for class creation, file organization, and namespace conventions (e.g., src/Internal/ by default).
  • Naming & Style Enforcement: Rules for snake_case naming, method visibility, static methods, and WordPress Coding Standards.
  • Data Integrity & Security: Best practices for preventing data loss, handling race conditions, and validating operations.
  • Testing & Documentation: Conventions for writing unit tests, using @testdox, and documenting hooks and methods with @since annotations.
  • Use Case: When creating a new feature, use this Skill to ensure every aspect of your backend PHP code, from class structure to hook documentation, aligns perfectly with PooCommerce's established standards.

Quick Start

Use the poocommerce-backend-dev skill to create a new internal utility class named 'OrderHelper' in 'src/Internal/Utils/' with a private method 'calculate_discount'.

Frequently Asked Questions about poocommerce-backend-dev

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure PHP classes in PooCommerce backend development?

PooCommerce backend code uses PSR-4 autoloading with classes organized in `src/Internal/` by default, following WordPress Coding Standards. Use `snake_case` for file and method names, include PHPDoc type annotations, and apply dependency injection for external dependencies to maintain consistency and testability.

What coding standards should I follow when writing PooCommerce PHP code?

Follow WordPress Coding Standards, PSR-4 autoloading conventions, and PooCommerce naming rules. Apply dependency injection patterns, use PHPDoc annotations with `@since` tags, enforce method visibility, and validate all operations for data integrity. Unit tests must be written before committing changes.

How do I write unit tests for PooCommerce backend PHP code?

Write unit tests before committing backend changes using the project's testing framework. Use `@testdox` annotations for test documentation, follow the established testing patterns in the codebase, and ensure tests cover data integrity, race conditions, and validation logic to maintain code quality.

Can I use dependency injection in PooCommerce backend development?

Yes. Dependency injection is a core PooCommerce convention for managing class dependencies. It improves testability, reduces tight coupling, and ensures cleaner code structure. All new classes and methods should apply this pattern consistently with project standards.

What should I do before creating a new PooCommerce backend feature class?

Review PooCommerce naming conventions, file organization rules, and namespace structure (typically `src/Internal/` for internal utilities). Plan your class design around dependency injection, ensure PHPDoc annotations are complete, and prepare unit tests before implementing code.