本文へスキップ
Skillpedia
APIとサーバー(バックエンド)48k · #6193

woo-guard

できること

このエージェントは、WooCommerceで構築されたオンランストアのコードが安全で、最新の状態に保たれているかを確認します。特に決済、配送、注文処理の面で、最新のWooCommerceバージョンでも正しく動作するかをチェックします。

使う場面

  • ✓WooCommerceストアの新規または変更されたコードをレビューするとき。
  • ✓WooCommerceストアの新機能や更新を公開する前。
  • ✓コードが注文、決済、チェックアウトのシステムとやり取りするとき。

スキルのリンク

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/woo-guard/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/woo-guard/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“このコードが最新のWooCommerceバージョンに対応しており、セキュリティのベストプラクティスに従っているか確認してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントはコードを分析し、注文データや商品データへのアクセスと保存に正しい関数を使っているか、また決済やチェックアウトの検証がサーバー側で行われているかを確認します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

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 get_post_meta() (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 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

  1. Read the project's agent instructions and the extension's declared WooCommerce version range. Project conventions win on conflict.
  2. Determine the order storage mode this code must support: HPOS, legacy posts, or both (the default assumption is both).
  3. Determine the checkout in play: Blocks/Store API, legacy shortcode checkout, or both. Hooks for one do not fire in the other.
  4. Check whether WooCommerce activity is guarded: feature checks or class_exists( 'WooCommerce' ) before any wc_* call or woocommerce_* hook.

The Rules

Order and product data — must fix

  1. Orders are not posts. Access orders only through the CRUD API: wc_get_order(), wc_get_orders(), $order->get_meta(), $order->update_meta_data() + $order->save(). Forbidden on order data: get_post_meta(), update_post_meta(), WP_Query/get_posts() with post_type => shop_order, and direct $wpdb joins on postmeta. These work on legacy stores and silently break on HPOS stores. Details: references/hpos-and-crud.md.

  2. CRUD objects, getters/setters, then save. Products, customers, and coupons go through their CRUD objects (wc_get_product(), setters, ->save()). Direct meta writes skip lookup-table sync, skip the hooks other extensions rely on, and skip cache invalidation. Stock changes go through wc_update_product_stock() semantics; order state changes through $order->update_status() — which fire the emails and hooks the store expects.

  3. Declare feature compatibility. Any extension touching orders declares HPOS compatibility (FeaturesUtil::declare_compatibility( 'custom_order_tables', … )); any extension touching checkout declares cart_checkout_blocks compatibility (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

  1. Checkout validation is server-side. Validate at woocommerce_checkout_process (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.

…

よくある質問

注文データにアクセスするのに`get_post_meta()`を使ってはいけないのはなぜですか?

新しいWooCommerceのバージョン(HPOS)では、注文は通常の投稿としては保存されなくなりました。`get_post_meta()`を使うと、そのようなストアでコードが正しく動作しなくなることがあります。

「チェックアウトをサーバー側で検証する」とはどういう意味ですか?

注文を完了できるかを確認する重要なチェック(在庫の有無や決済情報など)を、顧客のブラウザ内だけでなく、サーバー上で行うという意味です。セキュリティ上非常に重要です。

コードがHPOSやチェックアウトブロックへの対応を宣言すべきなのはなぜですか?

対応を宣言することで、WooCommerceや他の開発者に、コードが新しい注文管理の方式(HPOS)やモダンなチェックアウトシステム(ブロック)でテスト済みで動作することを伝えられます。これにより、ストア管理者に警告や問題が発生するのを防げます。

詳細

作者による元の説明

Review generated or changed WooCommerce extensions, payment and shipping integrations, checkout customizations, and order or product logic.

repo: sickn33/agentic-awesome-skills

人気

GitHubのスター
48k
ランキング
#6193
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル