modern-format
Skill này làm gì
Skill này tìm các ảnh dùng định dạng cũ và gợi ý định dạng hiện đại hơn như WebP hoặc AVIF, là các tệp nhỏ hơn. Skill dành cho người xây web muốn trang tải nhanh hơn và tốn ít dữ liệu hơn.
Khi nào nên dùng
- ✓Khi bạn nhờ agent làm ảnh trên website tải nhanh hơn.
- ✓Khi trang chậm vì ảnh và đồ họa là các tệp lớn.
- ✓Khi bạn chuẩn bị ảnh cho website và muốn định dạng hiện đại có phương án dự phòng an toàn.
Liên kết skill
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/modern-format/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
“Ảnh trên website của tôi tải chậm. Bạn có thể chuyển sang định dạng hiện đại và cập nhật code không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent quét thẻ ảnh và ảnh nền dùng file JPEG và PNG. Nó giúp tạo phiên bản WebP hoặc AVIF tùy chọn và bọc ảnh trong phần tử picture có phương án dự phòng cho trình duyệt cũ.
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.
Use modern image formats (WebP, AVIF)
Images are typically 50%+ of page weight. Switching from JPEG to WebP alone reduces transfer sizes by 25-35% with no visible quality change, directly improving Largest Contentful Paint (LCP) and saving bandwidth for users on mobile data plans. These savings compound across every visitor and every image on the site.
Quick Reference
- WebP is ~25-35% smaller than JPEG at equivalent quality (per web.dev)
- AVIF is ~40-50% smaller than JPEG at equivalent quality (per web.dev)
- Use
<picture>with<source type="image/avif">and<source type="image/webp">plus an<img>fallback - WebP has 97%+ global browser support; AVIF is supported in all modern browsers as of 2023
Check
Scan all <img> elements and CSS background-image declarations in this codebase. Identify: 1) Any <img src> pointing to .jpg, .jpeg, or .png files (not served via a CDN that auto-negotiates format). 2) Any <picture> elements that lack <source type="image/webp"> or <source type="image/avif"> entries. 3) Any CSS background images using JPEG or PNG when a WebP equivalent could be used. Report each finding with file path and line number.
Fix
For each image not using modern formats: 1) Convert to WebP at 80% quality using Squoosh or Sharp. 2) Optionally also generate AVIF at 60% quality for browsers that support it. 3) Wrap the original <img> in a <picture> element and add <source type="image/avif"> and <source type="image/webp"> entries with the new files. 4) Keep the original JPEG/PNG as the <img src> fallback. For CSS background images, use a @supports (background-image: url('.webp')) { } query to serve WebP to supporting browsers.
Explain
Explain the compression advantages of WebP and AVIF over JPEG and PNG. According to web.dev, WebP lossless images are 26% smaller than PNG and WebP lossy images are 25-35% smaller than JPEG at equivalent visual quality. AVIF offers further improvements: roughly 40-50% smaller than equivalent JPEG. Explain browser support: WebP has 97%+ global browser support as of 2024. AVIF is supported in Chrome 85+, Firefox 93+, and Safari 16.4+. The <picture> element with fallbacks means there is no risk in adopting these formats today.
Code Review
Review image assets, markup, and delivery configuration related to Use modern image formats (WebP, AVIF). 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/modern-format
Câu hỏi thường gặp
Ảnh WebP có nhỏ hơn nhiều không?
Skill nói WebP nhỏ hơn khoảng 25 đến 35 phần trăm so với JPEG ở chất lượng tương tự, còn AVIF có thể nhỏ hơn nữa.
Trình duyệt cũ có vẫn hiển thị được ảnh không?
Có. Phần tử picture có ảnh img dự phòng, nên trình duyệt không hỗ trợ định dạng mới vẫn hiện ảnh.
Việc này có ảnh hưởng tới tốc độ tải không?
Skill nói ảnh nhỏ hơn có thể cải thiện Largest Contentful Paint và giảm lượng dữ liệu sử dụng.
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 Use modern image formats (WebP, AVIF). 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
- #2944
- 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.