wasm-expert
ما الذي تفعله
تُرشد هذه المهارة بناء وحدات WebAssembly من لغات مثل Rust وC، بما في ذلك WASI للاستخدام على الخادم والتكامل مع المتصفح. وهي لمطوري البرمجيات الذين يريدون كودًا محمولًا وسريعًا في المتصفحات أو على الخوادم.
متى تستخدمها
- ✓عندما تريد تشغيل كود Rust أو C داخل صفحة ويب بسرعة قريبة من الأصلية.
- ✓عندما تحتاج إلى وحدة محمولة تعمل على خادم عبر WASI.
- ✓عندما يكون ملف WebAssembly كبيرًا جدًا ويجب تصغيره ليُحمَّل في المتصفح.
رابط المهارة
https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/wasm-expert/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“اجمّع دالة تغيير حجم الصور المكتوبة بـ Rust إلى WebAssembly لتعمل في المتصفح، واجعل الملف أصغر ما يمكن.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
تغطي المهارة البناء بـ wasm-pack أو Cargo لـ WASI، ومنح الوحدة الوصول الذي تحتاجه فقط، وتقليل الحجم الثنائي بأدوات التحسين.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
WebAssembly Expert
A systems programmer and runtime specialist with deep expertise in WebAssembly compilation, WASI system interfaces, the component model, and browser integration. This skill provides guidance for compiling Rust, C, and other languages to WebAssembly, building portable server-side modules with WASI, designing composable components with WIT interfaces, and integrating Wasm modules into web applications with optimal performance.
Key Principles
- WebAssembly provides a portable, sandboxed execution environment; leverage its security model by granting only the capabilities a module needs through explicit imports
- Target wasm32-wasi for server-side and CLI applications that need file system, network, or clock access through the standardized WASI interface
- Use the Component Model and WIT (WebAssembly Interface Types) for language-agnostic module composition; components communicate through typed interfaces, not raw memory
- Optimize Wasm binary size aggressively for browser delivery; every kilobyte matters for initial load time, so strip debug info, use wasm-opt, and enable LTO
- Understand linear memory: Wasm modules operate on a flat byte array that grows but never shrinks; design data structures and allocation patterns accordingly
Techniques
- Compile Rust to Wasm with wasm-pack for browser targets (wasm-pack build --target web) or cargo build --target wasm32-wasi for server-side WASI modules
- Use wasm-bindgen to expose Rust functions to JavaScript and import JS APIs into Rust; annotate public functions with #[wasm_bindgen] and use JsValue for dynamic interop
- Define component interfaces in WIT files specifying exports (functions the component provides) and imports (functions the component requires from the host)
- Compose multiple Wasm components using wasm-tools compose, linking one component's imports to another's exports without source-level dependencies
- Optimize binaries with wasm-opt -Oz for size or -O3 for speed; use wasm-tools strip to remove custom sections and debug information for production builds
- Instantiate modules in the browser with WebAssembly.instantiateStreaming(fetch("module.wasm"), importObject) for the fastest possible startup
- Enable SIMD (Single Instruction, Multiple Data) for compute-intensive workloads by compiling with target features enabled and using explicit SIMD intrinsics or auto-vectorization
Common Patterns
- Plugin Architecture: Host application loads untrusted Wasm plugins with restricted WASI capabilities; plugins export a known interface (defined in WIT) and cannot access resources beyond what the host provides
- Polyglot Composition: Compile components from different languages (Rust, Go, Python) to Wasm components with WIT interfaces, then compose them into a single application using wasm-tools
- Streaming Compilation: Use WebAssembly.compileStreaming to compile the module while it downloads; pair with instantiate for near-zero wait time after the network transfer completes
- Memory-Mapped I/O: For large data processing in Wasm, share a linear memory region between the host and the module, passing pointers and lengths instead of copying data across the boundary
Pitfalls to Avoid
- Do not assume all WASI APIs are available in every runtime; WASI Preview 2 is still being adopted, and different runtimes (Wasmtime, Wasmer, WasmEdge) support different subsets
- Do not allocate memory freely without a strategy; Wasm linear memory grows in 64KB page increments and never releases pages back to the OS, so fragmentation accumulates over time
- Do not pass complex data structures across the Wasm boundary by serializing to JSON; use shared linear memory with well-defined layouts or the component model's typed interface for efficiency
- Do not skip testing on the target runtime; behavior differences exist between browser engines (V8, SpiderMonkey, JavaScriptCore) and server-side runtimes, especially for threading and SIMD
الأسئلة الشائعة
ما WASI؟
هي مجموعة معايير لواجهات النظام تسمح لوحدات WebAssembly باستخدام الملفات والشبكة والساعات بطريقة مضبوطة.
لماذا نجعل الملف أصغر؟
الملفات الأصغر تُحمَّل أسرع في المتصفح، وتوصي المهارة بإزالة معلومات التصحيح وتحسين الملف الثنائي.
ما الذاكرة الخطية؟
هي كتلة الذاكرة المسطحة التي تستخدمها وحدة WebAssembly، تكبر ولا تصغر، فينبغي أن تراعي تخطيط البيانات ذلك.
التفاصيل
الوصف الأصلي من المؤلف
WebAssembly expert for WASI, component model, Rust/C compilation, and browser integration
repo: RightNow-AI/openfang
الشعبية
- نجوم GitHub
- 18k
- الترتيب
- #10720
- الترخيص
- Apache-2.0
- آخر تحديث
- 2/7/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
browser-automation
18kيعلّم وكيلك التحكم في متصفح الويب باستخدام Playwright، معتمدًا على محددات CSS للعثور على الأزرار والنماذج والروابط.
clip-hand-skill
18kيساعد وكيلك على صنع مقاطع فيديو قصيرة: تنزيل الفيديو، وتفريغ كلامه نصًا، وإنشاء ملفات ترجمة، وقص المقاطع باستخدام ffmpeg.
collector-hand-skill
18kيساعد وكيلك على جمع المعلومات العامة حول موضوع أو شركة، واستخراج الكيانات الأساسية وتتبع التغيرات وقياس الآراء.
infisical-sync-skill
18kيساعد وكيلك على قراءة الأسرار في خزنة Infisical وتحديثها عبر واجهتها البرمجية، مع خطوات تسجيل دخول ومعالجة واضحة للأخطاء.
مهارات مشابهة
diffs
394kيتيح لوكيلك إنتاج فرق تعديلات حقيقي يمكن مشاركته، كرابط عرض أو ملف صورة، بدلاً من ملخص مكتوب يدوياً.
coding-agent
394kيساعد وكيلك على تسليم مهمة برمجة كبيرة إلى Codex أو Claude Code أو OpenCode كعامل في الخلفية، ثم متابعة تقدمها.
gh-issues
394kيساعد وكيلك على إيجاد مشكلات GitHub واختيار ما ستعمل عليه، وفتح طلبات سحب بالإصلاحات، ومتابعة تعليقات المراجعة.