woo-plugin-dev

Create WooCommerce extensions/plugins — file structure, main plugin file, activation/deactivation hooks, custom database tables, autoloading, and WordPress plugin API. Use when building new WooCommerce extensions or structuring plugin code.

17 stars

Best use case

woo-plugin-dev is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Create WooCommerce extensions/plugins — file structure, main plugin file, activation/deactivation hooks, custom database tables, autoloading, and WordPress plugin API. Use when building new WooCommerce extensions or structuring plugin code.

Teams using woo-plugin-dev should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/woo-plugin-dev/SKILL.md --create-dirs "https://raw.githubusercontent.com/OrcaQubits/agentic-commerce-skills-plugins/main/dist/antigravity/woocommerce-commerce/.agent/skills/woo-plugin-dev/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/woo-plugin-dev/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How woo-plugin-dev Compares

Feature / Agentwoo-plugin-devStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Create WooCommerce extensions/plugins — file structure, main plugin file, activation/deactivation hooks, custom database tables, autoloading, and WordPress plugin API. Use when building new WooCommerce extensions or structuring plugin code.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# WooCommerce Extension / Plugin Development

## Before writing code

**Fetch live docs**:
1. Fetch `https://developer.wordpress.org/plugins/` for WordPress Plugin Handbook
2. Fetch `https://developer.woocommerce.com/docs/extension-guidelines/` for WooCommerce extension guidelines
3. Web-search `site:developer.woocommerce.com extension development best practices` for current patterns

## Main Plugin File

### Required Headers

```php
<?php
/**
 * Plugin Name: My WooCommerce Extension
 * Plugin URI:  https://example.com/my-extension
 * Description: A WooCommerce extension that does X.
 * Version:     1.0.0
 * Author:      Your Name
 * Author URI:  https://example.com
 * License:     GPL-2.0-or-later
 * Text Domain: my-woo-extension
 * Domain Path: /languages
 * Requires at least: 6.4
 * Requires PHP: 8.0
 * Requires Plugins: woocommerce
 * WC requires at least: 8.0
 * WC tested up to: 9.5
 */
```

### Guarding Against Direct Access

Every PHP file starts with: `defined( 'ABSPATH' ) || exit;`

### WooCommerce Dependency Check

Before initializing, verify WooCommerce is active:
- Check `class_exists( 'WooCommerce' )` in a `plugins_loaded` hook
- Or use `Requires Plugins: woocommerce` header (WordPress 6.5+)

## Activation & Deactivation

### Activation Hook

`register_activation_hook( __FILE__, 'my_plugin_activate' )` — runs on first activation:
- Create custom database tables (via `dbDelta()`)
- Add default options (`add_option()`)
- Schedule recurring actions (Action Scheduler)
- Flush rewrite rules if registering custom post types

### Deactivation Hook

`register_deactivation_hook( __FILE__, 'my_plugin_deactivate' )` — runs when deactivated:
- Unschedule cron/Action Scheduler events
- Flush rewrite rules
- Do NOT delete data (that's for uninstall)

### Uninstall

Use `uninstall.php` (preferred) or `register_uninstall_hook()`:
- Delete custom options, transients, custom tables
- Clean up user meta, post meta
- Only runs when user explicitly deletes the plugin

## Custom Database Tables

### Using `$wpdb` and `dbDelta()`

Create tables on activation:
- Use `$wpdb->prefix` for table name prefix
- Define schema with `dbDelta()` from `wp-admin/includes/upgrade.php`
- `dbDelta()` is idempotent — handles CREATE and ALTER
- Store DB version in an option to manage schema upgrades

### Table Naming

Convention: `{$wpdb->prefix}wc_my_extension_tablename`

## Autoloading

### Composer PSR-4

Standard approach for namespaced classes:
- Configure `autoload.psr-4` in `composer.json`
- `require __DIR__ . '/vendor/autoload.php'` in main plugin file
- Namespace convention: `MyVendor\MyExtension\`

### WordPress File-Based

Legacy approach: `require_once` individual files in an `includes/` directory. Still common in WooCommerce core.

## Plugin Architecture Patterns

### Singleton Main Class

Common WooCommerce extension pattern:
- Private constructor
- Static `instance()` method
- `init()` method that registers all hooks
- Accessed via global function (e.g., `my_extension()`)

### Service Container (Advanced)

For larger extensions, use a lightweight DI container or service provider pattern with constructor injection.

### Feature Flags

Use WooCommerce's `FeaturesUtil` to declare compatibility:
- `custom_order_tables` — HPOS support
- `cart_checkout_blocks` — Block checkout support

## Coding Standards

### WordPress Coding Standards (WPCS)

- **Tabs** for indentation (not spaces)
- **Yoda conditions**: `if ( 'value' === $var )`
- **Braces** on same line for functions/control structures
- **Spaces** inside parentheses: `if ( $condition )`
- **Prefix** all globals: functions, classes, hooks, options, constants
- **Escaping** all output: `esc_html()`, `esc_attr()`, `esc_url()`, `wp_kses()`
- **Sanitizing** all input: `sanitize_text_field()`, `absint()`, `wp_unslash()`
- **Nonces** for all form submissions and AJAX

## Best Practices

- Use `Requires Plugins: woocommerce` header (WordPress 6.5+)
- Declare HPOS compatibility in every extension
- Use Composer autoloading for new code
- Prefix everything to avoid naming collisions
- Internationalize all user-facing strings with `__()`, `_e()`, `esc_html__()`
- Load text domain via `load_plugin_textdomain()`
- Use WordPress built-in functions over raw PHP equivalents (`wp_remote_get()` vs `curl`)
- Never modify WooCommerce core files — always use hooks

Fetch the WordPress Plugin Handbook and WooCommerce extension guidelines for exact patterns and current requirements before implementing.

Related Skills

medusa-plugins

17
from OrcaQubits/agentic-commerce-skills-plugins

Develop and publish Medusa v2 plugins — plugin structure, plugin vs module comparison, npm packaging, and reusable plugin template. Use when building distributable Medusa extensions.

magento-plugins-interceptors

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement Magento 2 plugins (interceptors) — before, after, and around methods for modifying class behavior without inheritance. Use when extending core or third-party module functionality.

woo-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Test WooCommerce extensions — PHPUnit unit/integration tests, WP test suite, WooCommerce test helpers, E2E with Playwright, and WP-CLI test scaffolding. Use when writing tests for WooCommerce plugins or setting up a test environment.

woo-shipping

17
from OrcaQubits/agentic-commerce-skills-plugins

Build WooCommerce shipping methods — WC_Shipping_Method, shipping zones, shipping classes, rate calculation, tracking, and integration with carriers. Use when creating custom shipping integrations or configuring shipping logic.

woo-setup

17
from OrcaQubits/agentic-commerce-skills-plugins

Install WooCommerce, configure the development stack, and set up a local dev environment with WP-CLI, Docker, or wp-env. Use when setting up a new WooCommerce project or development environment.

woo-security

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement WooCommerce security — nonces, capabilities, input sanitization, output escaping, data validation, PCI compliance considerations, and WordPress security best practices. Use when hardening a WooCommerce store or reviewing security posture.

woo-performance

17
from OrcaQubits/agentic-commerce-skills-plugins

Optimize WooCommerce performance — object caching, transients, HPOS, database optimization, Action Scheduler, lazy loading, and query optimization. Use when improving store performance or diagnosing slowness.

woo-payments

17
from OrcaQubits/agentic-commerce-skills-plugins

Build WooCommerce payment gateways — WC_Payment_Gateway, direct/redirect/hosted integrations, tokenization, subscriptions support, refunds, and PCI compliance. Use when creating custom payment method integrations.

woo-hooks-filters

17
from OrcaQubits/agentic-commerce-skills-plugins

Master the WordPress hook system for WooCommerce — actions, filters, hook priorities, WooCommerce-specific hooks, and extensibility patterns. Use when adding functionality via hooks or understanding the WooCommerce execution flow.

woo-frontend

17
from OrcaQubits/agentic-commerce-skills-plugins

Customize WooCommerce frontend — template overrides, theme integration, shortcodes, hooks for product/cart/checkout display, and WooCommerce block themes. Use when modifying the storefront appearance or building WooCommerce themes.

woo-deploy

17
from OrcaQubits/agentic-commerce-skills-plugins

Deploy WooCommerce — WP-CLI automation, database migrations, zero-downtime updates, staging workflows, environment configuration, and CI/CD patterns. Use when deploying WooCommerce stores or setting up deployment pipelines.

woo-data-stores

17
from OrcaQubits/agentic-commerce-skills-plugins

Work with WooCommerce CRUD data stores — WC_Product, WC_Order, WC_Customer, WC_Coupon data objects, custom data stores, HPOS migration, and getters/setters. Use when creating or modifying WooCommerce data objects or implementing custom data stores.