broken-images
ما الذي تفعله
تفحص هذه المهارة مراجع الصور في المشروع بحثًا عن ملفات مفقودة ومسارات ستفشل. وهي موجهة إلى مطوري الويب وأصحاب المواقع الذين يريدون تحميل الصور بموثوقية.
متى تستخدمها
- ✓عندما يرى الزوار أيقونات صور مكسورة في الصفحة.
- ✓عندما يشير مسار صورة إلى ملف غير موجود في المشروع.
- ✓عندما تأتي الصور من بيانات المستخدمين أو روابط خارجية قد تختفي.
رابط المهارة
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/broken-images/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“افحص مشروعي بحثًا عن مسارات صور تشير إلى ملفات مفقودة، وأضف بدائل حيث تلزم.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يتحقق الوكيل من سمات مصدر الصور والصور الخلفية بحثًا عن ملفات مفقودة، ويصلح المسارات الخاطئة، ويضيف معالج خطأ يستبدل الصورة ببديل عند الحاجة.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
Fix broken images
A broken image shows an ugly placeholder icon, breaks visual layouts, and communicates that the site is poorly maintained. If the broken image is the Largest Contentful Paint element, it also harms LCP scores. On e-commerce sites, a missing product image can directly reduce purchase intent.
Quick Reference
- Broken images show an icon and console error—validate all
<img src>paths at build time - Use
onerrorhandlers to swap broken<img>elements to fallback images - Set
this.onerror=nullinside the handler to prevent infinite error loops - Test with DevTools Network tab blocked requests to verify fallback behaviour
Check
Scan all <img> src attributes and CSS background-image URLs in this codebase. Identify: 1) Any relative or absolute paths that point to files not present in the project. 2) Any <img> elements without an onerror handler or fallback mechanism. 3) Hardcoded external image URLs that may become unavailable. 4) Dynamic image paths constructed from user data without existence checks. Report each broken or potentially broken image with its file path and line number.
Fix
For each broken image: 1) Correct the file path if the image exists but the path is wrong. 2) Add the missing image asset if it was omitted. 3) For images that may fail at runtime, add an onerror handler: onerror="this.src='/images/fallback.png'; this.onerror=null;". 4) For React/Vue components, implement an onError callback that swaps the src to a placeholder. 5) For external images, consider downloading and self-hosting or using a CDN with fallback. Always set this.onerror=null to prevent infinite error loops.
Explain
Explain why broken images degrade user experience and how browsers handle them. A 404 response for an image shows the browser's broken-image icon, causes a console error, and—if the image is the LCP element—delays Core Web Vitals metrics. Search engines cannot index missing images, affecting image SEO. Monitoring image errors proactively prevents broken experiences from reaching users.
Code Review
Review image assets, markup, and delivery configuration related to Fix broken images. Flag exact files or components where format choice, sizing, or loading behavior violates the rule, and describe how to confirm the fix in DevTools.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/images/broken-images
الأسئلة الشائعة
لماذا تهم الصور المكسورة أبعد من المظهر؟
تقول المهارة إن صورة مكسورة وهي الصورة الرئيسية في الصفحة قد تضر بدرجات التحميل.
ماذا يفعل معالج الخطأ؟
يستبدل الصورة ببديل إذا فشل تحميل الأصل، وهو مضبوط بحيث لا يدخل في حلقة.
كيف أختبر البديل؟
تقترح المهارة حجب الطلبات في أدوات المطور في المتصفح لترى البديل يعمل.
التفاصيل
الوصف الأصلي من المؤلف
Use when reviewing image assets, markup, and CDN or build transforms related to Fix broken images. Check encoded size, rendered size, loading strategy, and above-the-fold impact together.
الشعبية
- نجوم GitHub
- 75k
- الترتيب
- #2760
- الترخيص
- MIT
- آخر تحديث
- 31/10/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
frontendchecklist
75kيفحص شيفرة الواجهة الأمامية والصفحات الحية مقابل أكثر من 380 قاعدة للوصول وسرعة الأداء وتحسين محركات البحث والأمان، بأداة سطر أوامر.
frontend-checklist-global
75kيدقق مشروع الواجهة الأمامية وفق كل قواعد Front-End Checklist البالغ عددها 386، ويقدم إصلاحًا محددًا لكل مشكلة وجدت.
404-page
75kيتأكد من أن صفحة الصفحات غير الموجودة تقدم روابط مفيدة وتُرجع رمز حالة 404 حقيقيًا، لمساعدة الزوار التائهين على إيجاد طريقهم.
about-page
75kيراجع ما إذا كان لموقعك صفحة «من نحن» واضحة تشرح من يديره، لبناء الثقة لدى الزوار ومحركات البحث.
مهارات مشابهة
angular-developer
280kيساعد وكيلك على كتابة شيفرة Angular وتقديم نصائح لبنية المشروع، ويفيد في بدء المشاريع الجديدة وإنشاء المكونات وتحسين الأداء وإمكانية الوصول.
frontend-a11y
280kيساعد وكيلك على جعل واجهات الويب متاحة للجميع، فيضمن أن المواقع والتطبيقات تعمل جيدًا مع قارئات الشاشة والتنقل بلوحة المفاتيح.
frontend-patterns
280kيطبّق وكيلك أنماط تطوير الواجهات الحديثة، فيحسّن الأداء ويدير الحالة ويتبع أفضل الممارسات في React وNext.js.