shopify-development – skill Lập trình cho agent AI
Xây dựng ứng dụng, extension và theme Shopify bằng GraphQL Admin API, Shopify CLI, Polaris UI và Liquid.
Cài skill shopify-development bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/shopify-development-f6d27.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /shopify-development – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/shopify-development-f6d27.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $shopify-development – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/shopify-development-f6d27.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /shopify-development – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/shopify-development-f6d27.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /shopify-development – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Shopify Development Skill
Use this skill when the user asks about:
- Building Shopify apps or extensions
- Creating checkout/admin/POS UI customizations
- Developing themes with Liquid templating
- Integrating with Shopify GraphQL or REST APIs
- Implementing webhooks or billing
- Working with metafields or Shopify Functions
---
ROUTING: What to Build
IF user wants to integrate external services OR build merchant tools OR charge for features:
→ Build an App (see references/app-development.md)
IF user wants to customize checkout OR add admin UI OR create POS actions OR implement discount rules:
→ Build an Extension (see references/extensions.md)
IF user wants to customize storefront design OR modify product/collection pages:
→ Build a Theme (see references/themes.md)
IF user needs both backend logic AND storefront UI:
→ Build App + Theme Extension combination
---
Execution and version boundaries
Pin the CLI/API version. Examples are scaffolding sketches, not tested deployed
apps. App deployment, theme uploads, fulfillment, billing and data exports require
the authorized store, scope and intended effect. Do not retry an ambiguous mutation.
The initializer emits partial configuration only, refuses existing project folders,
and loads .env files only with SHOPIFY_LOAD_ENV_FILES=1. Prefer CLI-generated
projects. Development tunnels expose endpoints externally; use test data.
Shopify CLI Commands
Install CLI:
npm install -g @shopify/cli@latestCreate and run app:
shopify app init # Create new app
shopify app dev # Start dev server with tunnel
shopify app deploy # Build and upload to ShopifyGenerate extension:
shopify app generate extension --type checkout_ui_extension
shopify app generate extension --type admin_action
shopify app generate extension --type admin_block
shopify app generate extension --type pos_ui_extension
shopify app generate extension --type functionTheme development:
shopify theme init # Create new theme
shopify theme dev # Start local preview at localhost:9292
shopify theme pull --live # Pull live theme
shopify theme push --development # Push to dev theme---
Access Scopes
Configure in shopify.app.toml:
[access_scopes]
scopes = "read_products,write_products,read_orders,write_orders,read_customers"Common scopes:
read_products,write_products- Product catalog accessread_orders,write_orders- Order managementread_customers,write_customers- Customer dataread_inventory,write_inventory- Stock levelsread_fulfillments,write_fulfillments- Order fulfillment
---
GraphQL patterns (example API 2026-01)
Query Products
query GetProducts($first: Int!, $query: String) {
products(first: $first, query: $query) {
edges {
node {
id
title
handle
status
variants(first: 5) {
edges {
node {
id
price
inventoryQuantity
}
}
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}Query Orders
query GetOrders($first: Int!) {
orders(first: $first) {
edges {
node {
id
name
createdAt
displayFinancialStatus
totalPriceSet {
shopMoney {
amount
currencyCode
}
}
}
}
}
}Set Metafields
mutation SetMetafields($metafields: [MetafieldsSetInput!]!) {
metafieldsSet(metafields: $metafields) {
metafields {
id
namespace
key
value
}
userErrors {
field
message
}
}
}Variables example:
{
"metafields": [
{
"ownerId": "gid://shopify/Product/123",
"namespace": "custom",
"key": "care_instructions",
"value": "Handle with care",
"type": "single_line_text_field"
}
]
}---
Checkout extension example (legacy React API)
This React example targets an older extension API, not 2026-01. Generate a Preact
extension with the pinned CLI for current APIs; do not mix React hooks/components
with 2026-01 web components. Clear the gift attribute when unchecked and handle
change failures before using this sketch.
import {useState, useEffect} from "react";
import {
reactExtension,
BlockStack,
TextField,
Checkbox,
useApplyAttributeChange,
} from "@shopify/ui-extensions-react/checkout";
export default reactExtension("purchase.checkout.block.render", () => (
<GiftMessage />
));
function GiftMessage() {
const [isGift, setIsGift] = useState(false);
const [message, setMessage] = useState("");
const applyAttributeChange = useApplyAttributeChange();
useEffect(() => {
if (true) { // Also clear a previously saved message when gift is unchecked
applyAttributeChange({
type: "updateAttribute",
key: "gift_message",
value: isGift ? message : "",
});
}
}, [isGift, message]);
return (
<BlockStack spacing="loose">
<Checkbox checked={isGift} onChange={setIsGift}>
This is a gift
</Checkbox>
{isGift && (
<TextField
label="Gift Message"
value={message}
onChange={setMessage}
multiline={3}
/>
)}
</BlockStack>
);
}---
Liquid Template Example
{% comment %} Product Card Snippet {% endcomment %}
<div class="product-card">
<a href="{{ product.url }}">
{% if product.featured_image %}
<img
src="{{ product.featured_image | img_url: 'medium' }}"
alt="{{ product.title | escape }}"
loading="lazy"
>
{% endif %}
<h3>{{ product.title }}</h3>
<p class="price">{{ product.price | money }}</p>
{% if product.compare_at_price > product.price %}
<p class="sale-badge">Sale</p>
{% endif %}
</a>
</div>---
Webhook Configuration
In shopify.app.toml:
[webhooks]
api_version = "2026-01"
[[webhooks.subscriptions]]
topics = ["orders/create", "orders/updated"]
uri = "/webhooks/orders"
[[webhooks.subscriptions]]
topics = ["products/update"]
uri = "/webhooks/products"
# GDPR mandatory webhooks (required for app approval)
[[webhooks.subscriptions]]
compliance_topics = ["customers/data_request", "customers/redact", "shop/redact"]
uri = "/webhooks/privacy"---
Best Practices
API Usage
- Use GraphQL over REST for new development
- Request only fields you need (reduces query cost)
- Implement cursor-based pagination with
pageInfo.endCursor - Use bulk operations for processing more than 250 items
- Handle rate limits with exponential backoff
Security
- Store API credentials in environment variables
- Always verify webhook HMAC signatures before processing
- Validate OAuth state parameter to prevent CSRF
- Request minimal access scopes
- Use session tokens for embedded apps
Performance
- Cache API responses when data doesn't change frequently
- Use lazy loading in extensions
- Optimize images in themes using
img_urlfilter - Monitor GraphQL query costs in the response extensions.cost object
---
Troubleshooting
IF you see rate limit errors:
→ Implement exponential backoff retry logic
→ Switch to bulk operations for large datasets
→ Inspect GraphQL extensions.cost.throttleStatus; the call-limit header is for REST
IF authentication fails:
→ Verify the access token is still valid
→ Check that all required scopes were granted
→ Ensure OAuth flow completed successfully
IF extension is not appearing:
→ Verify the extension target is correct
→ Check that extension is published via shopify app deploy
→ Confirm the app is installed on the test store
IF webhook is not receiving events:
→ Verify the webhook URL is publicly accessible
→ Check HMAC signature validation logic
→ Review webhook logs in Partner Dashboard
IF GraphQL query fails:
→ Validate query against schema (use GraphiQL explorer)
→ Check for deprecated fields in error message
→ Verify you have required access scopes
---
Reference Files
For detailed implementation guides, read these files:
references/app-development.md- OAuth authentication flow, GraphQL mutations for products/orders/billing, webhook handlers, billing API integrationreferences/extensions.md- Checkout UI components, Admin UI extensions, POS extensions, Shopify Functions for discounts/payment/deliveryreferences/themes.md- Liquid syntax reference, theme directory structure, sections and snippets, common patterns
---
Scripts
scripts/shopify_init.py- Interactive project scaffolding. Run:python scripts/shopify_init.pyscripts/shopify_graphql.py- GraphQL utilities with query templates, pagination, rate limiting. Import:from shopify_graphql import ShopifyGraphQL
… (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- shopify-review-triage – Biến các đánh giá công khai 1-3 sao trên Shopify App Store thành bản phân loại P0-P3…
- simplify-code – Rà soát diff về độ rõ ràng và các đơn giản hóa an toàn, sau đó tùy chọn áp dụng các sửa…
- since-cutoff – Tìm các API trong các thư viện Python đã ghim phiên bản của dự án đã thay đổi sau thời…
- site-architecture – Lên kế hoạch hoặc tái cấu trúc hệ thống phân cấp website, điều hướng, mẫu URL…
- skill-check – Kiểm tra skill của Claude Code theo đặc tả agentskills. Phát hiện lỗi cấu trúc, ngữ…
- skill-creator – Tạo và rà soát bản nháp skill có tái sử dụng, kèm scaffolding Python, kiểm tra…
- skill-developer – Hướng dẫn toàn diện tạo và quản lý skill trong Claude Code với hệ thống tự kích hoạt…
- skill-improver – Cải thiện lặp đi lặp lại một skill của Claude Code bằng skill-reviewer agent cho đến khi…