$npx -y skills add 40RTY-ai/shopify-admin-skills --skill shopify-admin-agentic-image-alt-textGenerate and set descriptive alt text on product images so AI agents (which can't 'see' pixels) can understand and recommend what each product looks like.
| 1 | ## Purpose |
| 2 | An AI shopping agent reads image **alt text** to understand a product's appearance — color, material, style, use. Blank or filename-style alt text ("IMG_2931.jpg") tells the agent nothing, so it can't match the product to a visual query ("red linen midi dress") or describe it to a shopper. This skill finds product images with missing or low-value alt text and writes concise, descriptive alt text derived from the product's title, options, type, and tags. Fixes the agentiq.report finding `listing-image-alt-text`. |
| 3 | |
| 4 | ## Prerequisites |
| 5 | - Authenticated Shopify CLI session (`shopify auth login --store <domain>`) |
| 6 | - Required API scopes: `read_products`, `write_products`, `write_files` |
| 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 | | overwrite | bool | no | false | If true, also rewrite filename-style / placeholder alt text; if false, only fill blanks | |
| 24 | | max_chars | int | no | 125 | Alt-text length cap (accessibility + agent-readability) | |
| 25 | |
| 26 | ## Safety |
| 27 | |
| 28 | > ⚠️ Step 3 (`fileUpdate`) writes alt text to live media. With `overwrite: true` it replaces existing alt text, which is not bulk-reversible. Run `dry_run: true` first and review the proposed alt text per image. Default (`overwrite: false`) only fills blanks and is low-risk. |
| 29 | |
| 30 | ## Workflow Steps |
| 31 | |
| 32 | 1. **OPERATION:** `products` — query |
| 33 | **Inputs:** `first: 250`, optional collection/tag filter; fields `title`, `productType`, `tags`, `options`, `media{ MediaImage{ id image{ altText } } }`; paginate until done. |
| 34 | **Expected output:** Product media with current alt text + the product context needed to generate good alt text. |
| 35 | |
| 36 | 2. **COMPUTE (no API):** for each image with blank (or, if `overwrite`, placeholder) alt text, compose alt text from `title` + relevant option values (color/material/style) + product type, trimmed to `max_chars`. Emit a preview table (image id → proposed alt). |
| 37 | |
| 38 | 3. **OPERATION:** `fileUpdate` — mutation |
| 39 | **Inputs:** `files: [{ id: <MediaImage id>, alt: <generated alt> }]` in batches (≤ 25). |
| 40 | **Expected output:** Updated files; collect `userErrors`. |
| 41 | |
| 42 | ## GraphQL Operations |
| 43 | |
| 44 | ```graphql |
| 45 | # products:query — validated against api_version 2025-01 |
| 46 | query AltTextProducts($first: Int!, $after: String, $query: String) { |
| 47 | products(first: $first, after: $after, query: $query) { |
| 48 | edges { |
| 49 | node { |
| 50 | id |
| 51 | title |
| 52 | productType |
| 53 | tags |
| 54 | options { name values } |
| 55 | media(first: 20) { |
| 56 | edges { |
| 57 | node { ... on MediaImage { id image { altText url } } } |
| 58 | } |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | pageInfo { hasNextPage endCursor } |
| 63 | } |
| 64 | } |
| 65 | ``` |
| 66 | |
| 67 | ```graphql |
| 68 | # fileUpdate:mutation — validated against api_version 2025-01 |
| 69 | mutation AltTextUpdate($files: [FileUpdateInput!]!) { |
| 70 | fileUpdate(files: $files) { |
| 71 | files { ... on MediaImage { id alt } } |
| 72 | userErrors { field message code } |
| 73 | } |
| 74 | } |
| 75 | ``` |
| 76 | |
| 77 | ## Session Tracking |
| 78 | |
| 79 | **Claude MUST emit the following output at each stage. This is mandatory.** |
| 80 | |
| 81 | **On start**, emit: |
| 82 | ``` |
| 83 | ╔══════════════════════════════════════════════╗ |
| 84 | ║ SKILL: <skill name> ║ |
| 85 | ║ Store: <store domain> ║ |
| 86 | ║ Started: <YYYY-MM-DD HH:MM UTC> ║ |
| 87 | ╚══════════════════════════════════════════════╝ |
| 88 | ``` |
| 89 | |
| 90 | **After each step**, emit: |
| 91 | ``` |
| 92 | [N/TOTAL] <QUERY|MUTATION> <OperationName> |
| 93 | → Params: <brief summary of key inputs> |
| 94 | → Result: <count or outcome> |
| 95 | ``` |
| 96 | |
| 97 | If `dry_run: true`, prefix every mutation step with `[DRY RUN]` and do not execute it. |
| 98 | |
| 99 | **On completion**, emit: |
| 100 | |
| 101 | For `format: human` (default): |
| 102 | ``` |
| 103 | ══════════════════════════════════════════════ |
| 104 | OUTCOME SUMMARY |
| 105 | <Metric label>: <value> |
| 106 | Errors: 0 |
| 107 | Output: <filename or "none"> |
| 108 | ══════════════════════════════════════════════ |
| 109 | ``` |
| 110 | |
| 111 | For `format: json`, emit: |
| 112 | ```json |
| 113 | { |
| 114 | "skill": "<skill-slug>", |
| 115 | "store": "<domain>", |
| 116 | "started_at": "<ISO8601>", |
| 117 | "completed_at": "<ISO8601> |