npx skills add amelnagdy/guard-skills --skill woo-guard
sickn33/agentic-awesome-skills
woo-guard
Review generated or changed WooCommerce extensions, payment and shipping integrations, checkout customizations, and order or product logic.
Installation
npx skills add sickn33/agentic-awesome-skills --skill woo-guard
Similar popular skills
Related neighbors and high-traction skills in the same topics — useful to compare before installing.
Helps users discover and install agent skills when they ask questions like "how do I do X", "fi…
3.3M installsBrowser automation CLI for AI agents. Use when the user needs to interact with websites, includ…
810.4K installsReview UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "chec…
617.3K installsBuild, deploy, evaluate, optimize, fine-tune, and manage Microsoft Foundry agents, models, and …
576.5K installsPrepare azd-based Azure projects for deployment: generates azure.yaml, infrastructure (Bicep/Te…
568.3K installsAlso in this package
Other skills from sickn33/agentic-awesome-skills · top by installs.
npx skills add sickn33/agentic-awesome-skills
More details
Agent compatibility
Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.
Also listed on
Alternate registries and mirrors of this skill.
Repository health
main
Package contents
Files included with this skill beyond the listing page.
-
skill md
SKILL.md8,295 B -
docs
SUMMARY.md156 B
History
- First seen on skills.sh
- First recorded snapshot · 5 installs
SKILL.md
Woo Guard
You are reviewing generated or changed WooCommerce code before it ships. Apply the rules below as a guard pass after the first implementation pass. WooCommerce is a moving platform — order storage changed engines, checkout changed frameworks — and code written from memory targets the WooCommerce of three years ago. With money on the line, "works on my demo store" is not a standard.
These rules exist because AI agents produce WooCommerce code with systematic failures: order meta read through getpostmeta() (broken on HPOS stores), products updated by direct meta writes that skip lookup tables and hooks, checkout validated only in JavaScript, prices computed in floats, and woocommerce_* hooks registered before confirming WooCommerce is active.
When to Use
Use this skill when reviewing generated or changed WooCommerce code — extensions, payment and shipping integrations, checkout customizations, and order/product logic — before it ships. Activate it reactively after an agent writes or modifies WooCommerce hooks, HPOS logic, or checkout flows.
How to use this skill
Guard-pass mode (recommended): after WooCommerce code has been generated or edited, apply the rules to the diff or target files, then run the self-check before delivery.
Live mode (explicit): when the user invokes this skill before writing WooCommerce code, apply the same rules while writing, then run the self-check before delivery.
Review mode (the user asks you to review or audit WooCommerce code): walk [references/review-checklist.md](references/review-checklist.md) and produce a structured findings report. Do not edit code in review mode unless asked.
Security floor — these hold in all WooCommerce code, at maximum severity, because money is on the line:
- Escape all output with the context-correct
esc_*function. wp_unslash()then sanitize all request data before it touches logic.- Capability check plus nonce on every state change.
$wpdb->prepare()for every query containing a variable.
If wp-guard is installed, run it alongside for the full WordPress layer.
Adapt to the project first
- Read the project's agent instructions and the extension's declared WooCommerce version range. Project conventions win on conflict.
- Determine the order storage mode this code must support: HPOS, legacy posts, or both (the default assumption is both).
- Determine the checkout in play: Blocks/Store API, legacy shortcode checkout, or both. Hooks for one do not fire in the other.
- Check whether WooCommerce activity is guarded: feature checks or
classexists( 'WooCommerce' )before anywccall orwoocommerce_hook.
The Rules
Order and product data — must fix
- Orders are not posts. Access orders only through the CRUD API:
wcgetorder(),wcgetorders(),$order->getmeta(),$order->updatemetadata()+$order->save(). Forbidden on order data:getpostmeta(),updatepostmeta(),WPQuery/getposts()withposttype => shop_order, and direct$wpdbjoins on postmeta. These work on legacy stores and silently break on HPOS stores. Details: [references/hpos-and-crud.md](references/hpos-and-crud.md).
- CRUD objects, getters/setters, then save. Products, customers, and coupons go through their CRUD objects (
wcgetproduct(), setters,->save()). Direct meta writes skip lookup-table sync, skip the hooks other extensions rely on, and skip cache invalidation. Stock changes go throughwcupdateproductstock()semantics; order state changes through$order->updatestatus()— which fire the emails and hooks the store expects.
- Declare feature compatibility. Any extension touching orders declares HPOS compatibility (
FeaturesUtil::declarecompatibility( 'customordertables', … )); any extension touching checkout declarescartcheckout_blockscompatibility (or incompatibility, honestly). A missing declaration shows every store owner a warning banner with your plugin's name on it.
Checkout and money — must fix
- Checkout validation is server-side. Validate at
woocommercecheckoutprocess(legacy) or through Store API extension schemas (Blocks). JavaScript validation is UX, never security. Know which checkout the store runs and wire both when the extension claims general compatibility.
- Money is not a float. Prices and totals go through
wcformatdecimal()for storage-safe values,wcprice()for display, and WooCommerce's own tax/rounding settings for arithmetic. No hand-rolled currency symbols, nonumberformat()on prices, no float equality on totals.
Runtime discipline — should fix
- Guard the runtime context.
WC()->cartandWC()->sessionare null in REST, cron, CLI, and admin contexts — check before touching them. Never assume a logged-in customer in webhook or gateway callbacks. Verify everywoocommercehook andwcfunction exists in the supported version range — WooCommerce renames and retires hooks across majors.
- Hooks over template overrides. Prefer, in order: existing WooCommerce hooks/filters → the
woocommercelocatetemplatefilter → a theme-level override. A template override shipped inside a plugin freezes a copied file at one WooCommerce version and breaks on template updates — flag it in review, always.
- Background work scales with order volume. Batch jobs, syncs, and webhook fan-out go through Action Scheduler (bundled with WooCommerce), not raw WP-Cron loops. Handlers are idempotent — order events fire more than once in real stores.
Self-check before delivery
- Grep your diff for
getpostmeta,updatepostmeta,posttype => 'shoporder': any of them touching orders? (Rule 1) - Any product/order/customer write that bypasses a CRUD object's
save()? (Rule 2) - Does the extension declare HPOS (and checkout-blocks, if relevant) compatibility? (Rule 3)
- Is every checkout rule enforced server-side, for the checkout(s) the store actually runs? (Rule 4)
- Any float arithmetic, hardcoded currency symbol, or
number_format()on money? (Rule 5) - Any
WC()->cart/WC()->sessionaccess that can run in REST/cron/CLI? Any unverified hook name? (Rule 6) - Any template file shipped in the plugin? (Rule 7)
- Security floor: every output escaped, every request input unslashed then sanitized, every state change capability-checked and nonce-verified, every variable query prepared?
If any answer is wrong, fix it before showing the user.
Reporting format (review mode)
**Rule N violation** in `path/file.php:<line or function>`
- What: <one sentence>
- Risk: <HPOS breakage / skipped hooks / money error / checkout bypass — one phrase>
- Fix: <one sentence>
Group by file, lead with Rules 1–5 findings. If a file is clean, don't mention it.
Severity guide
- Must fix: Rules 1–5 — broken stores, skipped business logic, wrong money
- Should fix: Rules 6–8 — context crashes, update fragility, jobs that die at scale
References
- [references/hpos-and-crud.md](references/hpos-and-crud.md) — HPOS background, CRUD patterns, compatibility declaration, violation table
- [references/checkout-and-money.md](references/checkout-and-money.md) — legacy vs Blocks checkout, Store API validation, price and currency handling
- [references/review-checklist.md](references/review-checklist.md) — structured walk-through for review mode
- [references/sources.md](references/sources.md) — WooCommerce developer documentation URLs; read only when citing
What this skill does not do
- Cover the full WordPress layer beyond the security floor — i18n and asset/query discipline are wp-guard's jurisdiction when it is installed.
- Review store configuration, theme styling, or payment provider account setup.
- Decide pricing or business logic — it guards how WooCommerce code ships, not what the store sells.