@clawpify/skills 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +73 -0
  3. package/clawpify/SKILL.md +134 -0
  4. package/clawpify/references/blogs.md +385 -0
  5. package/clawpify/references/bulk-operations.md +386 -0
  6. package/clawpify/references/collections.md +71 -0
  7. package/clawpify/references/customers.md +141 -0
  8. package/clawpify/references/discounts.md +431 -0
  9. package/clawpify/references/draft-orders.md +495 -0
  10. package/clawpify/references/files.md +355 -0
  11. package/clawpify/references/fulfillments.md +437 -0
  12. package/clawpify/references/gift-cards.md +453 -0
  13. package/clawpify/references/inventory.md +107 -0
  14. package/clawpify/references/locations.md +349 -0
  15. package/clawpify/references/marketing.md +352 -0
  16. package/clawpify/references/markets.md +346 -0
  17. package/clawpify/references/menus.md +313 -0
  18. package/clawpify/references/metafields.md +461 -0
  19. package/clawpify/references/orders.md +164 -0
  20. package/clawpify/references/pages.md +308 -0
  21. package/clawpify/references/products.md +277 -0
  22. package/clawpify/references/refunds.md +401 -0
  23. package/clawpify/references/segments.md +319 -0
  24. package/clawpify/references/shipping.md +406 -0
  25. package/clawpify/references/shop.md +307 -0
  26. package/clawpify/references/subscriptions.md +429 -0
  27. package/clawpify/references/translations.md +270 -0
  28. package/clawpify/references/webhooks.md +400 -0
  29. package/dist/agent.d.ts +18 -0
  30. package/dist/agent.d.ts.map +1 -0
  31. package/dist/agent.js +100 -0
  32. package/dist/auth.d.ts +34 -0
  33. package/dist/auth.d.ts.map +1 -0
  34. package/dist/auth.js +58 -0
  35. package/dist/index.d.ts +41 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +22 -0
  38. package/dist/mcp-server.d.ts +3 -0
  39. package/dist/mcp-server.d.ts.map +1 -0
  40. package/dist/mcp-server.js +236 -0
  41. package/dist/shopify.d.ts +29 -0
  42. package/dist/shopify.d.ts.map +1 -0
  43. package/dist/shopify.js +41 -0
  44. package/dist/skills.d.ts +8 -0
  45. package/dist/skills.d.ts.map +1 -0
  46. package/dist/skills.js +36 -0
  47. package/package.json +100 -0
  48. package/src/agent.ts +133 -0
  49. package/src/auth.ts +109 -0
  50. package/src/index.ts +55 -0
  51. package/src/mcp-server.ts +190 -0
  52. package/src/shopify.ts +63 -0
  53. package/src/skills.ts +42 -0
@@ -0,0 +1,401 @@
1
+ # Shopify Refunds
2
+
3
+ Process refunds for orders via the GraphQL Admin API.
4
+
5
+ ## Overview
6
+
7
+ Refunds return money to customers for returned items, cancelled orders, or service issues. Refunds can include restocking items and refunding shipping.
8
+
9
+ ## Get Refund
10
+
11
+ ```graphql
12
+ query GetRefund($id: ID!) {
13
+ refund(id: $id) {
14
+ id
15
+ createdAt
16
+ note
17
+ totalRefundedSet {
18
+ shopMoney {
19
+ amount
20
+ currencyCode
21
+ }
22
+ }
23
+ refundLineItems(first: 20) {
24
+ nodes {
25
+ lineItem {
26
+ title
27
+ sku
28
+ }
29
+ quantity
30
+ restockType
31
+ subtotalSet {
32
+ shopMoney {
33
+ amount
34
+ }
35
+ }
36
+ }
37
+ }
38
+ transactions(first: 5) {
39
+ nodes {
40
+ id
41
+ kind
42
+ status
43
+ amountSet {
44
+ shopMoney {
45
+ amount
46
+ }
47
+ }
48
+ gateway
49
+ }
50
+ }
51
+ order {
52
+ id
53
+ name
54
+ }
55
+ }
56
+ }
57
+ ```
58
+ Variables: `{ "id": "gid://shopify/Refund/123" }`
59
+
60
+ ## List Refunds on Order
61
+
62
+ ```graphql
63
+ query GetOrderRefunds($orderId: ID!) {
64
+ order(id: $orderId) {
65
+ id
66
+ name
67
+ refunds(first: 10) {
68
+ id
69
+ createdAt
70
+ totalRefundedSet {
71
+ shopMoney {
72
+ amount
73
+ currencyCode
74
+ }
75
+ }
76
+ refundLineItems(first: 10) {
77
+ nodes {
78
+ lineItem {
79
+ title
80
+ }
81
+ quantity
82
+ }
83
+ }
84
+ }
85
+ }
86
+ }
87
+ ```
88
+
89
+ ## Create Refund
90
+
91
+ > REQUIRES PERMISSION: Creating a refund is a PERMANENT financial transaction that returns money to the customer and CANNOT BE UNDONE. Always ask the user for explicit confirmation, show the refund amount and items, and wait for approval before executing this operation.
92
+
93
+ ```graphql
94
+ mutation CreateRefund($input: RefundInput!) {
95
+ refundCreate(input: $input) {
96
+ refund {
97
+ id
98
+ totalRefundedSet {
99
+ shopMoney {
100
+ amount
101
+ currencyCode
102
+ }
103
+ }
104
+ }
105
+ userErrors {
106
+ field
107
+ message
108
+ }
109
+ }
110
+ }
111
+ ```
112
+ Variables:
113
+ ```json
114
+ {
115
+ "input": {
116
+ "orderId": "gid://shopify/Order/123",
117
+ "refundLineItems": [
118
+ {
119
+ "lineItemId": "gid://shopify/LineItem/456",
120
+ "quantity": 1,
121
+ "restockType": "RETURN"
122
+ }
123
+ ],
124
+ "notify": true,
125
+ "note": "Customer returned item - wrong size"
126
+ }
127
+ }
128
+ ```
129
+
130
+ ## Create Full Refund
131
+
132
+ ```graphql
133
+ mutation CreateFullRefund($input: RefundInput!) {
134
+ refundCreate(input: $input) {
135
+ refund {
136
+ id
137
+ totalRefundedSet {
138
+ shopMoney {
139
+ amount
140
+ }
141
+ }
142
+ }
143
+ userErrors {
144
+ field
145
+ message
146
+ }
147
+ }
148
+ }
149
+ ```
150
+ Variables:
151
+ ```json
152
+ {
153
+ "input": {
154
+ "orderId": "gid://shopify/Order/123",
155
+ "refundLineItems": [
156
+ {
157
+ "lineItemId": "gid://shopify/LineItem/456",
158
+ "quantity": 2,
159
+ "restockType": "RETURN"
160
+ },
161
+ {
162
+ "lineItemId": "gid://shopify/LineItem/789",
163
+ "quantity": 1,
164
+ "restockType": "RETURN"
165
+ }
166
+ ],
167
+ "shipping": {
168
+ "fullRefund": true
169
+ },
170
+ "notify": true
171
+ }
172
+ }
173
+ ```
174
+
175
+ ## Refund Shipping Only
176
+
177
+ ```graphql
178
+ mutation RefundShipping($input: RefundInput!) {
179
+ refundCreate(input: $input) {
180
+ refund {
181
+ id
182
+ }
183
+ userErrors {
184
+ field
185
+ message
186
+ }
187
+ }
188
+ }
189
+ ```
190
+ Variables:
191
+ ```json
192
+ {
193
+ "input": {
194
+ "orderId": "gid://shopify/Order/123",
195
+ "shipping": {
196
+ "amount": {
197
+ "amount": "9.99",
198
+ "currencyCode": "USD"
199
+ }
200
+ },
201
+ "note": "Shipping refund - delayed delivery"
202
+ }
203
+ }
204
+ ```
205
+
206
+ ## Refund Without Restock
207
+
208
+ For items not being returned:
209
+
210
+ ```graphql
211
+ mutation RefundNoRestock($input: RefundInput!) {
212
+ refundCreate(input: $input) {
213
+ refund {
214
+ id
215
+ }
216
+ userErrors {
217
+ field
218
+ message
219
+ }
220
+ }
221
+ }
222
+ ```
223
+ Variables:
224
+ ```json
225
+ {
226
+ "input": {
227
+ "orderId": "gid://shopify/Order/123",
228
+ "refundLineItems": [
229
+ {
230
+ "lineItemId": "gid://shopify/LineItem/456",
231
+ "quantity": 1,
232
+ "restockType": "NO_RESTOCK"
233
+ }
234
+ ],
235
+ "note": "Item damaged - no return required"
236
+ }
237
+ }
238
+ ```
239
+
240
+ ## Refund Duties
241
+
242
+ ```graphql
243
+ mutation RefundDuties($input: RefundInput!) {
244
+ refundCreate(input: $input) {
245
+ refund {
246
+ id
247
+ totalRefundedSet {
248
+ shopMoney {
249
+ amount
250
+ }
251
+ }
252
+ }
253
+ userErrors {
254
+ field
255
+ message
256
+ }
257
+ }
258
+ }
259
+ ```
260
+ Variables:
261
+ ```json
262
+ {
263
+ "input": {
264
+ "orderId": "gid://shopify/Order/123",
265
+ "refundDuties": [
266
+ {
267
+ "dutyId": "gid://shopify/Duty/456",
268
+ "refundType": "FULL"
269
+ }
270
+ ]
271
+ }
272
+ }
273
+ ```
274
+
275
+ ## Calculate Suggested Refund
276
+
277
+ Before creating a refund, calculate the suggested amounts:
278
+
279
+ ```graphql
280
+ mutation CalculateSuggestedRefund($input: SuggestedRefundInput!) {
281
+ suggestedRefund(input: $input) {
282
+ suggestedTransactions {
283
+ kind
284
+ amount
285
+ gateway
286
+ }
287
+ subtotalSet {
288
+ shopMoney {
289
+ amount
290
+ }
291
+ }
292
+ totalTaxSet {
293
+ shopMoney {
294
+ amount
295
+ }
296
+ }
297
+ totalCartDiscountAmountSet {
298
+ shopMoney {
299
+ amount
300
+ }
301
+ }
302
+ refundLineItems {
303
+ lineItem {
304
+ title
305
+ }
306
+ quantity
307
+ subtotalSet {
308
+ shopMoney {
309
+ amount
310
+ }
311
+ }
312
+ }
313
+ }
314
+ }
315
+ ```
316
+ Variables:
317
+ ```json
318
+ {
319
+ "input": {
320
+ "orderId": "gid://shopify/Order/123",
321
+ "refundLineItems": [
322
+ {
323
+ "lineItemId": "gid://shopify/LineItem/456",
324
+ "quantity": 1
325
+ }
326
+ ],
327
+ "refundShipping": true
328
+ }
329
+ }
330
+ ```
331
+
332
+ ## Restock Types
333
+
334
+ | Type | Description |
335
+ |------|-------------|
336
+ | `RETURN` | Item returned, add back to inventory |
337
+ | `CANCEL` | Item cancelled, add back to inventory |
338
+ | `NO_RESTOCK` | Don't add back to inventory |
339
+ | `LEGACY_RESTOCK` | Legacy restock behavior |
340
+
341
+ ## Refund Transaction Kinds
342
+
343
+ | Kind | Description |
344
+ |------|-------------|
345
+ | `REFUND` | Money returned to customer |
346
+ | `VOID` | Authorization voided |
347
+ | `CHANGE` | Refund as store credit |
348
+
349
+ ## Transaction Status
350
+
351
+ | Status | Description |
352
+ |--------|-------------|
353
+ | `SUCCESS` | Refund processed |
354
+ | `PENDING` | Processing |
355
+ | `FAILURE` | Refund failed |
356
+ | `ERROR` | Error occurred |
357
+
358
+ ## Duty Refund Types
359
+
360
+ | Type | Description |
361
+ |------|-------------|
362
+ | `FULL` | Full duty refund |
363
+ | `PROPORTIONAL` | Proportional to items |
364
+
365
+ ## API Scopes Required
366
+
367
+ - `read_orders` - Read order and refund information
368
+ - `write_orders` - Create refunds
369
+
370
+ ## Best Practices
371
+
372
+ 1. **Calculate first** - Use `suggestedRefund` before creating
373
+ 2. **Notify customers** - Set `notify: true` for email confirmation
374
+ 3. **Add notes** - Document refund reasons
375
+ 4. **Choose restock type** - Match business logic (return vs damage)
376
+ 5. **Handle partial refunds** - Refund specific quantities
377
+
378
+ ## Notes
379
+
380
+ - Refunds are final and cannot be undone
381
+ - Multiple refunds can be issued for one order
382
+ - Restocking automatically adjusts inventory
383
+ - Shipping can be refunded separately from items
384
+ - Duties are refunded separately for international orders
385
+
386
+ ## Dangerous Operations in This Skill
387
+
388
+ The following operations require explicit user permission before execution:
389
+
390
+ | Operation | Impact | Reversible |
391
+ |-----------|--------|------------|
392
+ | `refundCreate` | Permanently refunds money to customer (financial transaction) | No - IRREVERSIBLE |
393
+ | `suggestedRefund` | Calculates refund amounts (read-only, safe) | N/A - Read-only |
394
+
395
+ Permission Protocol: Before executing `refundCreate`:
396
+ 1. Show the order ID and customer information
397
+ 2. List all items being refunded with quantities and amounts
398
+ 3. Show total refund amount including shipping and taxes
399
+ 4. Indicate whether inventory will be restocked
400
+ 5. Wait for explicit user confirmation with "yes", "confirm", or "proceed"
401
+ 6. Emphasize that this action CANNOT be undone
@@ -0,0 +1,319 @@
1
+ # Shopify Customer Segments
2
+
3
+ Create and manage customer segments for targeted marketing using the GraphQL Admin API.
4
+
5
+ ## Overview
6
+
7
+ Customer segments are dynamic groups defined by ShopifyQL queries. Segments automatically update as customers meet or no longer meet the defined criteria.
8
+
9
+ ## List Segments
10
+
11
+ ```graphql
12
+ query ListSegments($first: Int!, $after: String) {
13
+ segments(first: $first, after: $after, sortKey: CREATION_DATE, reverse: true) {
14
+ pageInfo {
15
+ hasNextPage
16
+ endCursor
17
+ }
18
+ nodes {
19
+ id
20
+ name
21
+ query
22
+ creationDate
23
+ lastEditDate
24
+ }
25
+ }
26
+ }
27
+ ```
28
+ Variables: `{ "first": 10 }`
29
+
30
+ ## Get Segment
31
+
32
+ ```graphql
33
+ query GetSegment($id: ID!) {
34
+ segment(id: $id) {
35
+ id
36
+ name
37
+ query
38
+ creationDate
39
+ lastEditDate
40
+ }
41
+ }
42
+ ```
43
+ Variables: `{ "id": "gid://shopify/Segment/123" }`
44
+
45
+ ## Get Segment Count
46
+
47
+ ```graphql
48
+ query GetSegmentsCount {
49
+ segmentsCount {
50
+ count
51
+ }
52
+ }
53
+ ```
54
+
55
+ ## Create Segment
56
+
57
+ ```graphql
58
+ mutation CreateSegment($name: String!, $query: String!) {
59
+ segmentCreate(name: $name, query: $query) {
60
+ segment {
61
+ id
62
+ name
63
+ query
64
+ }
65
+ userErrors {
66
+ field
67
+ message
68
+ }
69
+ }
70
+ }
71
+ ```
72
+ Variables:
73
+ ```json
74
+ {
75
+ "name": "VIP Customers",
76
+ "query": "amount_spent > 500"
77
+ }
78
+ ```
79
+
80
+ ## Update Segment
81
+
82
+ ```graphql
83
+ mutation UpdateSegment($id: ID!, $name: String, $query: String) {
84
+ segmentUpdate(id: $id, name: $name, query: $query) {
85
+ segment {
86
+ id
87
+ name
88
+ query
89
+ }
90
+ userErrors {
91
+ field
92
+ message
93
+ }
94
+ }
95
+ }
96
+ ```
97
+ Variables:
98
+ ```json
99
+ {
100
+ "id": "gid://shopify/Segment/123",
101
+ "name": "Premium VIP Customers",
102
+ "query": "amount_spent > 1000"
103
+ }
104
+ ```
105
+
106
+ ## Delete Segment
107
+
108
+ ```graphql
109
+ mutation DeleteSegment($id: ID!) {
110
+ segmentDelete(id: $id) {
111
+ deletedSegmentId
112
+ userErrors {
113
+ field
114
+ message
115
+ }
116
+ }
117
+ }
118
+ ```
119
+
120
+ ## Get Segment Members
121
+
122
+ ```graphql
123
+ query GetSegmentMembers($segmentId: ID!, $first: Int!, $after: String) {
124
+ customerSegmentMembers(segmentId: $segmentId, first: $first, after: $after) {
125
+ pageInfo {
126
+ hasNextPage
127
+ endCursor
128
+ }
129
+ totalCount
130
+ nodes {
131
+ id
132
+ firstName
133
+ lastName
134
+ defaultEmailAddress {
135
+ emailAddress
136
+ }
137
+ amountSpent {
138
+ amount
139
+ currencyCode
140
+ }
141
+ numberOfOrders
142
+ }
143
+ }
144
+ }
145
+ ```
146
+ Variables:
147
+ ```json
148
+ {
149
+ "segmentId": "gid://shopify/Segment/123",
150
+ "first": 25
151
+ }
152
+ ```
153
+
154
+ ## Check Customer Segment Membership
155
+
156
+ ```graphql
157
+ query CheckSegmentMembership($customerId: ID!, $segmentIds: [ID!]!) {
158
+ customerSegmentMembership(customerId: $customerId, segmentIds: $segmentIds) {
159
+ memberships {
160
+ segmentId
161
+ isMember
162
+ }
163
+ }
164
+ }
165
+ ```
166
+ Variables:
167
+ ```json
168
+ {
169
+ "customerId": "gid://shopify/Customer/123",
170
+ "segmentIds": ["gid://shopify/Segment/456", "gid://shopify/Segment/789"]
171
+ }
172
+ ```
173
+
174
+ ## Get Segment Filters
175
+
176
+ ```graphql
177
+ query GetSegmentFilters($first: Int!) {
178
+ segmentFilters(first: $first) {
179
+ nodes {
180
+ localizedName
181
+ queryName
182
+ }
183
+ }
184
+ }
185
+ ```
186
+
187
+ ## Segment Filter Suggestions
188
+
189
+ ```graphql
190
+ query GetFilterSuggestions($search: String!, $first: Int!) {
191
+ segmentFilterSuggestions(search: $search, first: $first) {
192
+ nodes {
193
+ localizedName
194
+ queryName
195
+ }
196
+ }
197
+ }
198
+ ```
199
+ Variables: `{ "search": "order", "first": 10 }`
200
+
201
+ ## Segment Value Suggestions
202
+
203
+ Get suggested values for a specific filter:
204
+
205
+ ```graphql
206
+ query GetValueSuggestions($search: String!, $filterQueryName: String!) {
207
+ segmentValueSuggestions(search: $search, filterQueryName: $filterQueryName, first: 10) {
208
+ nodes {
209
+ value
210
+ localizedValue
211
+ }
212
+ }
213
+ }
214
+ ```
215
+ Variables:
216
+ ```json
217
+ {
218
+ "search": "new",
219
+ "filterQueryName": "customer_tags"
220
+ }
221
+ ```
222
+
223
+ ## Common Segment Query Examples
224
+
225
+ ### By Spend Amount
226
+ ```
227
+ amount_spent > 500
228
+ amount_spent >= 100 AND amount_spent < 500
229
+ ```
230
+
231
+ ### By Order Count
232
+ ```
233
+ number_of_orders >= 3
234
+ number_of_orders = 0
235
+ ```
236
+
237
+ ### By Customer Tags
238
+ ```
239
+ customer_tags CONTAINS 'vip'
240
+ customer_tags CONTAINS 'wholesale'
241
+ ```
242
+
243
+ ### By Location
244
+ ```
245
+ customer_cities CONTAINS 'New York'
246
+ customer_countries CONTAINS 'US'
247
+ ```
248
+
249
+ ### By Email Subscription
250
+ ```
251
+ email_subscription_status = 'SUBSCRIBED'
252
+ ```
253
+
254
+ ### By Product Purchased
255
+ ```
256
+ products_purchased(id: 123)
257
+ products_purchased(tag: 'summer')
258
+ ```
259
+
260
+ ### By Date
261
+ ```
262
+ customer_added_date > 2024-01-01
263
+ last_order_date > -30d
264
+ ```
265
+
266
+ ### Combined Conditions
267
+ ```
268
+ amount_spent > 200 AND number_of_orders >= 2 AND email_subscription_status = 'SUBSCRIBED'
269
+ ```
270
+
271
+ ## Create Segment Members Query (Async)
272
+
273
+ For large segments, use async queries:
274
+
275
+ ```graphql
276
+ mutation CreateSegmentMembersQuery($input: CustomerSegmentMembersQueryInput!) {
277
+ customerSegmentMembersQueryCreate(input: $input) {
278
+ customerSegmentMembersQuery {
279
+ id
280
+ done
281
+ }
282
+ userErrors {
283
+ field
284
+ message
285
+ }
286
+ }
287
+ }
288
+ ```
289
+ Variables:
290
+ ```json
291
+ {
292
+ "input": {
293
+ "segmentId": "gid://shopify/Segment/123"
294
+ }
295
+ }
296
+ ```
297
+
298
+ Then poll for results:
299
+
300
+ ```graphql
301
+ query GetSegmentMembersQuery($id: ID!) {
302
+ customerSegmentMembersQuery(id: $id) {
303
+ id
304
+ done
305
+ }
306
+ }
307
+ ```
308
+
309
+ ## API Scopes Required
310
+
311
+ - `read_customers` - Read segments and members
312
+ - `write_customers` - Create, update, delete segments
313
+
314
+ ## Notes
315
+
316
+ - Segment queries use [ShopifyQL syntax](https://shopify.dev/docs/api/shopifyql/segment-query-language-reference)
317
+ - Segments update dynamically as customer data changes
318
+ - Maximum page size for segment members is 1000
319
+ - Use segments with discounts via the `context.customerSegments` field