This article follows the official documentation. We haven’t tested this tool for a hands-on review.
Shopify CLI, Shopify's command-line tool, gives a coding agent the same commands developers use to check and preview a Shopify theme. A theme is the collection of files that controls a store’s storefront design and behavior. The agent can work on those files locally, run Shopify’s theme checks, and start a preview connected to a store.
Shopify CLI also supports apps, extensions, functions, and custom storefronts. This article focuses on one task with an existing theme: check a local change, preview it on a development theme, and leave uploading or publishing for a separate approved step. Shopify describes the CLI as a tool for developing Shopify projects and handling common development tasks in its CLI overview.
Install and authenticate
Install Shopify CLI globally with npm, then check that the shell can find it:
npm install -g @shopify/cli@latest
shopify version
The official installation instructions also cover Yarn, pnpm, and Homebrew on macOS. Starting with CLI 4.0, Shopify says the CLI upgrades itself through its package manager for many global installs. It does not do this in continuous integration (CI), for project-local installs, or for major-version upgrades. If you need the agent to use repeatable tool versions, check which version is installed and decide how the environment will manage upgrades.
Shopify CLI must authenticate to a store before it can create a development preview. The theme documentation lists a Shopify account, a Theme Access password, and a custom app access token as authentication options. For the example below, run the command in a terminal where an authorized person can complete any sign-in prompt. Do not put a password or access token in the agent’s prompt or source files. See Shopify’s theme CLI authentication guidance.
Check and preview a theme
Give the agent access to an existing local theme directory. Replace /path/to/existing-theme with that directory, and replace STORE.myshopify.com with the development store’s actual domain.
cd /path/to/existing-theme
shopify theme check
shopify theme dev --store STORE.myshopify.com
shopify theme check checks the local theme code and reports issues for review. It does not create a store preview. The agent should address relevant findings, then run shopify theme dev to preview the theme. Shopify documents theme check and the theme dev --store syntax in its theme CLI reference.
The first command reads the local theme files. The second contacts Shopify, uploads the working theme as a development theme, and prints a preview link. A development theme is hidden from shoppers. Shopify deletes it after seven days of inactivity and when someone runs shopify auth logout. The preview link is temporary, so do not rely on the preview theme as a lasting backup.
A realistic agent prompt could be:
Inspect the existing theme, make the requested change to the product page, and run
shopify theme check. If the checks pass, start a preview withshopify theme dev --store STORE.myshopify.comand report the preview link and any diagnostics. Do not upload or publish the theme.
The agent’s edits affect local files. Starting the preview also creates a temporary development theme on the connected Shopify store, but it does not publish the theme to shoppers.
Keep upload separate
Previewing and uploading are different actions. After reviewing the development preview, an authorized person can decide whether to run shopify theme push to upload theme files to the store. Shopify documents that command in the theme CLI instructions. Because pushing changes store-side theme content, ask for explicit approval before an agent runs it. Publishing is a further decision; do not treat a successful preview as permission to publish.
Shopify CLI runs in a command-line shell, so a coding agent uses its documented commands instead of a separate interface made just for agents. Shopify’s official documentation does not define a dedicated coding-agent workflow. Keep the commands and any links in the agent’s output so a person can review what the agent checked and which store it contacted.
Account for version and privacy settings
Shopify CLI collects anonymous usage statistics by default. Shopify documents SHOPIFY_CLI_NO_ANALYTICS=1 and OPT_OUT_INSTRUMENTATION=true as ways to opt out in its CLI documentation. Set the appropriate environment variable in the agent’s execution environment when that collection does not fit your requirements. Do not add credentials to the same prompt or log output.