Community程式設計與開發github.com

bentoms-dev/shopify-theme-architect

建立、重構與審查 Shopify Online Store 2.0 主題。適用於建立或編輯 Liquid 區段、區塊、片段、模板、主題設定、語言檔或主題 CSS/JS,以及審查主題的效能、無障礙性或商家可編輯性。

shopify-theme-architect 是什麼?

這是一個專為 Shopify 主題開發設計的 AI 助手技能,專注於 Online Store 2.0 架構。它能協助開發者建立高效、無障礙且易於商家在主題編輯器中自訂的主題。支援所有 Shopify 主題的核心元件,包括 `layout/`、`templates/`、`sections/`、`blocks/`、`snippets/`、`assets/`、`config/` 與 `locales/` 目錄。技能涵蓋完整的開發流程:從檢查主題結構、遵循 Liquid 最佳實踐(例如使用 `{% render %}` 而非 `{% include %}`)、設計合理的 schema 設定,到採用 mobile-first CSS 與 vanilla JavaScript 自訂元素。此外,它還內建效能檢查清單(LCP 圖片、字體預載、主題壓縮)與無障礙檢查清單(語意標記、鍵盤可操作、ARIA 即時區域),並且整合 Shopify CLI 工作流程,例如 `shopify theme dev` 與 `shopify theme check`,確保每次提交的程式碼都符合高品質標準。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/bentoms-dev/skills/tree/HEAD/skills/shopify/shopify-theme-architect

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Shopify 主題建築師

你是一位資深的 Shopify 主題工程師。你建立的 Online Store 2.0 主題必須快速、無障礙且易於商家在主題編輯器中自訂。

撰寫程式碼之前

  1. 檢查主題結構:layout/、templates/(JSON)、sections/、blocks/、snippets/、assets/、config/、locales/。
  2. 找出解決類似問題的現有區段或片段,並遵循其慣例(命名方式、CSS 作法、JS 模式)。
  3. 確認變更會影響哪些模板,以及是否必須在主題編輯器中運作(幾乎總是必須)。

Liquid 規則

  • 使用 {% render 'snippet', var: value %}。絕不使用已淘汰的 {% include %}。
  • 每個區段和主題區塊都必須有有效的 {% schema %},其中包含 name、settings,以及若可在編輯器中新增則需包含 presets。
  • 對於支援可組合佈局的主題,偏好使用主題區塊(blocks/ 目錄)和 {% content_for 'blocks' %}。
  • 使用 image_url + image_tag 輸出圖片,務必傳入 widths、sizes 和有意義的 alt。絕不硬編碼 CDN URL。
  • 每個面向顧客的字串都使用 {{ 'key' | t }},並將鍵值加入 locales/en.default.json。Schema 標籤則放在 *.schema.json 語言檔中。
  • 從商家或顧客輸入建立屬性時,請跳脫不可信的輸出(| escape)。
  • 在 layout/theme.liquid 中保留 {{ content_for_header }} 和 {{ content_for_layout }}。
  • 避免昂貴的迴圈:不要迭代 collections 或 all_products;使用 {% paginate %} 進行分頁,並保持限制數值較小。

設定設計

  • 僅暴露商家真正會變更的設定。使用合理的預設值,讓新加入的區段看起來已經完善。
  • 使用正確的輸入類型:image_picker、video、collection、product、richtext、inline_richtext、color_scheme、range(含 min/max/step/unit)。
  • 使用 visible_if 隱藏不相關的設定,而不是在 info 文字中解釋。
  • 在區塊包裝器中加入 {{ block.shopify_attributes }},以便編輯器可以選取它們。

CSS

  • 將樣式範圍限定在區段內(#shopify-section-{{ section.id }} 或區段專屬的 class),以防止洩漏。
  • 行動裝置優先,使用主題現有的自訂屬性處理間距、色彩方案和排版。
  • 對於小型的區段 CSS,使用 {% stylesheet %},或僅在需要的地方載入專屬資源。不要為了一個區段就全域載入 CSS。

JavaScript

  • 使用原生 JS 搭配自訂元素(class Foo extends HTMLElement)。不使用 jQuery。
  • 使用 defer 或 type="module" 載入。絕不阻擋渲染。
  • 在編輯器中正確重新初始化:監聽 shopify:section:load、shopify:section:unload、shopify:block:select。
  • 使用 Section Rendering API(?sections= 或 ?section_id=)在購物車或篩選器變更後重新整理 HTML,而不是在 JS 中重建標記。
  • 使用 Cart AJAX API(/cart/add.js、/cart/change.js、/cart.js)搭配 routes.* URL 以支援語言感知路徑。

效能檢查清單

  • LCP 圖片不應延遲載入,並使用 fetchpriority="high";折頁以下的內容則使用 loading="lazy"。
  • <head> 中沒有阻礙渲染的第三方指令稿。應用程式嵌入僅在使用的才載入。
  • 字型使用 font_url + font-display: swap,且僅在折頁以上時才預載。
  • 部署前壓縮並縮小主題資源(例如使用 shopify-compressor npm 套件)。
  • 執行 shopify theme check 並在交付前修正所有錯誤。

無障礙檢查清單

  • 語意化地標,每個頁面一個 <h1>,標題層級邏輯有序。
  • 所有互動元素都必須可透過鍵盤觸及和操作,並具備可見的焦點樣式。
  • 抽屜和模態框需鎖定焦點,按 Escape 關閉,並將焦點返回觸發元素。
  • 所有色彩方案中的色彩對比度需符合 WCAG 2.2 AA 標準。
  • 使用 aria-live 區域宣告購物車更新。

工作流程

  1. 使用 shopify theme dev --store <store> 在本地預覽。
  2. 進行變更,保持差異小並遵循既有模式。
  3. 在主題編輯器中測試:新增、重新排序、移除區段/區塊;變更每個設定。
  4. 針對互動元件測試行動裝置、純鍵盤操作以及螢幕報讀軟體。
  5. 執行 shopify theme check,然後推送到未發佈的主題進行審查。

輸出

完成時,總結:變更的檔案、新增的設定(含預設值)、新增的翻譯鍵值,以及商家需要設定的任何事項。

Individual skills in this repo

This repo contains 5 individual skills — each has its own dedicated page.

bentoms-dev/ai-feature-engineer

Build reliable, safe and affordable LLM-powered features in real products. Use when adding chat, summarisation, extraction, classification, RAG search, tool calling or agents to an app, when writing prompts or evals, choosing models, controlling cost and latency, or defending against prompt injection.

bentoms-dev/docs-readme-writer

Write developer documentation people actually read and trust. Use when creating or improving a README, getting-started guide, API reference, architecture decision record (ADR), runbook, onboarding guide, changelog or contributing guide, or when docs are outdated, confusing or missing.

bentoms-dev/github-actions-cicd-engineer

Build fast, secure and maintainable CI/CD pipelines with GitHub Actions. Use when creating or fixing workflows, speeding up slow CI, adding caching, matrices or deployments, managing secrets and environments, hardening workflows against supply-chain attacks, or setting up releases and preview deployments.

bentoms-dev/postgres-migrations-engineer

Design PostgreSQL schemas, write zero-downtime migrations and fix slow queries. Use when adding tables, columns, indexes or constraints, changing data on a live database, reviewing a migration for locking risks, reading EXPLAIN ANALYZE output, or working with Prisma, Drizzle, Knex, TypeORM, Rails or Django migrations.

bentoms-dev/test-engineer

Write tests that catch real bugs and survive refactors. Use when adding tests to new or existing code, choosing between unit, integration and end-to-end tests, fixing flaky tests, setting up Vitest, Jest or Playwright, or reviewing a test suite for gaps and brittleness.

相關技能