$npx -y skills add 40RTY-ai/shopify-admin-skills --skill shopify-admin-agentic-product-taxonomyAssign every product a Shopify Standard Product Taxonomy category so AI agents can map a shopper's intent to the right category and surface the store's products.
| 1 | ## Purpose |
| 2 | AI shopping agents resolve a query ("running shoes", "office chair", "sustainable sneakers") to a taxonomy node, then retrieve products in that node. Products with no Standard Product Taxonomy category are invisible to that mapping — they only surface on exact keyword luck. This skill finds uncategorized (or mis-categorized) products and assigns the correct Shopify standard taxonomy category, inferred from title/type/tags and confirmed against the live taxonomy tree. Fixes `category-taxonomy-api` and lifts `catalog-intent-alignment`. |
| 3 | |
| 4 | ## Prerequisites |
| 5 | - Authenticated Shopify CLI session (`shopify auth login --store <domain>`) |
| 6 | - Required API scopes: `read_products`, `write_products` |
| 7 | |
| 8 | ## Parameters |
| 9 | All skills accept these universal parameters: |
| 10 | |
| 11 | | Parameter | Type | Required | Default | Description | |
| 12 | |-----------|--------|----------|---------|-------------| |
| 13 | | store | string | yes | — | Store domain (e.g., mystore.myshopify.com) | |
| 14 | | format | string | no | human | Output format: `human` (default) or `json` | |
| 15 | | dry_run | bool | no | false | Preview mutations without executing | |
| 16 | |
| 17 | Skill-specific parameters: |
| 18 | |
| 19 | | Parameter | Type | Required | Default | Description | |
| 20 | |-----------|------|----------|---------|-------------| |
| 21 | | collection_id | string | no | — | Limit to a collection GID | |
| 22 | | tag | string | no | — | Limit to a product tag | |
| 23 | | only_missing | bool | no | true | If true, only assign products with no category; if false, also review mismatches | |
| 24 | | confidence_floor | float | no | 0.7 | Skip products whose best taxonomy match scores below this | |
| 25 | |
| 26 | ## Safety |
| 27 | |
| 28 | > ⚠️ Step 4 (`productUpdate`) sets the `category` on live products, which affects storefront facets, marketplaces, and tax. A wrong category mis-files a product everywhere. Run `dry_run: true`, review the proposed `product → category` mapping, and only auto-assign matches above `confidence_floor`; queue the rest for human review. |
| 29 | |
| 30 | ## Workflow Steps |
| 31 | |
| 32 | 1. **OPERATION:** `products` — query |
| 33 | **Inputs:** `first: 250`, optional filter; fields `title`, `productType`, `tags`, `category{ id fullName }`; paginate. |
| 34 | **Expected output:** Products with their current category (or null). |
| 35 | |
| 36 | 2. **OPERATION:** `taxonomy` — query |
| 37 | **Inputs:** search the standard taxonomy tree by candidate terms derived from each product's type/title. |
| 38 | **Expected output:** Candidate taxonomy category nodes (id + fullName) to match against. |
| 39 | |
| 40 | 3. **COMPUTE (no API):** score each product against candidate nodes; pick the best ≥ `confidence_floor`. Emit the proposed mapping. |
| 41 | |
| 42 | 4. **OPERATION:** `productUpdate` — mutation |
| 43 | **Inputs:** `{ id, category: <taxonomyCategoryId> }` per confident match. |
| 44 | **Expected output:** Updated product category; collect `userErrors`. |
| 45 | |
| 46 | ## GraphQL Operations |
| 47 | |
| 48 | ```graphql |
| 49 | # products:query — validated against api_version 2025-01 |
| 50 | query TaxonomyProducts($first: Int!, $after: String, $query: String) { |
| 51 | products(first: $first, after: $after, query: $query) { |
| 52 | edges { |
| 53 | node { |
| 54 | id |
| 55 | title |
| 56 | productType |
| 57 | tags |
| 58 | category { id fullName } |
| 59 | } |
| 60 | } |
| 61 | pageInfo { hasNextPage endCursor } |
| 62 | } |
| 63 | } |
| 64 | ``` |
| 65 | |
| 66 | ```graphql |
| 67 | # taxonomy:query — validated against api_version 2025-01 |
| 68 | query TaxonomySearch($search: String) { |
| 69 | taxonomy { |
| 70 | categories(first: 20, search: $search) { |
| 71 | edges { node { id fullName isLeaf level } } |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | ``` |
| 76 | |
| 77 | ```graphql |
| 78 | # productUpdate:mutation — validated against api_version 2025-01 |
| 79 | mutation TaxonomyAssign($input: ProductInput!) { |
| 80 | productUpdate(input: $input) { |
| 81 | product { id category { id fullName } } |
| 82 | userErrors { field message } |
| 83 | } |
| 84 | } |
| 85 | ``` |
| 86 | |
| 87 | ## Session Tracking |
| 88 | |
| 89 | **Claude MUST emit the following output at each stage. This is mandatory.** |
| 90 | |
| 91 | **On start**, emit: |
| 92 | ``` |
| 93 | ╔══════════════════════════════════════════════╗ |
| 94 | ║ SKILL: <skill name> ║ |
| 95 | ║ Store: <store domain> ║ |
| 96 | ║ Started: <YYYY-MM-DD HH:MM UTC> ║ |
| 97 | ╚══════════════════════════════════════════════╝ |
| 98 | ``` |
| 99 | |
| 100 | **After each step**, emit: |
| 101 | ``` |
| 102 | [N/TOTAL] <QUERY|MUTATION> <OperationName> |
| 103 | → Params: <brief summary of key inputs> |
| 104 | → Result: <count or outcome> |
| 105 | ``` |
| 106 | |
| 107 | If `dry_run: true`, prefix every mutation step with `[DRY RUN]` and do not execute it. |
| 108 | |
| 109 | **On completion**, emit: |
| 110 | |
| 111 | For `format: human` (default): |
| 112 | ``` |
| 113 | ══════════════════════════════════════════════ |
| 114 | OUTCOME SUMMARY |
| 115 | <Metric label>: <value> |
| 116 | Errors: 0 |