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انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“راجع هذا الكود للتأكد من توافقه مع أحدث إصدارات WooCommerce واتباعه أفضل ممارسات الأمان.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يحلل الوكيل الكود للتأكد من استخدامه الدوال الصحيحة للوصول إلى بيانات الطلبات والمنتجات وحفظها، وأن التحققات الخاصة بالدفع وإتمام الشراء تتم على الخادم.
المحتوى التقني (ملف 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
- 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
class_exists( 'WooCommerce' )before anywc_*call orwoocommerce_*hook.
The Rules
Order and product data — must fix
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()withpost_type => shop_order, and direct$wpdbjoins on postmeta. These work on legacy stores and silently break on HPOS stores. Details: references/hpos-and-crud.md.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 throughwc_update_product_stock()semantics; order state changes through$order->update_status()— which fire the emails and hooks the store expects.Declare feature compatibility. Any extension touching orders declares HPOS compatibility (
FeaturesUtil::declare_compatibility( 'custom_order_tables', … )); any extension touching checkout declarescart_checkout_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
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()` قد يجعل الكود يتوقف عن العمل بشكل صحيح في تلك المتاجر.
ماذا يعني «التحقق من إتمام الشراء على الخادم» (validate checkout server-side)؟
يعني أن الفحوصات المهمة لإتمام الطلب، مثل توفر المخزون أو معلومات الدفع، يجب أن تتم على الخادم، لا في متصفح العميل فقط. وهذا ضروري للأمان.
لماذا يجب أن يعلن الكود توافقه مع HPOS وكتل إتمام الشراء؟
إعلان التوافق يخبر WooCommerce والمطورين الآخرين أن الكود مُختبَر ويعمل مع الطرق الأحدث لإدارة الطلبات (HPOS) ونظام إتمام الشراء الحديث (blocks)، فيمنع التحذيرات والمشكلات لصاحب المتجر.
التفاصيل
الوصف الأصلي من المؤلف
Review generated or changed WooCommerce extensions, payment and shipping integrations, checkout customizations, and order or product logic.
الشعبية
- نجوم GitHub
- 48k
- الترتيب
- #6193
- الترخيص
- MIT
- آخر تحديث
- 15/10/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
00-andruia-consultant
48kيساعد وكيلك على بدء مشاريع الذكاء الاصطناعي أو تحسينها. يحلل الكود ويقترح الأدوات ويُعد خطط عمل بالإسبانية.
007
48kيتيح لوكيلك إجراء تدقيقات أمنية ونمذجة التهديدات. مفيد لحماية المشاريع من الهجمات والثغرات الأمنية.
10-andruia-skill-smith
48kيساعد وكيلك على إنشاء أدوات الذكاء الاصطناعي أو تحسينها. يحدد طريقة عملها، ويكتب توثيقها، ويتحقق من بنيتها.
20-andruia-niche-intelligence
48kيتيح لوكيلك إعداد ملخص عن صناعة محددة. مفيد لفهم السياق والقواعد وأنماط الاستخدام والمخاطر لمشروع ما، باستخدام مصادر موثوقة.
مهارات مشابهة
api-connector-builder
280kيبني وكيلك اتصالات API جديدة على النمط الموجود، ويفيد عندما تحتاج إلى تكامل إضافي دون ابتكار طريقة جديدة للعمل.
api-design
280kيساعد وكيلك على تصميم واجهات REST API وفق أفضل الممارسات، ويوضح كيف تتواصل وكيف تُعرض الأخطاء وكيف تُنظَّم البيانات.
backend-patterns
280kيساعد وكيلك على أنماط بنية الخادم وتحسين قاعدة البيانات، ويفيد في بناء الشيفرة التي تعمل على الخادم أو مراجعتها.