$npx -y skills add 40RTY-ai/shopify-admin-skills --skill shopify-admin-tax-liability-summaryRead-only: aggregates tax collected by jurisdiction from order tax lines for filing prep.
| 1 | ## Purpose |
| 2 | Aggregates tax amounts collected across all orders in a period, broken down by tax jurisdiction (state/province, country) and tax rate. Produces a summary suitable for periodic tax filing prep. Read-only — no mutations. |
| 3 | |
| 4 | ## Prerequisites |
| 5 | - Authenticated Shopify CLI session: `shopify store auth --store <domain> --scopes read_orders` |
| 6 | - API scopes: `read_orders` |
| 7 | |
| 8 | ## Parameters |
| 9 | |
| 10 | | Parameter | Type | Required | Default | Description | |
| 11 | |-----------|------|----------|---------|-------------| |
| 12 | | store | string | yes | — | Store domain (e.g., mystore.myshopify.com) | |
| 13 | | days_back | integer | no | 90 | Lookback window (use 30/90 to match filing periods) | |
| 14 | | group_by | string | no | jurisdiction | Breakdown: `jurisdiction` or `rate` | |
| 15 | | exclude_refunded | bool | no | true | Exclude tax from fully refunded orders | |
| 16 | | format | string | no | human | Output format: `human` or `json` | |
| 17 | |
| 18 | ## Safety |
| 19 | |
| 20 | > ℹ️ Read-only skill — no mutations are executed. Safe to run at any time. This report is for internal preparation purposes only — consult a tax professional for actual filing obligations. |
| 21 | |
| 22 | ## Workflow Steps |
| 23 | |
| 24 | 1. **OPERATION:** `orders` — query |
| 25 | **Inputs:** `query: "financial_status:paid created_at:>='<NOW - days_back days>'"`, `first: 250`, select `taxLines { title, rate, priceSet }`, `refunds { refundLineItems }`, pagination cursor |
| 26 | **Expected output:** All paid orders with tax lines; paginate until `hasNextPage: false` |
| 27 | |
| 28 | 2. If `exclude_refunded`: subtract tax amounts from fully refunded orders |
| 29 | |
| 30 | 3. Group by `group_by` (jurisdiction title or rate); sum `taxLine.priceSet.shopMoney.amount` |
| 31 | |
| 32 | ## GraphQL Operations |
| 33 | |
| 34 | ```graphql |
| 35 | # orders:query — validated against api_version 2025-01 |
| 36 | query TaxLiabilityOrders($query: String!, $after: String) { |
| 37 | orders(first: 250, after: $after, query: $query) { |
| 38 | edges { |
| 39 | node { |
| 40 | id |
| 41 | name |
| 42 | createdAt |
| 43 | displayFinancialStatus |
| 44 | totalTaxSet { |
| 45 | shopMoney { |
| 46 | amount |
| 47 | currencyCode |
| 48 | } |
| 49 | } |
| 50 | taxLines { |
| 51 | title |
| 52 | rate |
| 53 | priceSet { |
| 54 | shopMoney { |
| 55 | amount |
| 56 | currencyCode |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | shippingAddress { |
| 61 | countryCode |
| 62 | provinceCode |
| 63 | } |
| 64 | refunds { |
| 65 | totalRefundedSet { |
| 66 | shopMoney { |
| 67 | amount |
| 68 | currencyCode |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | pageInfo { |
| 75 | hasNextPage |
| 76 | endCursor |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | ``` |
| 81 | |
| 82 | ## Session Tracking |
| 83 | |
| 84 | **Claude MUST emit the following output at each stage. This is mandatory.** |
| 85 | |
| 86 | **On start**, emit: |
| 87 | ``` |
| 88 | ╔══════════════════════════════════════════════╗ |
| 89 | ║ SKILL: Tax Liability Summary ║ |
| 90 | ║ Store: <store domain> ║ |
| 91 | ║ Started: <YYYY-MM-DD HH:MM UTC> ║ |
| 92 | ╚══════════════════════════════════════════════╝ |
| 93 | ``` |
| 94 | |
| 95 | **After each step**, emit: |
| 96 | ``` |
| 97 | [N/TOTAL] <QUERY|MUTATION> <OperationName> |
| 98 | → Params: <brief summary of key inputs> |
| 99 | → Result: <count or outcome> |
| 100 | ``` |
| 101 | |
| 102 | **On completion**, emit: |
| 103 | |
| 104 | For `format: human` (default): |
| 105 | ``` |
| 106 | ══════════════════════════════════════════════ |
| 107 | TAX LIABILITY SUMMARY (<days_back> days) |
| 108 | Orders analyzed: <n> |
| 109 | Total tax collected: $<amount> |
| 110 | |
| 111 | By Jurisdiction: |
| 112 | CA - California $<amount> (<n> orders) |
| 113 | NY - New York $<amount> (<n> orders) |
| 114 | Output: tax_liability_<date>.csv |
| 115 | ══════════════════════════════════════════════ |
| 116 | ``` |
| 117 | |
| 118 | For `format: json`, emit: |
| 119 | ```json |
| 120 | { |
| 121 | "skill": "tax-liability-summary", |
| 122 | "store": "<domain>", |
| 123 | "period_days": 90, |
| 124 | "orders_analyzed": 0, |
| 125 | "total_tax_collected": 0, |
| 126 | "currency": "USD", |
| 127 | "by_jurisdiction": [], |
| 128 | "output_file": "tax_liability_<date>.csv" |
| 129 | } |
| 130 | ``` |
| 131 | |
| 132 | ## Output Format |
| 133 | CSV file `tax_liability_<YYYY-MM-DD>.csv` with columns: |
| 134 | `jurisdiction`, `country_code`, `province_code`, `tax_rate`, `order_count`, `total_tax_collected`, `currency` |
| 135 | |
| 136 | ## Error Handling |
| 137 | | Error | Cause | Recovery | |
| 138 | |-------|-------|----------| |
| 139 | | `THROTTLED` | API rate limit exceeded | Wait 2 seconds, retry up to 3 times | |
| 140 | | No tax lines on orders | Tax not configured or tax-exempt orders | Report $0 for those orders | |
| 141 | | Orders with partial refunds | Tax credit complex to calculate | Flag in output; exclude from totals if `exclude_refunded: true` | |
| 142 | |
| 143 | ## Best Practices |
| 144 | - This report reflects tax *collected* from customers — it is not a substitute for Shopify Tax or a professional nexus analysis. |
| 145 | - Align `days_back` with your filing period (30 days for monthly filers, 90 for quarterly). |
| 146 | - For multi-state US merchants, check that Shopify Tax is configured correctly for each nexus state before relying o |