error-images
它能做什么
这项技能检查网站是否能优雅地处理损坏或缺失的图片。适用于希望在图片加载失败时页面仍然整洁的开发者。
适用场景
- ✓当访客在你的网站上看到破损图片图标的时候。
- ✓当来自外部来源的照片有时加载失败的时候。
- ✓当你构建的图库或商品列表依赖图片的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/error-images/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请为我的网站添加备用内容,使损坏的图片不再显示破损图标。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会检查图片的错误处理,并建议使用占位图或备用内容。它还可以建议记录图片错误,使你能及时发现问题。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Handle image loading errors gracefully
Broken image icons look unprofessional and confuse users—graceful fallbacks maintain visual consistency and user trust when images fail to load.
Quick Reference
- Use onerror to replace broken images with fallbacks
- Provide meaningful placeholder content, not broken image icons
- Consider skeleton loaders while images load
- Log image errors for monitoring and debugging
Check
Check if the website handles broken images gracefully with fallback images or error states.
Fix
Implement fallback images or placeholder content for broken image scenarios.
Explain
Explain how proper error handling for images improves user experience.
Code Review
Review image assets, markup, and delivery configuration related to Handle image loading errors gracefully. 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/error-images
常见问题
备用图片是如何工作的?
当图片加载失败时,页面会替换为占位图,通常是在图片元素上设置错误处理程序来实现的。
什么是骨架加载器?
它是在内容加载时显示的灰色占位形状,这项技能把它列为其中一种选择。
这会修复缺失的图片文件本身吗?
不会。这项技能关注的是图片加载失败时页面如何响应,而不是文件为什么缺失。
详情
作者的原始描述
Use when reviewing image assets, markup, and CDN or build transforms related to Handle image loading errors gracefully. Check encoded size, rendered size, loading strategy, and above-the-fold impact together.
热度
- GitHub 星标
- 75k
- 排名
- #2834
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。