srcset
하는 일
이 스킬은 사이트의 이미지 태그를 확인하고, srcset과 sizes 속성이 없는 곳에 추가하며, 레이아웃과 맞지 않는 속성을 고칩니다. 모든 기기에서 이미지가 효율적으로 로드되기를 원하는 웹 제작자를 위한 스킬입니다.
사용하는 경우
- ✓사이트의 이미지가 기기마다 알맞은 크기로 로드되도록 해 달라고 요청할 때.
- ✓휴대폰이 데스크톱용 큰 이미지를 내려받아 모바일 데이터 이용자가 페이지가 느리다고 불만을 제기할 때.
- ✓이미지에 srcset은 있지만 sizes 속성이 실제 표시 방식과 맞지 않을 때.
스킬 링크
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/srcset/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“휴대폰에서 데스크톱용 큰 이미지를 내려받고 있습니다. 각 기기에 맞는 크기를 받도록 srcset을 추가해 주실 수 있나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 약 100픽셀보다 넓으면서 srcset이 없는 이미지를 찾아 400, 800, 1200픽셀 같은 너비 변형을 만듭니다. 실제 레이아웃에 맞는 srcset 목록과 sizes 속성을 추가하고, 대체용 src는 유지합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Use srcset for responsive images
Without srcset, every user—regardless of their device—downloads the same large image. A 1600px hero image served to a 375px mobile display downloads 4x the data needed. The srcset attribute lets browsers choose the optimal file automatically, reducing bandwidth by 50-80% for mobile users with no change to visual quality.
Quick Reference
- Add
srcsetwith width descriptors (400w,800w) to all images wider than ~100px - Always pair
srcsetwidth descriptors with asizesattribute—withoutsizesthe browser assumes100vw - Use density descriptors (
1x,2x) only for fixed-size images like avatars and icons - Keep
srcpointing to a fallback size for browsers that don't supportsrcset
Check
Scan all <img> elements in this codebase. Flag: 1) Any <img> wider than 100px (in CSS or layout) that lacks a srcset attribute. 2) Any <img> with srcset but missing a sizes attribute (necessary for width descriptors). 3) Any <img> using only density descriptors (1x, 2x) where width descriptors (400w, 800w) would be more appropriate. 4) Any srcset that provides only one size (no benefit over plain src). Report each finding with file path and line number.
Fix
For each <img> missing srcset: 1) Generate multiple width variants: typically 400w, 800w, 1200w (add 1600w for full-bleed images). 2) Add srcset listing each variant with its width descriptor. 3) Add a sizes attribute describing actual CSS layout width at each breakpoint. 4) Keep src pointing to a mid-range size (800w) as the fallback. 5) Add width and height attributes if missing. For each image, show the complete corrected HTML including srcset and sizes.
Explain
Explain how srcset and the two descriptor types work. Width descriptors (400w, 800w) describe the intrinsic width of each candidate; the browser combines this with the sizes attribute to calculate which candidate provides the best pixel density for the current viewport. Density descriptors (1x, 2x) are simpler but less flexible—use them only for fixed-size images like avatars and icons. The sizes attribute is critical: without it, the browser assumes 100vw and always downloads the largest candidate even on narrow screens.
Code Review
Review image assets, markup, and delivery configuration related to Use srcset for responsive 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.
자주 묻는 질문
sizes는 왜 중요한가요?
스킬에 따르면 sizes가 없으면 브라우저는 이미지가 전체 뷰포트 너비라고 가정해, 너무 큰 파일을 고를 수 있습니다.
밀도 설명자는 언제 써야 하나요?
스킬은 아바타나 아이콘처럼 크기가 고정된 이미지에만 1x와 2x를 쓰라고 말합니다.
이것이 페이지 모습을 바꾸나요?
아닙니다. 스킬에 따르면 이미지의 모습은 그대로 두고 다운로드 크기만 줄입니다.
상세 정보
작성자의 원본 설명
Use when reviewing image assets, markup, and CDN or build transforms related to Use srcset for responsive images. Check encoded size, rendered size, loading strategy, and above-the-fold impact together.
인기도
- GitHub 스타
- 75k
- 순위
- #3034
- 라이선스
- MIT
- 업데이트
- 2026. 10. 31.
댓글
- …
이 저장소의 다른 스킬
frontendchecklist
75k명령줄 도구를 사용해 380개가 넘는 규칙으로 프런트엔드 코드와 실시간 페이지를 접근성, 속도, SEO, 보안 측면에서 점검합니다.
frontend-checklist-global
75kFront-End Checklist의 386개 규칙 전체로 프런트엔드 프로젝트를 감사하고, 발견한 문제마다 구체적인 해결 방법을 제시합니다.
404-page
75k없는 페이지 화면에 도움이 되는 링크가 있고 실제 404 상태 코드를 반환하는지 확인해, 길을 잃은 방문자를 돕습니다.
about-page
75k사이트를 운영하는 사람을 설명하는 명확한 소개 페이지가 있는지 검토해, 방문자와 검색 엔진의 신뢰를 높입니다.