claude-skills/

Anthropic公式スキル・プラグインの日本語ディレクトリ

last sync 22h ago
スキルOfficialdevelopment

🛍️shopify-liquid-themes

プラグイン
liquid-skills

説明

正しいスキーマJSON、LiquidDocヘッダー、翻訳キー、CSS/JSパターンを含むShopify Liquidテーマコード(セクション、ブロック、スニペット)を生成します。 次のような場合に使用: Shopifyテーマ向けの`.liquid`ファイルの作成・編集、スキーマ・doc・stylesheet・javascriptタグの操作、またはShopify LiquidのオブジェクトやフィルターやTagの利用。

原文を表示

Generate Shopify Liquid theme code (sections, blocks, snippets) with correct schema JSON, LiquidDoc headers, translation keys, and CSS/JS patterns. Use when creating or editing .liquid files for Shopify themes, working with schema, doc, stylesheet, javascript tags, or Shopify Liquid objects/filters/tags.

ユースケース

  • Shopifyテーマ向けの.liquidファイルを作成・編集するとき
  • スキーマ・doc・stylesheet・javascriptタグを操作するとき
  • Shopify LiquidのオブジェクトやフィルターやTagを利用するとき

本文(日本語訳)

Shopify Liquid テーマ

テーマアーキテクチャ

.
├── sections/    # {% schema %} を持つ全幅ページモジュール — ヒーロー、商品グリッド、テスティモニアルなど
├── blocks/      # {% schema %} を持つネスト可能なコンポーネント — スライド、機能アイテム、テキストブロックなど
├── snippets/    # {% render %} で呼び出す再利用可能なフラグメント — ボタン、アイコン、画像ヘルパーなど
├── layout/      # ページラッパー({{ content_for_header }} と {{ content_for_layout }} を必ず含めること)
├── templates/   # 各ページタイプに表示するセクションを定義する JSON ファイル
├── config/      # グローバルテーマ設定(settings_schema.json、settings_data.json)
├── locales/     # 翻訳ファイル(en.default.json、fr.json など)
└── assets/      # 静的 CSS・JS・画像({% stylesheet %}/{% javascript %} の使用を推奨)

使い分けの指針

用途 使用するもの 理由
全幅でカスタマイズ可能なモジュール Section {% schema %} を持ち、エディタに表示され、ブロックをレンダリングする
エディタ設定付きの小さなネスト可能コンポーネント Block {% schema %} を持ち、セクション/ブロック内にネストできる
マーチャントが編集しない再利用可能なロジック Snippet スキーマなし、{% render %} で呼び出し、パラメータを受け取る
ブロック・スニペット間で共有するロジック Snippet ブロックは他のブロックを {% render %} できない

Liquid 構文

デリミタ

  • {{ ... }} — 出力(値を表示する)
  • {{- ... -}} — 空白をトリムして出力
  • {% ... %} — ロジックタグ(if、for、assign など)— 何も出力しない
  • {%- ... -%} — 空白をトリムするロジックタグ

演算子

比較: ==!=><>=<= 論理: andorcontains

重要な注意事項

  1. 条件式に括弧は使えない — 代わりに {% if %} をネストする
  2. 三項演算子はない — 常に {% if cond %}value{% else %}other{% endif %} の形式を使う
  3. for ループは最大 50 回まで — 大きな配列には {% paginate %} を使う
  4. contains は文字列にのみ有効 — 配列内のオブジェクトのチェックには使えない
  5. {% stylesheet %}/{% javascript %} 内では Liquid が動作しない — 代わりに CSS 変数またはクラスを使う
  6. スニペットは外側スコープの変数にアクセスできない — render のパラメータとして渡す
  7. include は非推奨 — 常に {% render 'snippet_name' %} を使う
  8. {% liquid %} タグ — デリミタなしで複数行のロジックを記述できる。出力には echo を使う

変数

{% assign my_var = 'value' %}
{% capture my_var %}computed {{ value }}{% endcapture %}
{% increment counter %}
{% decrement counter %}

フィルター早見表

フィルターは | でチェーンします。前のフィルターの出力型が次のフィルターの入力になります。

配列: compactconcatfindfind_indexfirsthasjoinlastmaprejectreversesizesortsort_naturalsumuniqwhere 文字列: appendcapitalizedowncaseescapehandleizelstripnewline_to_brprependremovereplacerstripslicesplitstripstrip_htmltruncatetruncatewordsupcaseurl_decodeurl_encode 数値: absat_leastat_mostceildivided_byfloorminusmoduloplusroundtimes 金額: moneymoney_with_currencymoney_without_currencymoney_without_trailing_zeros カラー: color_brightnesscolor_darkencolor_lightencolor_mixcolor_modifycolor_saturatecolor_desaturatecolor_to_hexcolor_to_hslcolor_to_rgb メディア: image_urlimage_tagvideo_tagexternal_video_tagmedia_tagmodel_viewer_tag URL: asset_urlasset_img_urlfile_urlshopify_asset_url HTML: link_toscript_tagstylesheet_tagtime_tagplaceholder_svg_tag ローカライゼーション: t(翻訳)、format_addresscurrency_selector その他: datedefaultjsonstructured_datafont_facefont_urlpayment_button

詳細: 言語フィルターHTML/メディアフィルターコマースフィルター

タグ早見表

カテゴリ タグ
テーマ content_forlayoutsectionsectionsschemastylesheetjavascriptstyle
制御 ifelsifelseunlesscasewhen
繰り返し forbreakcontinuecycletablerowpaginate
変数 assigncaptureincrementdecrementecho
HTML formrenderrawcommentliquid
ドキュメント doc

構文とパラメータを含む詳細: references/tags.md

オブジェクト早見表

グローバルオブジェクト(どこでも使用可能)

cartcollectionscustomerlocalizationpagesrequestroutessettingsshoptemplatethemelinklistsimagesblogsarticlesall_productsmetaobjectscanonical_urlcontent_for_headercontent_for_layoutpage_titlepage_descriptionhandlecurrent_page

ページ固有のオブジェクト

テンプレート オブジェクト
/product productremote_product
/collection collectioncurrent_tags
/cart cart
/article articleblog
/blog blogcurrent_tags
/page page
/search search
/customers/* customerorder

詳細リファレンス: コマースオブジェクトコンテンツオブジェクトtier 2tier 3

Schema タグ

セクションとブロックには、有効な JSON オブジェクトを含む {% schema %} が必要です。 セクションは section.settings.*、ブロックは block.settings.* を使用します。

セクションスキーマの構造

{
  "name": "t:sections.hero.name",
  "tag": "section",
  "class": "hero-section",
  "limit": 1,
  "settings": [],
  "max_blocks": 16,
  "blocks": [{ "type": "@theme" }],
  "presets": [{ "name": "t:sections.hero.name" }],
  "enabled_on": { "templates": ["index"] },
  "disabled_on": { "templates": ["password"] }
}

ブロックスキーマの構造

{
  "name": "t:blocks.slide.name",
  "tag": "div",
  "class": "slide",
  "settings": [],
  "blocks": [{ "type": "@theme" }],
  "presets": [{ "name": "t:blocks.slide.name" }]
}

設定タイプ選択表

用途 設定タイプ 主なフィールド
オン/オフ切り替え checkbox default: true/false
短いテキスト text placeholder
長いテキスト textarea placeholder
リッチテキスト(<p> あり) richtext
インラインリッチテキスト(<p> なし) inline_richtext
数値入力 number placeholder
スライダー range minmaxdefault(すべて必須)、stepunit
ドロップダウン/セグメント select options: [{value, label}]
ラジオボタン radio options: [{value, label}]
テキスト整列 text_alignment default: "left"/"center"/"right"
カラーピッカー color default: "#000000"
画像アップロード image_picker
動画アップロード video
外部動画 URL video_url accept: ["youtube", "vimeo"]
商品ピッカー product
コレクションピッカー collection
ページピッカー page
ブログピッカー blog
記事ピッカー article
URL 入力 url
メニューピッカー link_list
フォントピッカー font_picker default(必須)
エディタヘッダー header contentid 不要)
エディタ説明文 paragraph contentid 不要)

visible_if パターン

{
  "visible_if": "{{ block.settings.layout == 'vertical' }}",
  "type": "select",
  "id": "alignment",
  "label": "t:labels.alignment",
  "options": [...]
}

他の設定値に基づいて、エディタ上で設定項目を条件付きで表示/非表示にします。

ブロックエントリータイプ

  • { "type": "@theme" } — 任意のテーマブロックを受け入れる
  • { "type": "@app" } — アプリブロックを受け入れる
  • { "type": "slide" }slide ブロックタイプのみ受け入れる

スキーマの詳細および全 33 設定タイプ: references/schema-and-settings.md

CSS と JavaScript

コンポーネントごとのスタイルとスクリプト

セクション・ブロック・スニペット内で {% stylesheet %}{% javascript %} を使用します:

{% stylesheet %}
  .my-component { display: flex; }
{% endstylesheet %}

{% javascript %}
  console.log('loaded');
{% endjavascript %}
  • 1 ファイルにつき各タグ 1 つまで{% stylesheet %} を複数記述するとエラーになる
  • 内部で Liquid は使えない — これらのタグは Liquid を処理しない。代わりに CSS 変数またはクラスを使う
  • セクション・ブロック・スニペット内でのみサポートされる(sections/blocks/snippets/

{% style %} タグ(Liquid 対応 CSS)

Liquid が必要な動的 CSS に使用します(エディタでライブ更新されるカラー設定など):

{% style %}
  .section-{{ section.id }} {
    background: {{ section.settings.bg_color }};
  }
{% endstyle %}

設定値を CSS に適用するパターン

単一の CSS プロパティ — CSS 変数を使う:

<div style="--gap: {{ block.settings.gap }}px">

複数の CSS プロパティ — select の値に CSS クラスを使う:

<div class="{{ block.settings.layout }}">

LiquidDoc({% doc %}

必須の場面: スニペット(常に)、ブロック({% content_for 'block' %} で静的レンダリングされる場合)

{% doc %}
  このファイルがレンダリングする内容の簡単な説明。

  @param {type} name - 必須パラメータの説明
  @param {type} [name] - オプションパラメータの説明(角括弧 = オプション)

  @example
  {% render 'snippet-name', name: value %}
{% enddoc %}

パラメータの型: `string

原文(English)を表示

Shopify Liquid Themes

Theme Architecture

.
├── sections/    # Full-width page modules with {% schema %} — hero, product grid, testimonials
├── blocks/      # Nestable components with {% schema %} — slides, feature items, text blocks
├── snippets/    # Reusable fragments via {% render %} — buttons, icons, image helpers
├── layout/      # Page wrappers (must include {{ content_for_header }} and {{ content_for_layout }})
├── templates/   # JSON files defining which sections appear on each page type
├── config/      # Global theme settings (settings_schema.json, settings_data.json)
├── locales/     # Translation files (en.default.json, fr.json, etc.)
└── assets/      # Static CSS, JS, images (prefer {% stylesheet %}/{% javascript %} instead)

When to use what

Need Use Why
Full-width customizable module Section Has {% schema %}, appears in editor, renders blocks
Small nestable component with editor settings Block Has {% schema %}, can nest inside sections/blocks
Reusable logic, not editable by merchant Snippet No schema, rendered via {% render %}, takes params
Logic shared across blocks/snippets Snippet Blocks can't {% render %} other blocks

Liquid Syntax

Delimiters

  • {{ ... }} — Output (prints a value)
  • {{- ... -}} — Output with whitespace trimming
  • {% ... %} — Logic tag (if, for, assign) — prints nothing
  • {%- ... -%} — Logic tag with whitespace trimming

Operators

Comparison: ==, !=, >, <, >=, <= Logical: and, or, contains

Critical Gotchas

  1. No parentheses in conditions — use nested {% if %} instead
  2. No ternary — always use {% if cond %}value{% else %}other{% endif %}
  3. for loops max 50 iterations — use {% paginate %} for larger arrays
  4. contains only works with strings — can't check objects in arrays
  5. {% stylesheet %}/{% javascript %} don't render Liquid — no Liquid inside them
  6. Snippets can't access outer-scope variables — pass them as render params
  7. include is deprecated — always use {% render 'snippet_name' %}
  8. {% liquid %} tag — multi-line logic without delimiters; use echo for output

Variables

{% assign my_var = 'value' %}
{% capture my_var %}computed {{ value }}{% endcapture %}
{% increment counter %}
{% decrement counter %}

Filter Quick Reference

Filters are chained with |. Output type of one filter feeds input of next.

Array: compact, concat, find, find_index, first, has, join, last, map, reject, reverse, size, sort, sort_natural, sum, uniq, where String: append, capitalize, downcase, escape, handleize, lstrip, newline_to_br, prepend, remove, replace, rstrip, slice, split, strip, strip_html, truncate, truncatewords, upcase, url_decode, url_encode Math: abs, at_least, at_most, ceil, divided_by, floor, minus, modulo, plus, round, times Money: money, money_with_currency, money_without_currency, money_without_trailing_zeros Color: color_brightness, color_darken, color_lighten, color_mix, color_modify, color_saturate, color_desaturate, color_to_hex, color_to_hsl, color_to_rgb Media: image_url, image_tag, video_tag, external_video_tag, media_tag, model_viewer_tag URL: asset_url, asset_img_url, file_url, shopify_asset_url HTML: link_to, script_tag, stylesheet_tag, time_tag, placeholder_svg_tag Localization: t (translate), format_address, currency_selector Other: date, default, json, structured_data, font_face, font_url, payment_button

Full details: language filters, HTML/media filters, commerce filters

Tags Quick Reference

Category Tags
Theme content_for, layout, section, sections, schema, stylesheet, javascript, style
Control if, elsif, else, unless, case, when
Iteration for, break, continue, cycle, tablerow, paginate
Variable assign, capture, increment, decrement, echo
HTML form, render, raw, comment, liquid
Documentation doc

Full details with syntax and parameters: references/tags.md

Objects Quick Reference

Global objects (available everywhere)

cart, collections, customer, localization, pages, request, routes, settings, shop, template, theme, linklists, images, blogs, articles, all_products, metaobjects, canonical_url, content_for_header, content_for_layout, page_title, page_description, handle, current_page

Page-specific objects

Template Objects
/product product, remote_product
/collection collection, current_tags
/cart cart
/article article, blog
/blog blog, current_tags
/page page
/search search
/customers/* customer, order

Full reference: commerce objects, content objects, tier 2, tier 3

Schema Tag

Sections and blocks require {% schema %} with a valid JSON object. Sections use section.settings.*, blocks use block.settings.*.

Section schema structure

{
  "name": "t:sections.hero.name",
  "tag": "section",
  "class": "hero-section",
  "limit": 1,
  "settings": [],
  "max_blocks": 16,
  "blocks": [{ "type": "@theme" }],
  "presets": [{ "name": "t:sections.hero.name" }],
  "enabled_on": { "templates": ["index"] },
  "disabled_on": { "templates": ["password"] }
}

Block schema structure

{
  "name": "t:blocks.slide.name",
  "tag": "div",
  "class": "slide",
  "settings": [],
  "blocks": [{ "type": "@theme" }],
  "presets": [{ "name": "t:blocks.slide.name" }]
}

Setting type decision table

Need Setting Type Key Fields
On/off toggle checkbox default: true/false
Short text text placeholder
Long text textarea placeholder
Rich text (with <p>) richtext
Inline rich text (no <p>) inline_richtext
Number input number placeholder
Slider range min, max, default (all required), step, unit
Dropdown/segmented select options: [{value, label}]
Radio buttons radio options: [{value, label}]
Text alignment text_alignment default: "left"/"center"/"right"
Color picker color default: "#000000"
Image upload image_picker
Video upload video
External video URL video_url accept: ["youtube", "vimeo"]
Product picker product
Collection picker collection
Page picker page
Blog picker blog
Article picker article
URL entry url
Menu picker link_list
Font picker font_picker default (required)
Editor header header content (no id needed)
Editor description paragraph content (no id needed)

visible_if pattern

{
  "visible_if": "{{ block.settings.layout == 'vertical' }}",
  "type": "select",
  "id": "alignment",
  "label": "t:labels.alignment",
  "options": [...]
}

Conditionally shows/hides a setting in the editor based on other setting values.

Block entry types

  • { "type": "@theme" } — Accept any theme block
  • { "type": "@app" } — Accept app blocks
  • { "type": "slide" } — Accept only the slide block type

Full schema details and all 33 setting types: references/schema-and-settings.md

CSS & JavaScript

Per-component styles and scripts

Use {% stylesheet %} and {% javascript %} in sections, blocks, and snippets:

{% stylesheet %}
  .my-component { display: flex; }
{% endstylesheet %}

{% javascript %}
  console.log('loaded');
{% endjavascript %}
  • One tag each per file — multiple {% stylesheet %} tags will error
  • No Liquid inside — these tags don't process Liquid; use CSS variables or classes instead
  • Only supported in sections/, blocks/, and snippets/

{% style %} tag (Liquid-aware CSS)

For dynamic CSS that needs Liquid (e.g., color settings that live-update in editor):

{% style %}
  .section-{{ section.id }} {
    background: {{ section.settings.bg_color }};
  }
{% endstyle %}

CSS patterns for settings

Single CSS property — use CSS variables:

<div style="--gap: {{ block.settings.gap }}px">

Multiple CSS properties — use CSS classes as select values:

<div class="{{ block.settings.layout }}">

LiquidDoc ({% doc %})

Required for: snippets (always), blocks (when statically rendered via {% content_for 'block' %})

{% doc %}
  Brief description of what this file renders.

  @param {type} name - Description of required parameter
  @param {type} [name] - Description of optional parameter (brackets = optional)

  @example
  {% render 'snippet-name', name: value %}
{% enddoc %}

Param types: string, number, boolean, image, object, array

Translations

Every user-facing string must use the t filter

<!-- Correct -->
<h2>{{ 'sections.hero.heading' | t }}</h2>
<button>{{ 'products.add_to_cart' | t }}</button>

<!-- Wrong — never hardcode strings -->
<h2>Welcome to our store</h2>

Variable interpolation

{{ 'products.price_range' | t: min: product.price_min | money, max: product.price_max | money }}

Locale file:

{
  "products": {
    "price_range": "From {{ min }} to {{ max }}"
  }
}

Locale file structure

locales/
├── en.default.json          # English translations (required)
├── en.default.schema.json   # Editor setting translations (required)
├── fr.json                  # French translations
└── fr.schema.json           # French editor translations

Key naming conventions

  • Use snake_case and hierarchical keys (max 3 levels)
  • Use sentence case for all text (capitalize first word only)
  • Schema labels use t: prefix: "label": "t:labels.heading"
  • Group by component: sections.hero.heading, blocks.slide.title

References

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。