Add shopify-import skill: migrate products from 10 commerce platforms#2
Closed
hamishrobertson-dev wants to merge 5 commits into
Closed
Add shopify-import skill: migrate products from 10 commerce platforms#2hamishrobertson-dev wants to merge 5 commits into
hamishrobertson-dev wants to merge 5 commits into
Conversation
Merchant-facing agent skill that imports product catalogs into Shopify from other commerce platforms. Works with `shopify store execute` (Shopify/cli#7122, shipped 2026-04-01). Supported platforms: - Square, WooCommerce, Etsy, Wix, Amazon, eBay, Clover - Lightspeed R-Series, Lightspeed X-Series (Vend) - Google Merchant Center (new — not in shop-importer-app) Agent workflow: 1. Agent loads SKILL.md, routes to platform guide 2. Walks merchant through CSV export 3. Parses + validates via scripts/import.py --json 4. Executes productSet mutations via shopify store execute Includes: - SKILL.md + 10 platform guides (platforms/*.md) - Modular CSV parsers for all 10 platforms (scripts/parsers/) - Pre-import validation with blocking errors + warnings (scripts/validate_csv.py) - CLI preview and JSON output (scripts/import.py) - Internal dev testing harness (scripts/testing/) - 10 platform fixture CSVs (test-data/) - 181 unit tests (tests/) Verified end-to-end: - 181 unit tests passing - Tophat: 22 products (43 variants) created across all 10 platforms - Full CLI loop: import.py --json → shopify store execute → product created
Author
13 CSV fixtures targeting real-world failure modes not covered by the happy-path test data: unicode/CJK/RTL/emoji, orphaned variants, empty fields, malformed headers (BOM + whitespace), zero/negative prices and inventory, >3 option types, sale price > regular, auction listings, mixed currencies, out-of-stock/preorder, invisible products, variant rows before product rows, and an empty file (headers only). See test-data/edge-cases/README.md for the full matrix.
Companion to tophat.py. Runs all 13 edge-case CSVs through their parsers and (optionally) pushes to the Shopify Admin API. Modes: --dry-run Parse only, no API calls --platform square Run one platform only --report out.json Write machine-readable JSON report Dry-run already surfaces 2 parser bugs: - BOM + whitespace headers → KeyError on Token - 3-option Square products → NoneType.strip() on empty Option Name
Parser fixes: - common.py: Strip whitespace from CSV headers (fixes BOM/whitespace edge case) - common.py: Clamp negative prices to 0 via safe_float (Shopify rejects negatives) - common.py: Add safe_float_signed() for cases where negatives are valid - square.py: Guard against None values in Option Name/Value columns (fixes NoneType.strip() crash on CSVs with Option Name 3 column) - lightspeed_r.py: Split items with no Size/Color into separate products instead of grouping as variants with duplicate 'Default Title' (API rejects) Execution fixes: - shopify_cli.py: New CLI wrapper using `shopify store execute` (3.93.0+). No API tokens needed — uses OAuth via `shopify store auth`. - shopify_cli.py: Pin API version to 2025-04 for inventory mutations (latest version requires changeFromQuantity on both Set and Adjust) - shopify_cli.py: Re-add `data` wrapper stripped by CLI --json output - shopify_api.py: Remove ignoreCompareQuantity (not in latest API) - tophat_edge_cases.py: Rewrite to use shopify_cli.py instead of direct API Tested against hamish-dev.myshopify.com: - 0 parse errors (was 2) - 74/76 products created (was 0/65) - Inventory quantities setting correctly - 181 existing unit tests still pass
- SKILL.md: Replace SHOPIFY_ADMIN_TOKEN instructions with shopify store auth - SKILL.md: Remove ignoreCompareQuantity references (not in latest API) - tophat.py: Update docstring noting it still uses direct API; point to tophat_edge_cases.py for the token-free CLI approach
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


TL;DR
Merchant-facing agent skill that imports product catalogs into Shopify from 10 commerce platforms. Replaces the Store Migration app (2.7★) with an agent-powered approach. Works with
shopify store execute(Shopify/cli#7122, shipped 2026-04-01).Installable via:
npx skill add shopify/agent-skills/shopify-importWhat
When a merchant says "I want to move my products from Square to Shopify," the agent:
./scripts/import.py --jsonproductSetmutation viashopify store executeSupported platforms
Google Merchant Center is new — not in
shop-importer-app. Requested in the Tobi review on agentic (2026-03-31).File structure
How the execution path works
shopify store execute(Shopify/cli#7122) shipped yesterday. The flow is:shopify store auth— OAuth flow, connects agent to store (no API tokens exposed)./scripts/import.py products.csv --platform square --json— gets mutation payloadsshopify store execute --store shop.myshopify.com --allow-mutations --query "mutation productSet(...)" --variables '{"input": <payload>}'The
--jsonoutput gives the agent machine-readable payloads that slot directly intoshopify store execute. The agent does not need to understand CSV parsing or column mapping — it just pipes our output into the CLI.Why this beats the app
The Store Migration app has a 2.7★ rating. Common complaints: broken SKU mapping, missing images, incorrect variant prices.
An LLM-powered skill can:
How to test
Unit tests (181 passing, <0.1s)
Preview import (no API needed)
🎩 Tophat against a dev store
write_products,read_products,write_inventory,read_inventory,read_locations)Expected: 22 products (43 variants), 4 skipped, 27 inventory quantities. All DRAFT, names prefixed with platform.
Full CLI loop (shopify store execute)
Scope and known gaps
This covers product import. Not yet a full replacement for the Store Migration app:
bulkOperationRunMutation.Context
dev-mcp