askill
youtube-embed

youtube-embedSafety 100Repository

YouTube video facade pattern for performance. Lazy-load iframe on click, poster images, GA4 tracking, Schema.org markup.

1 stars
1.2k downloads
Updated 1/16/2026

Package Files

Loading files...
SKILL.md

YouTube Embed Skill

Purpose

Embed YouTube videos without loading YouTube scripts until user clicks. Massive performance win.

Core Rules

  1. Facade pattern — Poster + play button, no iframe until click
  2. Local posters — Download and optimize thumbnails locally
  3. Privacy-enhanced — Use youtube-nocookie.com only
  4. Track engagement — GA4 video_play event on click
  5. Schema.org — VideoObject markup for rich snippets

Flow

Click before: Poster image + Play button (no YouTube)
Click after:  Replace with iframe + GA4 event + autoplay

Poster Images

  1. Download: https://i.ytimg.com/vi/{VIDEO_ID}/maxresdefault.jpg
  2. Fallback: sddefault.jpg if maxres unavailable
  3. Convert: Use Picture skill (avif, webp, jpg)
  4. Store: src/assets/videos/{slug}.jpg

References

Forbidden

  • ❌ YouTube iframe/script before click
  • youtube.com (must use youtube-nocookie.com)
  • fetchpriority="high" on video facades
  • ❌ YouTube logo as play button (trademark)
  • ❌ Remote poster images (always local)
  • ❌ Missing poster or title

Definition of Done

  • VideoFacade component created
  • Poster images downloaded and optimized
  • Click triggers iframe swap + autoplay
  • GA4 video_play event firing
  • VideoObject schema on pages with videos
  • Keyboard accessible (Enter/Space)

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

78/100Analyzed 3/2/2026

Well-structured technical skill covering the YouTube facade pattern for performance optimization. Includes clear rules, poster image instructions, privacy considerations (youtube-nocookie), GA4 tracking, and Schema.org markup. Missing actual implementation code (references external files), but provides comprehensive guidance on the pattern. Highly reusable concept applicable to any web project. Scores well on safety and reusability, moderately on completeness and actionability due to missing code examples.

100
75
85
65
65

Metadata

Licenseunknown
Version-
Updated1/16/2026
PublisherSoborbo

Tags

No tags yet.