responsive-size
Skill này làm gì
Skill này so sánh kích thước thật của mỗi ảnh với kích thước hiển thị trên màn hình và sửa các ảnh quá lớn. Skill dành cho người xây web có trang tải chậm vì ảnh quá khổ.
Khi nào nên dùng
- ✓Khi bạn yêu cầu agent tìm các ảnh quá lớn trên website.
- ✓Khi kết quả kiểm tra trang báo ảnh lớn hơn mức cần thiết.
- ✓Khi ảnh tiêu đề rất lớn nhưng hiển thị trong một khung nhỏ trên điện thoại.
Liên kết skill
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/responsive-size/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Một số ảnh trên website của tôi rất lớn so với cách chúng hiển thị trên màn hình. Bạn có thể tìm chúng và tạo phiên bản nhỏ hơn không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent so sánh chiều rộng thật của mỗi ảnh với chiều rộng hiển thị ở các kích thước màn hình phổ biến. Với ảnh quá lớn, agent tạo các biến thể ở nhiều chiều rộng và thêm srcset cùng sizes để trình duyệt chọn đúng phiên bản.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Serve images at the correct display size
A single oversized hero image can add several megabytes to a page load unnecessarily. On mobile devices with 375px screens, serving a 1600px image downloads 4x the data users need. The 'Properly size images' Lighthouse audit consistently identifies this as one of the highest-impact performance opportunities on most websites.
Quick Reference
- Serving a 1600px image in a 400px container wastes ~16x the necessary bandwidth
- Use
srcsetwith width descriptors andsizeswith actual layout widths - The
sizesattribute is critical—without it the browser assumes100vwand picks the largest image - Lighthouse 'Properly size images' audit reports estimated savings per oversized image
Check
Audit images in this codebase for oversizing. Use Lighthouse 'Properly size images' audit results as the primary signal. For each <img> in the HTML: 1) Compare the image file's intrinsic width to the element's rendered CSS width (check CSS rules, container constraints). 2) Flag any image where the intrinsic width is more than 2x the rendered width at any common viewport size. 3) Check for srcset usage—images over 200px wide should have srcset variants. 4) Check sizes attribute accuracy—does it reflect the actual CSS layout?
Fix
For each oversized image: 1) Generate multiple size variants: 400w, 800w, 1200w, 1600w (use Sharp or Squoosh). 2) Add srcset listing each variant with its width descriptor. 3) Add a sizes attribute describing the image's display width at each breakpoint (e.g., sizes="(max-width: 600px) 100vw, (max-width: 1200px) 50vw, 400px"). 4) For art direction (different crops), use <picture> with media attributes. 5) For the <img> src fallback, use the medium size (800w). Show complete before/after HTML.
Explain
Explain why serving oversized images wastes bandwidth. If a browser renders an image at 400px wide but the image file is 2000px wide, the browser downloads ~25x more pixel data than it can display (bandwidth scales with pixel count, not linear dimensions). The Lighthouse 'Properly size images' audit estimates potential savings in KiB for each oversized image. The sizes attribute is the key to accuracy—without it, the browser assumes 100vw and downloads the largest srcset candidate even on narrow viewports.
Code Review
Review image assets, markup, and delivery configuration related to Serve images at the correct display size. 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/responsive-size
Câu hỏi thường gặp
Một bộ kích thước điển hình là gì?
Skill gợi ý các biến thể rộng 400, 800, 1200 và 1600 điểm ảnh.
Vì sao thuộc tính sizes quan trọng?
Skill nói nếu thiếu nó, trình duyệt cho rằng ảnh trải đủ chiều rộng màn hình và chọn tệp lớn nhất.
Công cụ nào có thể đổi kích thước ảnh?
Skill nhắc đến Sharp hoặc Squoosh để tạo các biến thể.
Chi tiết
Mô tả gốc của tác giả
Use when reviewing image assets, markup, and CDN or build transforms related to Serve images at the correct display size. Check encoded size, rendered size, loading strategy, and above-the-fold impact together.
Độ phổ biến
- Sao GitHub
- 75k
- Vị trí xếp hạng
- #2998
- Giấy phép
- MIT
- Cập nhật
- 31/10/2026
Bình luận
- …
Thêm skill từ kho mã này
frontendchecklist
75kKiểm tra mã frontend và trang trực tiếp theo hơn 380 quy tắc về khả năng tiếp cận, tốc độ, SEO và bảo mật, bằng một công cụ dòng lệnh.
frontend-checklist-global
75kKiểm toán một dự án frontend theo đủ 386 quy tắc của Front-End Checklist, và đưa cách sửa cụ thể cho từng vấn đề tìm thấy.
404-page
75kKiểm tra xem trang báo thiếu của bạn có đưa ra các liên kết hữu ích và trả về mã trạng thái 404 thật hay không, để giúp khách bị lạc tìm đường.
about-page
75kKiểm tra xem trang web có trang Giới thiệu rõ ràng giải thích ai điều hành nó hay không, để xây dựng niềm tin với khách và công cụ tìm kiếm.
Skill tương tự
gifgrep
394kCho phép agent của bạn tìm thư viện GIF, xem trước kết quả, tải một GIF, và lấy một khung hình tĩnh hoặc bảng ghép nhiều khung hình.
meme-maker
394kCho phép agent của bạn chọn một mẫu meme, thêm chú thích của riêng bạn và tạo meme dưới dạng ảnh SVG hoặc PNG.
ios-icon-gen
280kGiúp agent tạo biểu tượng cho ứng dụng iOS. Dùng biểu tượng của Apple hoặc từ các nguồn khác để tạo đúng định dạng tệp.