/shoplazza:shoplazza-commonfrom Shoplazza
Shared foundation for the shoplazza CLI: installation, authentication (login/logout/store switching), multi-store profiles, access tiers (shortcut/spec leaf/api rest), output envelope, dry-run, jq, fields, format, schema introspection, safety protocol, and pagination. Read first when using any shoplazza domain skill.
Ships in Shoplazza. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This skill is the foundation for every domain skill (shoplazza-discounts,
shoplazza-products, …): it owns all cross-cutting mechanics so domain skills never repeat
them, and every domain skill opens by requiring this file be read first. The authoritative
source for commands/params is shoplazza <svc> <cmd> --help and shoplazza schema — this
file teaches the mechanics, it does not memorize flags.
Reply in the user's language. Skill prose is English, but that never sets your reply language — mirror the user (中文提问 → 中文回答), including questions you ask back, write-confirmation restatements, and error explanations. Keep CLI commands, flags, and field names verbatim (untranslated).
Start every operation at the highest tier that fits and stop as soon as one expresses it:
| Tier | Form | When |
|---|---|---|
| 1. Shortcut | shoplazza <svc> +<verb> [named flags] | First choice. Named flags, smart defaults, structured errors. |
| 2. Spec leaf | shoplazza <svc> <cmd> --params '{…}' [--data '{…}'] | Endpoints with no shortcut; one command per endpoint. |
| 3. api rest | shoplazza api rest <METHOD> <PATH> | Raw fallback, full coverage. Only when the first two can't express it. |
In shoplazza <svc> --help, entries prefixed with + are shortcuts; the rest are spec leaves.
A spec leaf's --params takes only the path / query parameters schema <svc>.<cmd> lists; body
fields go in --data. A --params key that is undeclared (unknown_param) or is a body field
(misplaced_param), a required path / query key that is absent, empty or still a placeholder such
as <id> (missing_required_param, all such keys listed in one error), or a required top-level
body field missing from --data (missing_required_field), fails with exit 2 before anything is
sent, --dry-run included.
The structured-output contract, uniform across commands:
{"ok":true,"data":<body>}{"ok":false,"error":{"type":…,"message":…}}, non-zero exit.jq_failed_after_request is the one failure that comes with data. The request already
succeeded (a write took effect) and only -q failed on the response: exit 2, the whole
{ok,data} response on stdout, error.detail naming the request. Do not resend it; fix -q
(the message names the failing path step and the keys at that level) or read stdout.
Response bodies nest under .data, so every jq path starts at .data (e.g.
.data.products[].id). Missing the .data prefix is the most common extraction mistake.
Exception — local commands have no envelope. auth status / auth scopes /
profile list print their object at the top level (no {ok,data}, no --jq support);
read fields directly (e.g. logged_in).
| Flag | Notes |
|---|---|
--dry-run | Print the request that would be sent, without sending it. Always --dry-run first for destructive / batch / money-spending writes. Read commands and shortcuts support it too. |
-q, --jq <expr> | Filter JSON output with a jq expression. Outputs raw scalars by default (no surrounding quotes, just a trailing newline) — do not add -r: cobra parses -r as a separate flag and rejects the command. It is a single-string flag. |
--fields <f1,f2,…> | Response field projection on a few shortcuts only — verified: products +search (comma-separated: products +search --fields id,title). Not universal — most commands have no --fields; check <shortcut> --help before using it. Names are response keys; the server may still return extra base fields and silently ignores unknown names. |
--page-limit <n> | Page size, 1–250, on list shortcuts. The API default is 10 — see "Reading a filtered list" below. |
--format json|pretty|table | Output format: json by default, but pretty when stdout is a terminal (a pty included) and none of CI / SHOPLAZZA_CLI_NO_INTERACTIVE / --no-input is set — --jq needs json. Use json for scripts/jq, pretty/table for humans. Global flag. |
--profile <name> | Profile to use for this invocation (see "Profiles"). Global flag. |
Field projection: a few search shortcuts accept --fields (verify with --help); everywhere else, project/filter with --jq.
List flags on shortcuts (--variants, --tags, --status, …) take comma-separated values or a
repeated flag: --variants a,b = --variants a --variants b. A single-value flag given twice, or a
value outside a flag's fixed list, is exit 2 (invalid_flag_value) instead of last-one-wins.
A read that returns {"ok":true,…} is not evidence that the filter or the page you asked
for is the one you got. Two failure modes are silent, and both produce a confident wrong
answer rather than an error:
1. Truncation — the page default is 10. List endpoints return 10 records unless
--page-limit says otherwise (max 250), with has_more / cursor marking the rest.
has_more may come back null rather than false, so treat "not true" as the end.
Whenever the answer depends on completeness — "how many", "which ones", "all of X", any
total you compute yourself — pass --page-limit 250 and, while has_more is true, rerun with
the same flags plus --cursor <.data.cursor> (spec leaves: "cursor" in --params). For a pure count,
prefer the domain's +count shortcut over counting rows.
2. Silently-dropped filters — the API ignores query params it does not recognise. It does not 400. A flag whose param name has drifted comes back 200 with the unfiltered set, which reads exactly like "this customer really has that many orders".
So before a filtered read becomes an answer or feeds a write, confirm the filter landed:
shoplazza <svc> +search --<filter> <value> --dry-run # 1. which param actually goes on the wire
shoplazza <svc> +count # 2. unfiltered total, for comparison
shoplazza <svc> +count --<filter> <value> # 3. filtered total — must be < the unfiltered one
A filtered result equal to the unfiltered total is the tell. Confirm it by spot-checking
that the returned records actually satisfy the filter (--jq over the field you filtered on).
If the filter is being dropped, schema <svc>.<cmd> --view request lists the params the
endpoint really accepts — reach for the spec leaf or api rest with the documented param.
Precision ladder — when the endpoint offers more than one way to filter on the same thing,
prefer the narrowest: a dedicated exact-match param (often an array, e.g. customer_emails,
skus, order_tags) beats a general keyword search, which beats hand-filtering with --jq
over a full page. Exact params say what they match; keyword search may match a field you did
not intend.
Which tier — read the user's verb. The phrasing tells you whether they mean a whole value or a fragment, and that decides exact vs keyword:
| User's signal | Meaning | Tier |
|---|---|---|
「是 / 为 / 等于 / =」, 「编号 / 号码 / 值 is X」, or a self-identifying whole string (a full email, a full SKU like ABC-001, a full phone) | whole value | exact-match array param |
「包含 / 含 / 像 / 类似 / 以…开头 / 前缀 / 片段 / 部分」, X*, contains / starts-with / like | fragment | keyword search |
「是 / equals」is the authoritative exact signal even when it sits right next to a field name — match the whole value, do not fuzzy-search it.
Report the basis, not just the number. When you answer from a list read, say which filter was applied and what the completeness basis is ("3 of 3, unfiltered total 18"). It makes a dropped filter visible to the user instead of invisible.
Locate before you act. A write targets a record by its id, but users name it by something else (an order number, a code, an email, a title). Resolve the target with a read first, then branch on the count:
--dry-run + restate for a destructive / money op).A number is not an id (e.g. an order number vs the internal order_id) — feeding one where the other is expected hits the wrong record or errors. Resolve it through the read, don't assume.
Before calling any spec leaf or api rest, check the schema to confirm params / body / response
shape — do not guess fields:
shoplazza schema # list all modules
shoplazza schema discounts # list a module's commands
shoplazza schema discounts.get # a command's params / body / response
shoplazza schema orders.create --view request # request side only (--view all|request|response)
Questions about the platform itself (app development, OAuth and scopes, webhooks and their
signatures, app proxy, theme development and Liquid, an unfamiliar API error, the changelog)
are answered from the developer docs on shoplazza.dev: use the shoplazza-docs skill
(shoplazza docs search / shoplazza docs get, no login needed). It complements schema,
it doesn't replace it:
| Question | Use |
|---|---|
| A CLI command's params / body / response, or which command to run | schema (above): offline, exactly what the CLI sends |
| Concepts, rules, flows, Liquid, the changelog, APIs the CLI doesn't cover | docs search |
Only when the first two tiers can't express it. Write the resolved real URL (not a {…}
template):
shoplazza api rest GET /openapi/2026-01/products
shoplazza api rest GET /openapi/2026-01/products/gid_123 --params '{"page_size":10}'
shoplazza api rest POST /openapi/2026-01/discounts/automatic --data @body.json
Supports --params / --data (incl. - for stdin, @file for a file), --dry-run, -q/--jq.
Multi-value query params → JSON array. An array param (ids, status, spus, …) reaches
the API as repeated keys (?ids=a&ids=b); the API reads a comma-joined value as one literal that
matches nothing. In --params write {"ids":["a","b"]}. Spec leaves also split a comma-joined
string for an array param; api rest sends a string as-is. A single value that contains a comma
goes in a one-item array ({"vendors":["Nike, Inc."]}).
If shoplazza is not found (command not found) or shoplazza --version fails, the CLI is
not installed. Installing changes the user's machine: say which method you'll use and wait for
a yes. Pick by what the machine already has:
| Method | Command | When |
|---|---|---|
| npm (recommended) | npm install -g shoplazza-cli | Node.js ≥ 16 present (node -v) |
| Homebrew | brew install Shoplazza/tap/shoplazza-cli | macOS / Linux with brew |
| Install script | curl -fsSL https://raw.githubusercontent.com/Shoplazza/shoplazza-cli/main/install.sh | bash | macOS / Linux without Node; installs to /usr/local/bin (INSTALL_DIR=<dir> to change) |
| Release binary | download from https://github.com/Shoplazza/shoplazza-cli/releases | any other platform; put it on PATH |
Then confirm with shoplazza --version and continue with the login flow below. If the install
fails — a sandbox blocks it, permission is denied, or it needs sudo — stop and hand the user
the exact command to run in their own terminal.
shoplazza binaries on PATH running
different versions; which -a shoplazza lists them. Keep one.shoplazza update always reinstalls via npm — on a
Homebrew or script install it adds that second copy. Use brew upgrade shoplazza-cli or
re-run the script instead.shoplazza --version # installed?
shoplazza auth login -s my-store.myshoplazza.com --domain products,orders # login + bind a store
shoplazza auth status # logged_in: true, the store under profiles
Run the login in the background and hand the user the authorization URL (Agent-driven login flow below). Ask which store and which modules the user needs; don't guess a store domain.
Before the first store operation in a session, run shoplazza auth status (local, instant,
no envelope). Two independent things must both be true:
logged_in: true — account credentials exist. If false → run the login flow below.profiles non-empty — a store is bound. logged_in: true with profiles: [] still cannot
reach any store API; ask which store and run auth login -s <store> --domain <modules>.If you skip the preflight, an unauthenticated business command fails fast with a
validation error — "no profile configured" plus a hint naming the fix. Treat that the
same way: don't retry, guide the user through login first.
Authorization has two layers: account-level (auth login obtains account credentials) and
store-level (exchange a store token for a specific store, stored in a profile).
# Account-level login (no store bound)
shoplazza auth login --domain products,orders # or --scope read_product,write_product
# Store-level login (select a store; an interactive login with -s must also pass --scope or --domain)
shoplazza auth login -s my-store.myshoplazza.com --domain discounts
--domain <module,…>: authorize by top-level command name; the CLI expands each into the
OAuth scopes that module needs. Options: app, billing, checkout, customers, discounts, orders, products, shop, themes, webhook, all. Preferred — you don't memorize scope literals.--scope <literal,…>: fine-grained OAuth scopes (e.g. read_product,write_product),
least-privilege.--merge-scopes to carry the
prior grant along (older CLIs lack the flag — build the union yourself via auth scopes;
--domain and --scope combine in one login). Only omit it when the user explicitly
wants to narrow permissions.When acting as an AI agent to log the user in: run auth login in the background (it
blocks and polls until the user completes authorization or it times out — see
--poll-interval / --timeout, defaults 2s / 300s), extract the authorization URL from its
output and hand it to the user; the command returns on its own after the user authorizes.
Missing flags become on-screen questions when a terminal is present. auth login, app init,
shortcuts (a missing required flag) and spec leaves (a missing path param) ask for what you left
out, and destructive writes ask to confirm, only when stdin and stderr are both real terminals and
neither SHOPLAZZA_CLI_NO_INTERACTIVE nor CI is set (present and non-empty = set); otherwise a
missing flag is an error pointing at that flag. A harness that hands the child process a pty
passes that check and the command waits on a keypress that never comes — export
SHOPLAZZA_CLI_NO_INTERACTIVE=1 once for the session if yours does (it also keeps --format at json).
It only switches prompting off. There is no --interactive flag and no env var to force it
on — deliberately, since forcing it would hang for good wherever no terminal exists.
Re-login for a missing scope? Pass --merge-scopes. Scopes are replaced, not merged
(see Login above); requesting only the missing scope drops everything else mid-task. If the
flag is unknown (older CLI), fall back to building the union: auth scopes → granted, then
request granted + the new scopes in one login.
If you already ran auth login on another machine and have an account UAT, skip the browser:
shoplazza auth login --uat <UAT> # or set env SHOPLAZZA_UAT=<UAT>
--uat is promptless whatever the terminal looks like — a second, whole-command off-switch on
top of the gate above. Browser logins driven from a pty-allocating harness still need
SHOPLAZZA_CLI_NO_INTERACTIVE=1.
shoplazza auth status # auth state / identity / current store
shoplazza auth scopes # supported scopes + scopes granted to the account
shoplazza auth store use -s another-store.myshoplazza.com [--scope …] # exchange a token for that store, set as current profile
shoplazza auth logout # log out of the account and delete EVERY profile (one store: profile remove)
Which command switches the store:
| Want | Command |
|---|---|
| Which store am I on? | auth status — the profile with current: true (store_domain) |
| A store used before (has a profile) | profile list → profile use --name <name> (--previous switches back) |
| A store with no profile yet | auth store use -s <store-domain> — creates or reuses its profile and makes it current |
| One command against another store | add --profile <name> to that command; the current profile stays |
auth store use and profile add need an account login first, and a profile's scopes must be
a subset of the account grant — missing scopes → auth login --domain <module> --merge-scopes,
then switch again.
subtype: missing_scope (exit 3): the token lacks a scope. required_scopes names the resource's
read_/write_ pair when the CLI knows it — run shoplazza auth login --scope <both, comma-separated> --merge-scopes, then retry; without it, run auth scopes to see what's granted. subtype: invalid_token
(exit 3): the store rejected the token — log in again.
A profile = one store execution context (its store token + scopes). Manage multiple stores by switching profiles:
shoplazza profile add --name prod-us -s my-store.myshoplazza.com [--scope …] [--use]
shoplazza profile list
shoplazza profile use --name prod-us # or --previous to switch back to the last one
shoplazza profile info [--name prod-us] # defaults to the current profile
shoplazza profile rename --from old --to new
shoplazza profile remove --name prod-us
shoplazza profile update --name prod-us --scope … # adjust a profile's scopes
Per-invocation override: the --profile <name> global flag beats the SHOPLAZZA_CLI_PROFILE
env var and the current profile.
Profiles share one account login and one config. When other sessions on the same machine may
use the CLI against another environment or account, give each its own state dir with
SHOPLAZZA_CLI_CONFIG_DIR=<absolute dir> (plus that environment's SHOPLAZZA_CLI_AUTH_BASE_URL)
on every command, and log in once inside it. A re-login or profile use then stays in that dir.
A relative path is rejected with a validation error (exit 2) on every command but --help /
--version; a leading ~ is expanded.
When the CLI detects a new version, a json success envelope carries _notice.update
(current / latest / message); the ⚡ shoplazza-cli X is available … line goes to stderr
only when stderr is a terminal. Do not
silently ignore it: after finishing the user's current request, tell them the current /
latest version and offer to update:
shoplazza update # update via npm (--check only reports versions, no install)
# or: npm install -g shoplazza-cli@latest
Installed with Homebrew or the install script? Update the same way instead (see Installation).
(Set SHOPLAZZA_CLI_NO_UPDATE_CHECK to disable the check.)
update does three things and reports each in its JSON body:
| Field | Means |
|---|---|
updated | the binary was reinstalled. false = already current, not a failure |
meta_updated / meta_revision | the API metadata cache was rewritten, and at which revision |
skill_installed | the Agent Skills are installed — nothing more |
skill_installed answers "are they there", not "were they just refreshed": shoplazza update
does refresh them when it is true, but update --check reports the same true while
refreshing nothing, and a refresh that failed also still reports true (with a warning on
stderr). Never tell the user their skills were updated on the strength of this field alone —
read the stderr lines (✓ Refreshed N skill(s)) for that.
The skills are opt-in: false means the user never installed them and update left them
alone rather than installing them. To install:
npx skills add Shoplazza/shoplazza-cli -g
(Set SHOPLAZZA_CLI_SKIP_SKILLS=1 to suppress the skill step; the field then disappears from the
body entirely — an absent field means "suppressed", false means "not installed".)
shoplazza-cli has no lark-style exit-10 high-risk-write gate and no --yes confirmation
flag. Do not invent a confirmation protocol. The safety model is --dry-run → restate →
wait for the user's go-ahead:
--dry-run first for destructive (cancel / delete), batch, or fund-moving (billing
charges) operations: print the request that would be sent, restate it, then STOP and end
your turn. For entity/campaign creation via a +shortcut (e.g. creating a discount),
follow the domain skill — +shortcuts are structured and safe to run directly once the
required, money-affecting values are confirmed (never fabricated); --dry-run only if the
user asks.shoplazza --help # top-level modules
shoplazza <svc> --help # a module's shortcuts + spec leaves
shoplazza <svc> <cmd> --help # a command's flags
shoplazza schema <svc>.<cmd> # params / body / response shape
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
shoplazza-cli, cli-foundation, authentication, multi-store, pagination
10 skills in this plugin
/shoplazza-billingUse when an app developer needs to bill a Shoplazza merchant for app usage through the CLI — one-time application charges, recurring (subscription) charges, metered usage charges, and app-charge transaction records. Triggers include 应用收费 / 订阅费 / 一次性收费 / 用量费 / 计费 / app billing / recurring / one-time / usage charge. NOT buyer order payments or refunds (那是 shoplazza-orders 的 transactions / +refund)./shoplazza-customersUse when the user wants to manage customers (buyers) on a shoplazza store through the CLI — create a customer profile, find a customer by email or phone, get customer details or the total customer count, update names / tags / email or SMS marketing subscription, or manage a customer's shipping addresses including the default checkout address. Triggers include 客户 / 买家 / 顾客 / 客户资料 / 新建客户 / 按邮箱查客户 / 按手机号查客户 / 给客户打标签 / 退订营销 / 收货地址 / 默认地址 / customer profile / new customer / find customer by email or phone / customer count / tag a customer / unsubscribe marketing / shipping address / default address. Finding the customer RECORD by email (按邮箱找客户资料) belongs HERE (customers +search); that customer's ORDER HISTORY (该客户下过的订单 / orders placed by this email) belongs to shoplazza-orders./shoplazza-discountsUse when the user wants to manage discount activities on a shoplazza store through the CLI — promotional campaigns, coupon codes, flash sales, buy-X-get-Y offers, rebates / tiered satisfy-N-get-M discounts, free-shipping codes, M-for-N (Nth-item-off) discounts, discount stacking / combination rules, or coupon (voucher) campaigns. Triggers include 满减 / 折扣码 / 优惠码 / 闪购 / 满X减Y. NOT gift cards (redeemable store credit → shoplazza-products `gift-cards`). NOT showing a sale inside a theme card / 首页促销卡片 (→ shoplazza-themes).npx claudepluginhub shoplazza/shoplazza-cli --plugin shoplazzaOther plugins' skills for the same job