Langsung ke konten
Skillpedia
Website & UI (frontend)75k · #2760

broken-images

Fungsinya

Skill ini memeriksa referensi gambar proyek untuk file yang hilang dan jalur yang akan gagal. Cocok untuk pengembang web dan pemilik situs yang menginginkan gambar termuat dengan andal.

Kapan dipakai

  • ✓Saat pengunjung melihat ikon gambar rusak di halaman.
  • ✓Saat jalur gambar mengarah ke file yang tidak ada di proyek.
  • ✓Saat gambar berasal dari data pengguna atau tautan luar yang mungkin hilang.

Link skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/broken-images/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/broken-images/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit →

Contoh permintaan ke AI

“Pindai proyek saya untuk jalur gambar yang mengarah ke file yang hilang, dan tambahkan cadangan jika perlu.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent memeriksa atribut sumber gambar dan gambar latar untuk file yang hilang, memperbaiki jalur yang salah, dan menambahkan penangan error yang mengganti gambar dengan cadangan saat dibutuhkan.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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 onerror handlers to swap broken <img> elements to fallback images
  • Set this.onerror=null inside 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

Pertanyaan umum

Mengapa gambar rusak penting selain tampilannya?

Skill menyatakan gambar rusak yang merupakan gambar utama halaman dapat merugikan skor pemuatan.

Apa yang dilakukan penangan error?

Penangan itu mengganti dengan gambar cadangan jika gambar asli gagal dimuat, dan diatur agar tidak terjadi perulangan.

Bagaimana cara menguji cadangannya?

Skill menyarankan untuk memblokir permintaan di alat pengembang browser agar cadangan terlihat berfungsi.

Detail

Deskripsi asli dari pembuat

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.

repo: thedaviddias/Front-End-Checklist

Popularitas

Bintang GitHub
75k
Peringkat
#2760
Lisensi
MIT
Diperbarui
31/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa