$npx -y skills add 40RTY-ai/shopify-admin-skills --skill shopify-admin-b2b-company-overviewRead-only: lists B2B company accounts with locations, catalogs, and payment terms for wholesale management.
| 1 | ## Purpose |
| 2 | Queries all B2B company accounts and their associated locations, price lists, and payment terms. Provides a consolidated view of the wholesale account portfolio for ops and sales teams. Read-only — no mutations. Requires Shopify B2B (available on Shopify Plus). |
| 3 | |
| 4 | ## Prerequisites |
| 5 | - Authenticated Shopify CLI session: `shopify store auth --store <domain> --scopes read_customers` |
| 6 | - API scopes: `read_customers` |
| 7 | - Store must be on Shopify Plus with B2B enabled |
| 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 | |
| 16 | ## Safety |
| 17 | |
| 18 | > ℹ️ Read-only skill — no mutations are executed. Safe to run at any time. |
| 19 | |
| 20 | ## Workflow Steps |
| 21 | |
| 22 | 1. **OPERATION:** `companies` — query |
| 23 | **Inputs:** `first: 250`, select `name`, `locations`, `contacts`, `createdAt`, pagination cursor |
| 24 | **Expected output:** All B2B company accounts; paginate until `hasNextPage: false` |
| 25 | |
| 26 | 2. **OPERATION:** `companyLocations` — query |
| 27 | **Inputs:** `first: 250` per company, select `name`, `buyerExperienceConfiguration { paymentTermsTemplate, checkoutToDraft }`, `catalogsCount` |
| 28 | **Expected output:** Company locations with payment and catalog configuration |
| 29 | |
| 30 | ## GraphQL Operations |
| 31 | |
| 32 | ```graphql |
| 33 | # companies:query — validated against api_version 2025-01 |
| 34 | query B2BCompanies($after: String) { |
| 35 | companies(first: 250, after: $after) { |
| 36 | edges { |
| 37 | node { |
| 38 | id |
| 39 | name |
| 40 | note |
| 41 | createdAt |
| 42 | updatedAt |
| 43 | locationsCount { |
| 44 | count |
| 45 | } |
| 46 | contactsCount { |
| 47 | count |
| 48 | } |
| 49 | orders(first: 1, sortKey: CREATED_AT, reverse: true) { |
| 50 | edges { |
| 51 | node { |
| 52 | createdAt |
| 53 | totalPriceSet { |
| 54 | shopMoney { |
| 55 | amount |
| 56 | currencyCode |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | pageInfo { |
| 65 | hasNextPage |
| 66 | endCursor |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | ``` |
| 71 | |
| 72 | ```graphql |
| 73 | # companyLocations:query — validated against api_version 2025-01 |
| 74 | query CompanyLocationsDetail($companyId: ID!) { |
| 75 | company(id: $companyId) { |
| 76 | id |
| 77 | name |
| 78 | locations(first: 50) { |
| 79 | edges { |
| 80 | node { |
| 81 | id |
| 82 | name |
| 83 | shippingAddress { |
| 84 | countryCode |
| 85 | city |
| 86 | } |
| 87 | buyerExperienceConfiguration { |
| 88 | paymentTermsTemplate { |
| 89 | name |
| 90 | dueInDays |
| 91 | } |
| 92 | checkoutToDraft |
| 93 | } |
| 94 | catalogsCount { |
| 95 | count |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | ``` |
| 103 | |
| 104 | ## Session Tracking |
| 105 | |
| 106 | **Claude MUST emit the following output at each stage. This is mandatory.** |
| 107 | |
| 108 | **On start**, emit: |
| 109 | ``` |
| 110 | ╔══════════════════════════════════════════════╗ |
| 111 | ║ SKILL: B2B Company Overview ║ |
| 112 | ║ Store: <store domain> ║ |
| 113 | ║ Started: <YYYY-MM-DD HH:MM UTC> ║ |
| 114 | ╚══════════════════════════════════════════════╝ |
| 115 | ``` |
| 116 | |
| 117 | **After each step**, emit: |
| 118 | ``` |
| 119 | [N/TOTAL] <QUERY|MUTATION> <OperationName> |
| 120 | → Params: <brief summary of key inputs> |
| 121 | → Result: <count or outcome> |
| 122 | ``` |
| 123 | |
| 124 | **On completion**, emit: |
| 125 | |
| 126 | For `format: human` (default): |
| 127 | ``` |
| 128 | ══════════════════════════════════════════════ |
| 129 | B2B COMPANY OVERVIEW |
| 130 | Total companies: <n> |
| 131 | Total locations: <n> |
| 132 | With net terms: <n> |
| 133 | With catalogs: <n> |
| 134 | |
| 135 | Company: <name> |
| 136 | Locations: <n> | Last order: <date> |
| 137 | Payment terms: Net 30 |
| 138 | Output: b2b_companies_<date>.csv |
| 139 | ══════════════════════════════════════════════ |
| 140 | ``` |
| 141 | |
| 142 | For `format: json`, emit: |
| 143 | ```json |
| 144 | { |
| 145 | "skill": "b2b-company-overview", |
| 146 | "store": "<domain>", |
| 147 | "total_companies": 0, |
| 148 | "total_locations": 0, |
| 149 | "companies": [], |
| 150 | "output_file": "b2b_companies_<date>.csv" |
| 151 | } |
| 152 | ``` |
| 153 | |
| 154 | ## Output Format |
| 155 | CSV file `b2b_companies_<YYYY-MM-DD>.csv` with columns: |
| 156 | `company_id`, `company_name`, `locations_count`, `contacts_count`, `last_order_date`, `last_order_value`, `currency`, `payment_terms`, `has_catalog` |
| 157 | |
| 158 | ## Error Handling |
| 159 | | Error | Cause | Recovery | |
| 160 | |-------|-------|----------| |
| 161 | | `THROTTLED` | API rate limit exceeded | Wait 2 seconds, retry up to 3 times | |
| 162 | | Empty companies list | B2B not configured or no accounts | Exit with 0 companies, note B2B Plus requirement | |
| 163 | | `companies` query not available | Store not on Shopify Plus | Return clear error: B2B requires Shopify Plus | |
| 164 | |
| 165 | ## Best Practices |
| 166 | - Run monthly as a wholesale account health check — companies with no orders in 90+ days may need outreach. |
| 167 | - `checkoutToDra |