woocommerce-backend-dev

Guide WooCommerce backend PHP code implementation according to project conventions.

10.5k|10.7k|Updated Aug 9, 2011
One-click install
npx skills add https://github.com/woocommerce/woocommerce --skill woocommerce-backend-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: woocommerce-backend-dev
Source: https://github.com/woocommerce/woocommerce/tree/main/.ai/skills/woocommerce-backend-dev
Command: npx skills add https://github.com/woocommerce/woocommerce --skill woocommerce-backend-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines WooCommerce backend development by providing clear, actionable guidelines for coding standards, architecture, and best practices. It eliminates guesswork, ensures consistent, high-quality PHP code, and reduces the time spent on code reviews and refactoring.

Core Features & Use Cases

  • Structured Code Creation: Guides on creating new classes, methods, and organizing files according to WooCommerce's internal conventions, promoting maintainability.
  • Dependency Injection Mastery: Explains how to correctly use the DI container for managing class instances and dependencies, improving testability and flexibility.
  • Robust Data Handling: Provides principles for ensuring data integrity during CRUD operations, preventing accidental data loss and enhancing application reliability.
  • Use Case: A developer needs to add a new internal service to WooCommerce. Instead of spending time researching naming conventions, file locations, and DI patterns, they use this skill to get precise instructions on where to place the class, how to name its methods, and how to integrate it with the existing dependency injection system, accelerating development and reducing review cycles.

Quick Start

Use the woocommerce-backend-dev skill to explain the conventions for naming new class methods in WooCommerce.

Frequently Asked Questions about woocommerce-backend-dev

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

FAQPage Schema
How do I structure new classes in WooCommerce backend code?

WooCommerce backend code uses class-based structure in src/Internal with PSR-4 autoloading. Place new classes in the Internal namespace, follow naming conventions, use type annotations, and integrate with the dependency injection container for managing dependencies and improving testability.

What coding standards and conventions should I follow for WooCommerce PHP development?

WooCommerce backend development requires adherence to project coding style, naming conventions, type annotations, and linting standards. Use dependency injection for class dependencies, apply data integrity principles during CRUD operations, and structure code to ensure consistency across the codebase.

How do I use dependency injection in WooCommerce?

Dependency injection in WooCommerce involves using the DI container to manage class instances and dependencies. Register classes in the container, inject dependencies through constructors, and avoid direct instantiation to improve testability, flexibility, and maintainability of backend code.

How do I add hooks or filters to WooCommerce backend code?

When adding hooks or filters to WooCommerce backend, follow project conventions for naming, class organization, and integration with the DI system. Structure hook implementations as class methods within Internal classes, ensure type safety, and maintain consistency with existing backend patterns.

What should I know about data integrity when modifying WooCommerce backend code?

Data integrity during CRUD operations requires following WooCommerce principles to prevent accidental data loss. Apply validation, use type annotations, leverage the DI container for consistent data handling, and follow coding standards that enhance application reliability and maintainability.

Should I use this before writing WooCommerce PHP unit tests?

Yes, invoke WooCommerce backend conventions before writing PHP unit tests. Proper class structure, dependency injection setup, and adherence to coding standards ensure your backend code is testable, maintainable, and follows project patterns required for effective unit testing.