shopify
关于
This skill provides comprehensive guidance for building Shopify apps, extensions, themes, and API integrations. Use it when developing with Shopify CLI, Polaris UI, GraphQL/REST APIs, or creating checkout extensions and Liquid themes. It covers the full platform ecosystem, including Hydrogen for headless storefronts and Shopify Functions.
技能文档
Shopify Development
This skill provides comprehensive guidance for building on the Shopify platform, including apps, extensions, themes, and API integrations.
When to Use This Skill
Use this skill when you need to:
- Build Shopify apps (public or custom)
- Create checkout, admin, or POS UI extensions
- Develop themes using Liquid templating
- Integrate with Shopify APIs (GraphQL Admin API, REST API, Storefront API)
- Implement Shopify Functions (discounts, payments, delivery, validation)
- Build headless storefronts with Hydrogen
- Configure webhooks and metafields
- Use Shopify CLI for development workflows
Core Platform Components
1. Shopify CLI
Installation:
npm install -g @shopify/cli@latest
Essential Commands:
shopify app init- Create new appshopify app dev- Start local development servershopify app deploy- Deploy app to Shopifyshopify app generate extension- Add extension to appshopify theme dev- Preview theme locallyshopify theme pull/push- Sync theme files
For detailed CLI reference, see reference/cli-commands.md
2. GraphQL Admin API (Recommended)
Primary API for new development. Efficient, type-safe, flexible.
Endpoint:
https://{shop-name}.myshopify.com/admin/api/2025-01/graphql.json
Authentication:
headers: {
'X-Shopify-Access-Token': 'your-access-token',
'Content-Type': 'application/json'
}
Common Operations:
- Query products, orders, customers, inventory
- Create/update/delete resources via mutations
- Bulk operations for large datasets
- Real-time data with subscriptions
For comprehensive GraphQL reference, see reference/graphql-admin-api.md
3. REST Admin API (Maintenance Mode)
Use only for legacy systems. Shopify recommends GraphQL for all new development.
Base URL:
https://{shop-name}.myshopify.com/admin/api/2025-01/{resource}.json
Rate Limits:
- Standard: 2 requests/second
- Plus: 4 requests/second
4. UI Frameworks
Polaris (React)
Design system for consistent Shopify UI:
npm install @shopify/polaris
Polaris Web Components
Framework-agnostic components:
<script src="https://cdn.shopify.com/shopifycloud/polaris.js"></script>
Extension Types
Checkout UI Extensions
Customize checkout experience with native-rendered components.
Generate:
shopify app generate extension --type checkout_ui_extension
Configuration: shopify.extension.toml
Common Components: View, BlockStack, InlineLayout, Button, TextField, Checkbox, Banner
For detailed extension reference, see reference/ui-extensions.md
Admin UI Extensions
Extend Shopify admin interface.
Types:
- App blocks (embedded in native pages)
- App overlays (modal experiences)
- Links (product/collection/order pages)
POS Extensions
Customize Point of Sale experience.
Types:
- Smart Grid Tiles (quick access actions)
- Modals (dialogs and forms)
- Cart modifications (custom discounts/line items)
Post-Purchase Extensions
Upsell offers after checkout completion.
Target: purchase.thank-you.block.render
Customer Account UI Extensions
Customize post-purchase account pages.
Targets: Account overview, order status/index
Shopify Functions
Serverless backend customization running on Shopify infrastructure.
Function Types:
- Discounts: Cart, product, shipping, order discounts
- Payment customization: Hide/rename/reorder payment methods
- Delivery customization: Custom shipping options
- Order routing: Fulfillment location rules
- Validation: Cart and checkout business rules
- Fulfillment constraints: Bundle shipping rules
Languages: JavaScript, Rust, AssemblyScript
Generate:
shopify app generate extension --type function
Theme Development
Liquid Templating
Core Concepts:
- Objects:
{{ product.title }}- Output dynamic content - Filters:
{{ product.price | money }}- Transform data - Tags:
{% if %} {% for %} {% case %}- Control flow
Common Objects:
product- Product datacollection- Collection datacart- Shopping cartcustomer- Customer accountshop- Store information
Architecture:
- Layouts: Base templates
- Templates: Page structures
- Sections: Reusable content blocks (Online Store 2.0)
- Snippets: Smaller components
Development:
shopify theme dev # Local preview
shopify theme pull # Download from store
shopify theme push # Upload to store
Authentication & Security
OAuth 2.0 Flow
For public apps accessing merchant stores:
- Redirect merchant to authorization URL
- Merchant approves access
- Receive authorization code
- Exchange code for access token
- Store token securely
Access Scopes
Request minimum permissions needed:
read_products- View productswrite_products- Modify productsread_orders- View orderswrite_orders- Modify orders
Full scope list: https://shopify.dev/api/usage/access-scopes
Session Tokens
For embedded apps in Shopify admin using App Bridge.
Webhooks
Real-time event notifications from Shopify.
Configuration: shopify.app.toml
Common Topics:
orders/create,orders/updated,orders/paidproducts/create,products/update,products/deletecustomers/create,customers/updateapp/uninstalled
GDPR Mandatory Webhooks:
customers/data_requestcustomers/redactshop/redact
Metafields
Custom data storage for extending Shopify resources.
Owners: Products, variants, customers, orders, collections, shop
Types: text, number, date, URL, JSON, file_reference
Access: Admin API, Storefront API, Liquid templates
Best Practices
Performance
- Use GraphQL instead of REST for efficiency
- Request only needed fields in queries
- Implement pagination for large datasets
- Use bulk operations for batch processing
- Respect rate limits (cost-based for GraphQL)
User Experience
- Follow Polaris design guidelines
- Implement loading states
- Provide clear error messages
- Support keyboard navigation
- Test across devices
Security
- Store API credentials securely
- Use environment variables for tokens
- Implement webhook verification
- Follow OAuth best practices
- Request minimal access scopes
Code Quality
- Use TypeScript for type safety
- Write comprehensive error handling
- Implement retry logic with exponential backoff
- Log errors for debugging
- Keep dependencies updated
Testing
- Use development stores for testing
- Test across different store plans
- Verify webhook handling
- Test app uninstall flow
- Validate GDPR compliance
Development Workflow
-
Initialize App:
shopify app init -
Configure Access Scopes: Edit
shopify.app.toml:[access_scopes] scopes = "read_products,write_products" -
Start Development Server:
shopify app dev -
Generate Extensions:
shopify app generate extension -
Test in Development Store: Install app on test store
-
Deploy to Production:
shopify app deploy
Common Patterns
Fetch Products (GraphQL)
query {
products(first: 10) {
edges {
node {
id
title
handle
variants(first: 5) {
edges {
node {
id
price
inventoryQuantity
}
}
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
Create Product (GraphQL)
mutation {
productCreate(input: {
title: "New Product"
productType: "Clothing"
variants: [{
price: "29.99"
sku: "SKU123"
}]
}) {
product {
id
title
}
userErrors {
field
message
}
}
}
Checkout Extension (React)
import { useState } from 'react';
import {
render,
BlockStack,
TextField,
Checkbox,
useApi
} from '@shopify/ui-extensions-react/checkout';
function Extension() {
const { extensionPoint } = useApi();
const [checked, setChecked] = useState(false);
return (
<BlockStack>
<TextField label="Gift Message" />
<Checkbox checked={checked} onChange={setChecked}>
This is a gift
</Checkbox>
</BlockStack>
);
}
render('Checkout::Dynamic::Render', () => <Extension />);
Resources
Documentation
- Official docs: https://shopify.dev/docs
- GraphQL API: https://shopify.dev/docs/api/admin-graphql
- Shopify CLI: https://shopify.dev/docs/api/shopify-cli
- Polaris: https://polaris.shopify.com
Tools
- GraphiQL Explorer: Built into Shopify admin
- Shopify CLI: Development workflow
- Partner Dashboard: App management
- Development stores: Free testing environments
Learning
- Shopify Developer Changelog: API updates and deprecations
- Built for Shopify: Quality program for apps
- Community forums: Help and discussions
Reference Documentation
This skill includes detailed reference documentation:
- GraphQL Admin API Reference - Comprehensive API guide
- Shopify CLI Commands - Complete CLI reference
- UI Extensions - Extension types and components
Troubleshooting
Common Issues
Rate Limit Errors:
- Monitor
X-Shopify-Shop-Api-Call-Limitheader - Implement exponential backoff
- Use bulk operations for large datasets
Authentication Failures:
- Verify access token is valid
- Check required scopes are granted
- Ensure OAuth flow completed correctly
Webhook Not Receiving Events:
- Verify webhook URL is accessible
- Check webhook signature validation
- Review webhook logs in Partner Dashboard
Extension Not Appearing:
- Verify extension target is correct
- Check extension is published
- Ensure app is installed on store
Version Management
Shopify uses quarterly API versioning (YYYY-MM format):
- Current: 2025-01
- Each version supported for 12 months
- Test updates before quarterly releases
- Use version-specific endpoints
App Distribution
Custom Apps
Single merchant installation, no review required.
Public Apps
App Store listing with Shopify review:
- Follow app requirements
- Complete Built for Shopify criteria
- Define pricing model
- Submit for review
Note: This skill covers the Shopify platform as of January 2025. Always refer to official Shopify documentation for the latest updates and API versions.
快速安装
/plugin add https://github.com/Elios-FPT/EliosCodePracticeService/tree/main/shopify在 Claude Code 中复制并粘贴此命令以安装该技能
GitHub 仓库
相关推荐技能
evaluating-llms-harness
测试该Skill通过60+个学术基准测试(如MMLU、GSM8K等)评估大语言模型质量,适用于模型对比、学术研究及训练进度追踪。它支持HuggingFace、vLLM和API接口,被EleutherAI等行业领先机构广泛采用。开发者可通过简单命令行快速对模型进行多任务批量评估。
langchain
元LangChain是一个用于构建LLM应用程序的框架,支持智能体、链和RAG应用开发。它提供多模型提供商支持、500+工具集成、记忆管理和向量检索等核心功能。开发者可用它快速构建聊天机器人、问答系统和自主代理,适用于从原型验证到生产部署的全流程。
project-structure
元这个Skill为开发者提供全面的项目目录结构设计指南和最佳实践。它涵盖了多种项目类型包括monorepo、前后端框架、库和扩展的标准组织结构。帮助团队创建可扩展、易维护的代码架构,特别适用于新项目设计、遗留项目迁移和团队规范制定。
issue-documentation
元该Skill为开发者提供标准化的issue文档模板和指南,适用于创建bug报告、GitHub/Linear/Jira问题等场景。它能系统化地记录问题状况、复现步骤、根本原因、解决方案和影响范围,确保团队沟通清晰高效。通过实施主流问题跟踪系统的最佳实践,帮助开发者生成结构完整的故障排除文档和事件报告。
