$npx -y skills add 40RTY-ai/shopify-admin-skills --skill shopify-admin-gift-card-issuanceIssue Shopify gift cards (store credit) to customers as a goodwill gesture, post-return incentive, or loyalty reward.
| 1 | ## Purpose |
| 2 | Issues Shopify native gift cards to customers programmatically — as goodwill for a delayed shipment, as store credit instead of a cash refund, or as a loyalty reward. Uses Shopify's built-in gift card system; no 3rd-party app required. Gift cards issued here are redeemable at checkout exactly like manual gift cards. Note: `giftCardCreate` is available on all Shopify plans but may require the store to have gift cards enabled in settings. |
| 3 | |
| 4 | ## Prerequisites |
| 5 | - `shopify auth login --store <domain>` |
| 6 | - API scopes: `read_customers`, `write_gift_cards` |
| 7 | - Gift cards must be enabled in Shopify admin → Settings → Gift cards |
| 8 | |
| 9 | ## 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` or `json` | |
| 15 | | dry_run | bool | no | false | Preview operations without executing mutations | |
| 16 | | customer_email | string | yes* | — | Customer email to look up and associate with the gift card | |
| 17 | | customer_id | string | yes* | — | Customer GID (alternative to email) | |
| 18 | | amount | float | yes | — | Gift card value in the store's default currency | |
| 19 | | reason | string | no | — | Internal note logged on the gift card (e.g., `"Goodwill: delayed shipment #1042"`) | |
| 20 | | expires_on | string | no | — | Expiry date in ISO 8601 (e.g., `2026-12-31`); if omitted, gift card does not expire | |
| 21 | | tag_customer | string | no | — | Optional tag to add to the customer record (e.g., `goodwill-issued`) | |
| 22 | |
| 23 | *One of `customer_email` or `customer_id` is required. |
| 24 | |
| 25 | ## Safety |
| 26 | |
| 27 | > ⚠️ Step 2 executes `giftCardCreate` which issues real monetary value against your store. Gift cards cannot be deleted once created — they can only be disabled. Run with `dry_run: true` to confirm the customer, amount, and expiry before committing. Verify the amount carefully — issued value is immediately redeemable at checkout. |
| 28 | |
| 29 | ## Workflow Steps |
| 30 | |
| 31 | 1. **OPERATION:** `customer` — query |
| 32 | **Inputs:** Look up by `customer_email` (using customers search) or directly by `customer_id` |
| 33 | **Expected output:** Customer `id`, `firstName`, `lastName`, `email`; confirm customer exists before issuing |
| 34 | |
| 35 | 2. **OPERATION:** `giftCardCreate` — mutation |
| 36 | **Inputs:** `input.initialValue`, `input.customerId`, `input.expiresOn` (optional), `input.note` (reason) |
| 37 | **Expected output:** `giftCard.id`, `giftCard.code`, `giftCard.balance`, `giftCard.expiresOn`, `userErrors` |
| 38 | |
| 39 | ## GraphQL Operations |
| 40 | |
| 41 | ```graphql |
| 42 | # customer:query — validated against api_version 2025-01 |
| 43 | query CustomerByEmail($query: String!) { |
| 44 | customers(first: 1, query: $query) { |
| 45 | edges { |
| 46 | node { |
| 47 | id |
| 48 | firstName |
| 49 | lastName |
| 50 | defaultEmailAddress { |
| 51 | emailAddress |
| 52 | } |
| 53 | tags |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | ``` |
| 59 | |
| 60 | ```graphql |
| 61 | # giftCardCreate:mutation — validated against api_version 2025-01 |
| 62 | mutation GiftCardCreate($input: GiftCardCreateInput!) { |
| 63 | giftCardCreate(input: $input) { |
| 64 | giftCard { |
| 65 | id |
| 66 | code |
| 67 | balance { |
| 68 | amount |
| 69 | currencyCode |
| 70 | } |
| 71 | expiresOn |
| 72 | note |
| 73 | customer { |
| 74 | id |
| 75 | } |
| 76 | } |
| 77 | userErrors { |
| 78 | field |
| 79 | message |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | ``` |
| 84 | |
| 85 | ## Session Tracking |
| 86 | |
| 87 | **Claude MUST emit the following output at each stage. This is mandatory.** |
| 88 | |
| 89 | **On start**, emit: |
| 90 | ``` |
| 91 | ╔══════════════════════════════════════════════╗ |
| 92 | ║ SKILL: gift-card-issuance ║ |
| 93 | ║ Store: <store domain> ║ |
| 94 | ║ Started: <YYYY-MM-DD HH:MM UTC> ║ |
| 95 | ╚══════════════════════════════════════════════╝ |
| 96 | ``` |
| 97 | |
| 98 | **After each step**, emit: |
| 99 | ``` |
| 100 | [N/TOTAL] <QUERY|MUTATION> <OperationName> |
| 101 | → Params: <brief summary of key inputs> |
| 102 | → Result: <count or outcome> |
| 103 | ``` |
| 104 | |
| 105 | If `dry_run: true`, prefix every mutation step with `[DRY RUN]` and do not execute it. |
| 106 | |
| 107 | **On completion**, emit: |
| 108 | |
| 109 | For `format: human` (default): |
| 110 | ``` |
| 111 | ══════════════════════════════════════════════ |
| 112 | OUTCOME SUMMARY |
| 113 | Customer: <name> (<email>) |
| 114 | Gift card code: <code> |
| 115 | Amount: <amount> <currency> |
| 116 | Expires: <date or "Does not expire"> |
| 117 | Errors: 0 |
| 118 | Output: none |
| 119 | ══════════════════════════════════════════════ |
| 120 | ``` |
| 121 | |
| 122 | For `format: json`, emit: |
| 123 | ```json |
| 124 | { |
| 125 | "skill": "gift-card-issuance", |
| 126 | "store": "<domain>", |
| 127 | "started_at": "<ISO8601>", |
| 128 | "completed_at": "<ISO8601>", |
| 129 | "dry_run": false, |
| 130 | "steps": [ |
| 131 | { "step": 1, "operation": "CustomerByEmail", "type": "query", "params_summary": "email <email>", "result_summary": "customer <id>", "skipped": false }, |