$npx -y skills add 40RTY-ai/shopify-admin-skills --skill shopify-admin-agentic-policy-readabilityEnsure shipping, returns, refund, privacy, and terms policies exist as clean machine-readable text so AI agents can answer shopper questions and close the sale without escalating.
| 1 | ## Purpose |
| 2 | Before an AI agent completes a purchase for a shopper it checks the store's policies — "Do they ship to me? What's the return window?" If shipping/returns policies are missing, empty, or buried in an image/PDF, the agent can't answer, loses confidence, and abandons or sends the shopper elsewhere. This skill audits the store's policies and ensures the key ones exist as clean, plain-text/HTML content an agent can read and quote. Fixes `shipping-policy-readable` and `returns-policy-readable`. |
| 3 | |
| 4 | ## Prerequisites |
| 5 | - Authenticated Shopify CLI session (`shopify auth login --store <domain>`) |
| 6 | - Required API scopes: `read_legal_policies` (or `read_online_store_pages`), `write_legal_policies` |
| 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 | true | Preview proposed policy bodies without writing (defaults ON — edits live store policies) | |
| 16 | |
| 17 | Skill-specific parameters: |
| 18 | |
| 19 | | Parameter | Type | Required | Default | Description | |
| 20 | |-----------|------|----------|---------|-------------| |
| 21 | | policies | string | no | REFUND_POLICY,SHIPPING_POLICY | Comma list of policy types to ensure: `REFUND_POLICY,SHIPPING_POLICY,PRIVACY_POLICY,TERMS_OF_SERVICE` | |
| 22 | | mode | string | no | audit | `audit` (report gaps only) or `apply` (write supplied/drafted bodies) | |
| 23 | | bodies_dir | string | no | — | Directory of `<POLICY_TYPE>.html` files to use as the source of truth when `mode: apply` | |
| 24 | |
| 25 | ## Safety |
| 26 | |
| 27 | > ⚠️ Step 2 (`shopPolicyUpdate`) replaces a LIVE legal policy's body — this is legally binding content. NEVER auto-generate legal text. In `mode: apply` the skill only writes bodies you supply via `bodies_dir`; it will not invent policy language. Default is `mode: audit` + `dry_run: true`. Have legal/ops review every body before `mode: apply`. |
| 28 | |
| 29 | ## Workflow Steps |
| 30 | |
| 31 | 1. **OPERATION:** `shop` — query |
| 32 | **Inputs:** none; read `shopPolicies { type body url }` |
| 33 | **Expected output:** Which target policies are present, empty, or image-only (heuristic: very short body or body that's just an `<img>`/link). |
| 34 | |
| 35 | 2. **COMPUTE (no API):** classify each policy as OK / missing / thin / image-only. In `audit` mode, stop here and report. In `apply` mode, load the matching `<TYPE>.html` from `bodies_dir` for each gap and emit a before/after preview. |
| 36 | |
| 37 | 3. **OPERATION:** `shopPolicyUpdate` — mutation (only in `mode: apply`, not `dry_run`) |
| 38 | **Inputs:** `shopPolicy: { id: <policy id>, body: <supplied HTML> }` per gap. |
| 39 | **Expected output:** Updated policy; collect `userErrors`. |
| 40 | |
| 41 | ## GraphQL Operations |
| 42 | |
| 43 | ```graphql |
| 44 | # shop:query — validated against api_version 2025-01 |
| 45 | query PolicyAudit { |
| 46 | shop { |
| 47 | shopPolicies { |
| 48 | id |
| 49 | type |
| 50 | body |
| 51 | url |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | ``` |
| 56 | |
| 57 | ```graphql |
| 58 | # shopPolicyUpdate:mutation — validated against api_version 2025-01 |
| 59 | mutation PolicyUpdate($shopPolicy: ShopPolicyInput!) { |
| 60 | shopPolicyUpdate(shopPolicy: $shopPolicy) { |
| 61 | shopPolicy { id type url } |
| 62 | userErrors { field message } |
| 63 | } |
| 64 | } |
| 65 | ``` |
| 66 | |
| 67 | ## Session Tracking |
| 68 | |
| 69 | **Claude MUST emit the following output at each stage. This is mandatory.** |
| 70 | |
| 71 | **On start**, emit: |
| 72 | ``` |
| 73 | ╔══════════════════════════════════════════════╗ |
| 74 | ║ SKILL: <skill name> ║ |
| 75 | ║ Store: <store domain> ║ |
| 76 | ║ Started: <YYYY-MM-DD HH:MM UTC> ║ |
| 77 | ╚══════════════════════════════════════════════╝ |
| 78 | ``` |
| 79 | |
| 80 | **After each step**, emit: |
| 81 | ``` |
| 82 | [N/TOTAL] <QUERY|MUTATION> <OperationName> |
| 83 | → Params: <brief summary of key inputs> |
| 84 | → Result: <count or outcome> |
| 85 | ``` |
| 86 | |
| 87 | If `dry_run: true`, prefix every mutation step with `[DRY RUN]` and do not execute it. |
| 88 | |
| 89 | **On completion**, emit: |
| 90 | |
| 91 | For `format: human` (default): |
| 92 | ``` |
| 93 | ══════════════════════════════════════════════ |
| 94 | OUTCOME SUMMARY |
| 95 | <Metric label>: <value> |
| 96 | Errors: 0 |
| 97 | Output: <filename or "none"> |
| 98 | ══════════════════════════════════════════════ |
| 99 | ``` |
| 100 | |
| 101 | For `format: json`, emit: |
| 102 | ```json |
| 103 | { |
| 104 | "skill": "<skill-slug>", |
| 105 | "store": "<domain>", |
| 106 | "started_at": "<ISO8601>", |
| 107 | "completed_at": "<ISO8601>", |
| 108 | "dry_run": false, |
| 109 | "steps": [ |
| 110 | { |
| 111 | "step": 1, |
| 112 | "operation": "<OperationName>", |
| 113 | "type": "query", |
| 114 | "params_summary": "<string>", |
| 115 | "re |