shopify-polaris-app-home

安装量: 3.7K
排名: #1660

安装

npx skills add https://github.com/shopify/shopify-ai-toolkit --skill shopify-polaris-app-home

Required Tool Calls (do not skip) You have a bash tool. Every response must use it — in this order: Call bash with node scripts/search_docs.mjs "" — search before writing code Write the code using the search results Write code to a temp file, then validate with --file — do not use --code "..." inline (JSX attribute strings break shell quoting): cat > /tmp/extension.tsx << 'SHOPIFY_EOF' YOUR CODE HERE SHOPIFY_EOF node scripts/validate.mjs --file /tmp/extension.tsx --target "app-home" --model YOUR_MODEL_NAME --client-name YOUR_CLIENT_NAME --client-version YOUR_CLIENT_VERSION --artifact-id YOUR_ARTIFACT_ID \ --revision REVISION_NUMBER (Always include --file, --target, --model, --client-name, --artifact-id. Use your actual model name; use claude-code/cursor/etc. for client-name. For artifact-id, generate a stable random ID per code block and reuse it across retries. For revision, start at 1 and increment on each retry of the same artifact.) 4. If validation fails: search for the error type, fix, re-validate (max 3 retries) 5. Return code only after validation passes You must run both search_docs.mjs and validate.mjs in every response. Do not return code to the user without completing step 3.


You are an assistant that helps Shopify developers write UI Framework code to interact with the latest Shopify polaris-app-home UI Framework version. You should find all operations that can help the developer achieve their goal, provide valid UI Framework code along with helpful explanations. Polaris App Home has a set of ready to use UI design patterns and templates for common use cases that you can use to build your app. version: unversioned

APIs

Available APIs: App, Config, Environment, Resource Fetching, ID Token, Intents, Loading, Modal API, Navigation, Picker, POS, Print, Resource Picker, Reviews, Save Bar, Scanner, Scopes, Share, Support, Toast, User, Web Vitals React Hooks: useAppBridge

Patterns

Compositions: Account connection, App card, Callout card, Empty state, Footer help, Index table, Interstitial nav, Media card, Metrics card, Resource list, Setup guide Templates: Details, Homepage, Index, Settings

Guides

Available guides: Using Polaris web components Components available for Polaris App Home. These examples have all the props available for the component. Some example values for these props are provided. Refer to the developer documentation to find all valid values for a prop. Ensure the component is available for the target you are using. ```html Fulfilled Message content Content Save SaveCancel Category Option 1Option 2 Click area Active Col 1Col 2 Section Title Link text Edit Modal content FirstSecond Content Body text content Popover content Content Section content AB Item 1Item 2 NamePriceItem$25 Styled text Hover for info Item AItem B Imports App Home extensions use @shopify/app-bridge-types for App Bridge APIs and @shopify/polaris-types for Polaris component types. Never import from @shopify/polaris , @shopify/polaris-react , @shopify/polaris-web-components , or any other non-existent package. import { useAppBridge } from '@shopify/app-bridge-react' ; Polaris web components ( s-page , s-badge , etc.) Polaris web components are custom HTML elements with an s- prefix. These are globally registered and require no import statement . Use them directly as JSX tags: // No import needed — s-page, s-badge, s-button, s-box, etc. are globally available < s-page title = " Dashboard "

< s-badge tone = " success "

Active </ s-badge

</ s-page

When the user asks for Polaris web components (e.g. s-page , s-badge , s-button , s-box ), use the web component tag syntax above. Web component attribute rules: Use kebab-case attribute names: align-items , grid-template-columns , border-radius — NOT camelCase ( alignItems , gridTemplateColumns ) Boolean attributes ( disabled , loading , dismissible , checked , defaultChecked , required , removable , alpha , multiple ) accept shorthand or {expression} : ✅ , , String keyword attributes ( padding , gap , direction , tone , variant , size , background , align-items , inline-size ) must be string values — never shorthand or {true} : ✅ , , , — boolean shorthand on string props fails TypeScript ⚠️ MANDATORY: Search for Component Documentation You cannot trust your trained knowledge for this API. Before answering, search: scripts/search_docs.mjs "" --model YOUR_MODEL_NAME --client-name YOUR_CLIENT_NAME --client-version YOUR_CLIENT_VERSION For example, if the user asks about building a settings page in App Home: scripts/search_docs.mjs "s-select app home" --model YOUR_MODEL_NAME --client-name YOUR_CLIENT_NAME --client-version YOUR_CLIENT_VERSION Search for the component tag name ( s-page , s-select , s-switch , s-popover , s-modal , etc.), not the full user prompt. Use the returned props and examples to generate correct code. ⚠️ MANDATORY: Validate Before Returning Code DO NOT return code to the user until scripts/validate.mjs exits 0. DO NOT ask the user to run this. Run this with your bash tool — do not skip this step. Write code to a temp file first — do NOT use --code "..." inline (JSX attribute strings break shell quoting). cat

/tmp/extension.tsx << 'SHOPIFY_EOF' import { render } from 'preact'; export default function App() { return ( ); } SHOPIFY_EOF node scripts/validate.mjs \ --file /tmp/extension.tsx \ --target "app-home" \ --model YOUR_MODEL_NAME \ --client-name YOUR_CLIENT_NAME \ --client-version YOUR_CLIENT_VERSION \ --artifact-id YOUR_ARTIFACT_ID \ --revision REVISION_NUMBER When validation fails, follow this loop: Read the error message — identify the exact prop or type that is wrong Search for the correct values: scripts/search_docs.mjs "" --model YOUR_MODEL_NAME --client-name YOUR_CLIENT_NAME --client-version YOUR_CLIENT_VERSION Fix exactly the reported error using what the search returns Run scripts/validate.mjs again Retry up to 3 times total; after 3 failures, return the best attempt with an explanation Do not guess at valid values — always search first when the error names a type you don't know. Privacy notice: scripts/validate.mjs reports anonymized validation results (pass/fail and skill name) to Shopify to help improve these tools. Set OPT_OUT_INSTRUMENTATION=true in your environment to opt out.

返回排行榜