All skills
asyrafhussin avatar

/web-design-guidelines

@b73c638

UI/UX best practices and accessibility audit. Use when reviewing UI code, checking accessibility, running accessibility audits, auditing forms, or ensuring web interface best practices. Triggers on "audit accessibility", "check WCAG", "review UI", "check accessibility", "audit design", "review UX", or "check best practices".

Use this Skill: https://skilld.dev/gh/asyrafhussin/agent-skills/web-design-guidelines

This session only. Nothing lands on disk.

rulesperf-image-loading.md

≈1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Optimize Image Loading for UX

Impact: MEDIUM (Prevents layout shifts and improves perceived performance)

Unoptimized images are a leading cause of layout shifts and slow page loads. Providing explicit dimensions, lazy loading off-screen images, and serving modern formats dramatically improves both Core Web Vitals and perceived performance.

Incorrect

<!-- ❌ Bad: no dimensions, no lazy loading, no responsive sources, missing alt -->
<img src="/photos/hero.jpg" />

<img src="/photos/team.png" />

<img src="/photos/product.jpg" class="product-thumb" />
// ❌ Bad: React component with same issues
function Gallery() {
  return (
    <div>
      <img src="/photos/hero.jpg" />
      <img src="/photos/team.png" />
      {products.map((p) => (
        <img key={p.id} src={p.image} />
      ))}
    </div>
  )
}

Problems:

  • Missing width and height causes Cumulative Layout Shift (CLS) as images load
  • All images load eagerly, blocking the critical rendering path
  • No modern format (WebP/AVIF) sources wastes bandwidth
  • Missing alt text harms accessibility and SEO
  • No fetchpriority hint means the browser cannot prioritize the hero image

Correct

<!-- ✅ Good: hero image with high priority, explicit dimensions, alt text -->
<img
  src="/photos/hero.jpg"
  alt="Team collaboration in the office"
  width="1200"
  height="600"
  fetchpriority="high"
/>

<!-- ✅ Good: below-fold image with lazy loading and responsive sources -->
<picture>
  <source srcset="/photos/team.avif" type="image/avif" />
  <source srcset="/photos/team.webp" type="image/webp" />
  <img
    src="/photos/team.png"
    alt="Our engineering team"
    width="800"
    height="450"
    loading="lazy"
    decoding="async"
  />
</picture>

<!-- ✅ Good: responsive image with srcset for different viewports -->
<img
  src="/photos/product-400.jpg"
  srcset="
    /photos/product-400.jpg 400w,
    /photos/product-800.jpg 800w,
    /photos/product-1200.jpg 1200w
  "
  sizes="(max-width: 600px) 400px, (max-width: 1024px) 800px, 1200px"
  alt="Product thumbnail"
  width="400"
  height="400"
  loading="lazy"
  decoding="async"
/>
// ✅ Good: React component with optimized image loading
function Gallery({ products }: { products: Product[] }) {
  return (
    <div>
      {/* Hero image: high priority, no lazy loading */}
      <img
        src="/photos/hero.jpg"
        alt="Team collaboration in the office"
        width={1200}
        height={600}
        fetchPriority="high"
      />

      {/* Below-fold image: modern formats with fallback */}
      <picture>
        <source srcSet="/photos/team.avif" type="image/avif" />
        <source srcSet="/photos/team.webp" type="image/webp" />
        <img
          src="/photos/team.png"
          alt="Our engineering team"
          width={800}
          height={450}
          loading="lazy"
          decoding="async"
        />
      </picture>

      {/* Product list: lazy loaded with dimensions */}
      {products.map((p) => (
        <img
          key={p.id}
          src={p.image}
          alt={p.name}
          width={300}
          height={300}
          loading="lazy"
          decoding="async"
        />
      ))}
    </div>
  )
}

Benefits:

  • Explicit width and height eliminate layout shifts by reserving space before load
  • loading="lazy" defers off-screen images, reducing initial page weight
  • <picture> with WebP/AVIF sources can reduce image size by 25-50%
  • fetchpriority="high" on the hero image improves Largest Contentful Paint (LCP)
  • decoding="async" prevents image decoding from blocking the main thread
  • Proper alt text improves accessibility and SEO

Reference: web.dev - Optimize images

Source: SKILL.md on GitHub

2 warnings16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill provides comprehensive guidelines for accessibility and web design audits. It processes user-provided code files to generate compliance reports, which introduces a minor risk of indirect prompt injection if the audited files contain malicious instructions. No evidence of data exfiltration, obfuscation, or unauthorized command execution was found.

  • Socket16d

    2 alerts: gptAnomaly

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    26/27 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at b73c638. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Steadyupdated 6 months ago
metadata
{
  "author": "agent-skills",
  "version": "2.1.0"
}

README badge

README badge for asyrafhussin/agent-skills/web-design-guidelines