All skills
michtio avatar

/craft-plugins

@44a2800

Index and router for plugin-specific Craft CMS 5 guidance — configuration, Twig API, PHP API, migrations, deployment, and pitfalls for the plugins this pack documents. Triggers whenever a task names one of these plugins in ANY context (build, configure, style, render, query, import, migrate, deploy, cache, debug): Formie (forms, submissions, File Upload, form in a migration, notifications, translations), SEOmatic (meta, sitemaps, JSON-LD, SEO field), Blitz (static/page caching, purge), Feed Me (XML/JSON/CSV import), Imager-X (transforms, srcset, quick syntax, named transforms, Power Pack, pppicture, ppimg), ImageOptimize (OptimizedImages), CKEditor (rich text, nested entries), Sprig (reactive, htmx), Element API (JSON endpoints), Retour (redirects, 404s), Navigation (nav menus), Hyper (link field), Colour Swatches, Password Policy (HIBP), Typogrify, Cache Igniter, Knock Knock (staging password), Elements Panel (N+1 debug), Sherlock (security scan), Amazon SES (SES/SNS bounce), Embedded Assets (oEmbed), Timeloop (recurring dates), Vite (craft.vite.*, asset bundling), Warp (passwordless login, magic link, one-time code/OTP, passkeys, WebAuthn, craft.warp, member sessions). Also load for passwordless or magic-link auth with NO plugin named. Always load when a task names one of these plugins — read references/<plugin>.md first. Do NOT trigger for Craft core with no plugin named (craftcms), template architecture (craft-site), or content modeling (craft-content-modeling).

Use this Skill: https://skilld.dev/gh/michtio/craftcms-claude-skills/craft-plugins

This session only. Nothing lands on disk.

referencesembedded-assets.md

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

Embedded Assets

oEmbed plugin by Spicy Web. Lets editors paste URLs (YouTube, Vimeo, Instagram, etc.) into Craft's asset manager and treat them as first-class assets stored as JSON files. Pulls images, embed codes, and metadata automatically. Supports GraphQL. Used in 4/6 projects.

spicyweb/craft-embedded-assets — Free (MIT)

Documentation

When unsure, WebFetch the relevant docs page.

Common Pitfalls

  • Forgetting that embedded assets are JSON files — they have .json extension and kind === 'json'. Asset fields must allow JSON file types, or have no file type restriction.
  • Using asset.url directly — for an embedded asset, asset.url returns the JSON file path, not the embed URL. Always use craft.embeddedAssets.get(asset) to get the model.
  • Not null-checking — craft.embeddedAssets.get() returns null if the asset isn't an embedded asset. Always guard with {% if embed %}.
  • Instagram/social media breakage — social platforms frequently change their oEmbed APIs. Keep the plugin updated.
  • Missing whitelist entries — the plugin whitelists allowed domains. If an embed URL doesn't work, check if the domain is in the whitelist config.
  • Using deprecated properties — v4+ deprecated $images (use $image), $providerIcons (use $providerIcon), $tags (use $keywords).

Twig API

Getting an Embedded Asset

{% set asset = entry.videoField.one() %}
{% set embed = craft.embeddedAssets.get(asset) %}

{% if embed %}
    <h3>{{ embed.title }}</h3>
    <p>{{ embed.providerName }}</p>

    {# Safe HTML embed code (sanitized) #}
    {{ embed.html }}
{% endif %}

Model Properties

Property Type Description
title string Embed title
description string Embed description
url string Original URL
type string video, photo, rich, link
image string Primary image URL
html TwigMarkup Sanitized, safe-to-output embed HTML (via getHtml()) — output directly, no |raw needed
code string Raw, unsanitized embed HTML (only safe to output when getIsSafe() is true)
providerName string Provider name (YouTube, Vimeo, etc.)
providerUrl string Provider URL
providerIcon string Provider favicon URL
authorName string Content author
authorUrl string Author URL
width int Embed width
height int Embed height
keywords array Keywords/tags

Model Methods

Method Returns Description
getIsSafe() bool Whether embed code URLs are from whitelisted domains
getIframeSrc(params?) string|null Iframe src URL with optional extra params
getIframeCode(params?, attributes?, removeAttributes?) string|null Full iframe HTML with modifications
getVideoId() string|null Video ID for supported providers
getVideoUrl(params?) string|null Video URL with optional params

Iframe Customization

{% set embed = craft.embeddedAssets.get(asset) %}

{# Get iframe src with extra params #}
{{ embed.getIframeSrc(['autoplay=1', 'controls=0']) }}

{# Get full iframe code with params, added attributes, and removed attributes #}
{{ embed.getIframeCode(
    ['autoplay=1', 'playsinline=1'],
    ['loading=lazy'],
    ['frameborder']
)|raw }}

Alternative: From Raw Data

{# Build from property name/value pairs instead of an asset #}
{% set embed = craft.embeddedAssets.fromData({
    url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
    title: 'Video Title',
    type: 'video',
}) %}

GraphQL

{
  entries(section: "videos") {
    ... on videos_default_Entry {
      videoField {
        embeddedAsset {
          title
          url
          type
          providerName
          image
          isSafe
          iframeSrc(params: ["autoplay=1"])
        }
      }
    }
  }
}

Returns null for assets that aren't embedded.

Configuration

Settings are configurable via the CP (Settings → Embedded Assets) or config file:

// config/embedded-assets.php
return [
    // Whitelisted domains (URLs must match one of these)
    'whitelist' => [
        'youtube.com',
        'vimeo.com',
        'soundcloud.com',
        // ... add custom domains
    ],

    // Show thumbnails in CP asset indexes
    'showThumbnailsInCp' => true,

    // Min/max dimensions for embedded image thumbnails
    'minImageSize' => 16,
    'maxImageSize' => 2000,
];

Pair With

  • CKEditor — embed media in rich text fields, use Embedded Assets for standalone media assets
  • ImageOptimize — regular images use ImageOptimize transforms, embedded assets use their own thumbnails

Source: SKILL.md on GitHub

No alerts16d3 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The 'craft-plugins' skill is a technical reference and router for Craft CMS 5 plugins. It provides guidance on configuration, Twig and PHP APIs, and best practices for popular extensions in the Craft ecosystem. The skill consists of documentation files that describe legitimate plugin behaviors and does not contain any malicious code, obfuscation, or security vulnerabilities.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

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

Last checked against GitHub 2 weeks ago.

Activeupdated last month

README badge

README badge for michtio/craftcms-claude-skills/craft-plugins