Agent skill
youtube-embed
YouTube video facade pattern for performance. Lazy-load iframe on click, poster images, GA4 tracking, Schema.org markup.
Install this agent skill to your Project
npx add-skill https://github.com/Soborbo/claudeskills/tree/main/youtube-embed
SKILL.md
YouTube Embed Skill
Purpose
Embed YouTube videos without loading YouTube scripts until user clicks. Massive performance win.
Core Rules
- Facade pattern — Poster + play button, no iframe until click
- Local posters — Download and optimize thumbnails locally
- Privacy-enhanced — Use
youtube-nocookie.comonly - Track engagement — GA4
video_playevent on click - 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
- Download:
https://i.ytimg.com/vi/{VIDEO_ID}/maxresdefault.jpg - Fallback:
sddefault.jpgif maxres unavailable - Convert: Use Picture skill (avif, webp, jpg)
- Store:
src/assets/videos/{slug}.jpg
References
- Component — Full VideoFacade.astro code
- Schema — VideoObject markup
Forbidden
- ❌ YouTube iframe/script before click
- ❌
youtube.com(must useyoutube-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)
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
astro-images
Width-based responsive image patterns for Astro. Aspect ratio independent.
llm-optimization
Optimize websites for AI assistant recommendations. ChatGPT, Gemini, Perplexity, Claude. Get cited in AI answers.
astro-blog-technical
Phase 4 - Technical implementation (frontmatter, schema, performance)
page-structure
Generates section list for a page. Deterministic mapping. Does not write content.
internal-linking
Plans internal link structure using content silos. Outputs link map with SEO priority. Does not create links.
astro-components
UI component library for Astro lead generation sites. Buttons, forms, cards, badges. Requires design-tokens skill.
Didn't find tool you were looking for?