← 返回 Skills 市场
caravanglory

Magento 2 Skill

作者 Caravan Of Glory · GitHub ↗ · v1.3.1 · MIT-0
cross-platform ✓ 安全检测通过
189
总下载
1
收藏
0
当前安装
5
版本数
在 OpenClaw 中安装
/install magento2
功能描述
Manage a Magento 2 / Adobe Commerce store via REST API. Use for orders, catalog, customers, inventory, promotions, and sales reporting. It can also discover...
使用说明 (SKILL.md)

Magento 2 Skill

Connect to one or more Magento 2 / Adobe Commerce stores via REST API using OAuth 1.0a.

Authentication

All requests are signed with OAuth 1.0a. Credentials are read from environment variables — never ask the user to paste them in chat.

Single site (default)

  • MAGENTO_BASE_URL — e.g. https://store.example.com
  • MAGENTO_CONSUMER_KEY
  • MAGENTO_CONSUMER_SECRET
  • MAGENTO_ACCESS_TOKEN
  • MAGENTO_ACCESS_TOKEN_SECRET

Multi-site setup

To connect to additional stores, define credentials with a site suffix (MAGENTO_\x3CVAR>_\x3CSITE>):

MAGENTO_BASE_URL_US=https://us.store.com
MAGENTO_CONSUMER_KEY_US=...
MAGENTO_CONSUMER_SECRET_US=...
MAGENTO_ACCESS_TOKEN_US=...
MAGENTO_ACCESS_TOKEN_SECRET_US=...

MAGENTO_BASE_URL_EU=https://eu.store.com
MAGENTO_CONSUMER_KEY_EU=...
...

All scripts accept --site \x3Calias> to target a specific store. When omitted, the default (unsuffixed) credentials are used.

python3 orders.py list --site us --limit 10
python3 system.py sites            # list all configured sites

Optional env vars

  • MAGENTO_TIMEOUT — Default is 30 seconds. Supports per-site override: MAGENTO_TIMEOUT_US.
  • MAGENTO_DEBUG — Set to 1 to enable verbose logging to stderr.

All scripts import the shared client from scripts/magento_client.py. Never construct raw HTTP requests inline — always use the client.

Available commands

Run scripts with: python3 \x3Cskill_dir>/scripts/\x3Cscript>.py [args]

Orders — scripts/orders.py

# List recent orders (default: last 20)
python3 orders.py list [--limit N] [--status pending|processing|complete|canceled|closed|holded|payment_review]

# Get a single order
python3 orders.py get \x3Corder_id>

# Update order status
python3 orders.py update-status \x3Corder_id> \x3Cstatus>

# Cancel an order
python3 orders.py cancel \x3Corder_id>

# Ship an order (optional: add tracking number and carrier)
python3 orders.py ship \x3Corder_id> [--track N] [--carrier carrier_code] [--title title]

# Invoice an order
python3 orders.py invoice \x3Corder_id>

Catalog — scripts/catalog.py

# Search products
python3 catalog.py search \x3Cquery> [--limit N]

# Get product by SKU
python3 catalog.py get \x3Csku>

# Update product price
python3 catalog.py update-price \x3Csku> \x3Cprice>

# Update product name / description
python3 catalog.py update-attribute \x3Csku> \x3Cattribute> \x3Cvalue>

# Enable or disable a product
python3 catalog.py update-status \x3Csku> {enabled|disabled}

# Delete a product
python3 catalog.py delete \x3Csku>

# List categories
python3 catalog.py categories

Customers — scripts/customers.py

# Search customers by email or name
python3 customers.py search \x3Cquery> [--limit N]

# Get customer by ID
python3 customers.py get \x3Ccustomer_id>

# Get customer orders
python3 customers.py orders \x3Ccustomer_id>

# Update customer group
python3 customers.py update-group \x3Ccustomer_id> \x3Cgroup_id>

Inventory — scripts/inventory.py

# Check stock for a SKU
python3 inventory.py check \x3Csku>

# Update stock quantity
python3 inventory.py update \x3Csku> \x3Cqty>

# List low-stock products (below threshold)
python3 inventory.py low-stock [--threshold N]

# Bulk stock check from a comma-separated SKU list
python3 inventory.py bulk-check \x3Csku1,sku2,...>

Multi-Source Inventory (MSI)

Requires Magento 2.3+ with Inventory modules enabled.

# List inventory sources (warehouses)
python3 inventory.py sources [--limit N]

# Get details for a specific source
python3 inventory.py source-get \x3Csource_code>

# List source items (stock per source) — filter by SKU, source, or both
python3 inventory.py source-items --sku \x3Csku> [--source \x3Csource_code>] [--limit N]

# Update quantity for a SKU at a specific source
python3 inventory.py source-item-update \x3Csku> \x3Csource_code> \x3Cqty>

# Get salable quantity for a SKU in a stock
python3 inventory.py salable-qty \x3Csku> \x3Cstock_id>

# Check if a product is salable in a stock
python3 inventory.py is-salable \x3Csku> \x3Cstock_id>

# List inventory stocks (logical groupings)
python3 inventory.py stocks [--limit N]

Promotions — scripts/promotions.py

# List active cart price rules
python3 promotions.py list [--active-only]

# Get a rule by ID
python3 promotions.py get \x3Crule_id>

# Create a coupon code for an existing rule
python3 promotions.py create-coupon \x3Crule_id> \x3Ccode> [--uses N]

# Disable a promotion rule
python3 promotions.py disable \x3Crule_id>

# List coupon usage stats
python3 promotions.py coupon-stats \x3Ccoupon_code>

Reporting — scripts/reports.py

# Sales summary for a date range
python3 reports.py sales --from YYYY-MM-DD --to YYYY-MM-DD

# Revenue by product (top N)
python3 reports.py top-products [--limit N] [--from YYYY-MM-DD] [--to YYYY-MM-DD]

# Revenue by customer (top N)
python3 reports.py top-customers [--limit N] [--from YYYY-MM-DD] [--to YYYY-MM-DD]

# Order status breakdown
python3 reports.py order-status [--from YYYY-MM-DD] [--to YYYY-MM-DD]

# Inventory value report
python3 reports.py inventory-value

System & Discovery — scripts/system.py

# Check API connection status
python3 system.py status

# List installed modules
python3 system.py modules

# Inspect REST schema
python3 system.py schema

# List all configured sites
python3 system.py sites

# Cache management
python3 system.py cache-list
python3 system.py cache-flush [--types ID1,ID2]

Custom API — scripts/custom_api.py

Use this for interacting with discovered custom endpoints.

# Call custom endpoints (e.g. blog module)
python3 custom_api.py GET \x3Cpath> [--params '{"key": "value"}']
python3 custom_api.py POST \x3Cpath> --data '{"body": "json"}'

Morning Brief — scripts/morning_brief.py

Generate a daily store health summary across sales, orders, inventory, promotions, and customers.

# Generate morning brief (default: last 24 hours)
python3 morning_brief.py brief [--site SITE] [--hours 24] [--stock-threshold 10]

# JSON output for programmatic consumption
python3 morning_brief.py brief --format json

Diagnostics — scripts/diagnose.py

Deep-dive analysis for specific store issues.

# Inventory risk radar with velocity-based stockout prediction
python3 diagnose.py inventory-risk [--days 7] [--threshold 10] [--limit 50]

# Audit promotions for expired rules, missing coupons, exhausted limits
python3 diagnose.py promotion-audit [--warn-hours 48]

# Find stuck orders (pending too long, payment review, processing delay)
python3 diagnose.py order-exceptions [--pending-hours 24] [--processing-hours 48]

# Detect pricing anomalies (zero price, negative price, inverted specials)
python3 diagnose.py pricing-anomaly [--limit 50]

# JSON output available for all subcommands
python3 diagnose.py inventory-risk --format json

Bulk Operations

Batch update prices, stock, and shipments via CSV or inline input.

# Bulk update prices (preview mode)
python3 catalog.py bulk-update-price --items "SKU1:29.99,SKU2:49.99"
python3 catalog.py bulk-update-price --csv prices.csv

# Execute bulk price changes
python3 catalog.py bulk-update-price --csv prices.csv --execute

# Bulk update stock
python3 inventory.py bulk-update --items "SKU1:100,SKU2:50"
python3 inventory.py bulk-update --csv stock.csv --execute

# Bulk ship orders
python3 orders.py bulk-ship --csv shipments.csv --execute

Output format

All scripts print a UTF-8 table (via tabulate) or a JSON summary to stdout. When presenting results to the user, render them as a markdown table. For single-record lookups, format as a definition list.

Error handling

Scripts exit with code 1 on API errors and print a JSON error to stderr:

{ "error": "404 Not Found", "message": "No such entity with id = 99", "url": "..." }

If a script fails, read stderr, extract the message field, and tell the user plainly what went wrong. Do not retry automatically unless the user asks.

Rules

  • Never expose OAuth credentials in chat output, logs, or summaries.
  • For any write operation (cancel, delete, update-price, update-status, update-group, cache-flush, ship, invoice, create-coupon, disable, source-item-update, and all POST/PUT/DELETE via custom_api.py), always repeat the full command back to the user and wait for explicit confirmation before executing.
  • Read-only operations (list, get, search, check, status, modules, schema, cache-list, reports) may be executed directly without confirmation.
  • When a date range is not specified for reports, default to the last 30 days.
  • Monetary values are returned in the store's base currency — include the currency code in output.
  • Multi-site: When multiple sites are configured, always confirm which site the user intends before executing write operations. Use system.py sites to discover available sites.
  • Production Safety: After performing updates to products or prices, it is recommended to run system.py cache-flush if the changes don't appear on the frontend.
  • Morning Brief and diagnose commands are read-only — they may be executed directly without confirmation.
  • After generating a morning brief, proactively recommend relevant diagnose.py subcommands based on the findings.
  • Bulk operations: Always preview first (default), then require --execute flag and explicit user confirmation. Follow preview templates in references/workflows.md.
  • Scenarios: For detailed routing guidance, see references/workflows.md.
安全使用建议
This skill appears to do what it says: it needs full Magento API credentials and will be able to read and change store data (prices, products, orders, promotions, caches). Before installing: 1) only provide credentials that have the minimum permissions needed (consider a read-only token for reporting/inspection tasks and a separate write-scoped token for change operations); 2) test in a staging store first; 3) confirm what your platform's 'uv' installer does and review the install step, since requirements.txt includes a linter (ruff) not needed at runtime; 4) be aware scripts include a generic custom_api endpoint that can call arbitrary REST paths on your store — treat credentials as sensitive and rotate them if exposed. If you want extra assurance, review the omitted/large files (diagnose.py, reports, etc.) or run the skill in an isolated environment before granting production credentials.
功能分析
Type: OpenClaw Skill Name: magento2 Version: 1.3.1 The magento2 skill bundle is a comprehensive and well-structured toolset for managing Magento 2 / Adobe Commerce stores via REST API. It includes scripts for handling orders, catalog management, customer data, inventory, and detailed store diagnostics (e.g., `diagnose.py` and `morning_brief.py`). The bundle demonstrates strong security awareness by explicitly instructing the AI agent to never expose OAuth credentials, requiring user confirmation for all write operations (POST/PUT/DELETE), and providing a 'preview' mode for bulk updates. The code uses standard Python libraries (requests, pandas, tabulate) and follows safe practices, such as sanitizing SKU path segments in `magento_client.py` to prevent API path traversal.
能力评估
Purpose & Capability
Name/description match the code and env vars: the skill implements a full Magento 2 REST client and command-line scripts for orders, catalog, customers, inventory, promotions, and reporting. The required env vars are Magento OAuth credentials and base URL, which are appropriate for this purpose.
Instruction Scope
Runtime instructions and scripts only call the Magento REST API and reference expected Magento config/env vars. However, many scripts perform state-changing actions (delete product, update prices, cancel/ship/invoice orders, clear caches, create/disable promotions). The SKILL.md warns credentials come from env vars; the code enforces that. Also a minor mismatch: scripts use OPENCLAW_DELAY_MS though it is not documented in the SKILL.md optional env list.
Install Mechanism
Install spec uses 'uv' to install Python packages (requests, requests-oauthlib, pandas, tabulate). That aligns with requirements in code. requirements.txt additionally lists 'ruff' (a linter) which is unnecessary for runtime — a small inconsistency. 'uv' as an install kind is uncommon (but not inherently malicious); confirm your platform's 'uv' implementation before installing.
Credentials
All required environment variables are Magento-specific (base URL and OAuth keys/tokens), which is proportionate. No unrelated credentials are requested. Note: multiple per-site env conventions are supported; the skill will read any MAGENTO_BASE_URL_<SITE> keys present. Also uses optional MAGENTO_TIMEOUT, MAGENTO_DEBUG and OPENCLAW_DELAY_MS (the latter is used but not documented as optional).
Persistence & Privilege
always is false and the skill does not request permanent system-wide privileges. It does modify Magento store state through the API (intended behavior) but does not attempt to change agent/system config.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install magento2
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /magento2 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.3.1
No file changes detected in this version. - No updates or modifications were made to the codebase or documentation. - Version number incremented without additional changes. - Behavior and features remain identical to the previous release.
v1.3.0
**Expanded diagnostics and health monitoring for Magento 2.** - Added new scripts: `morning_brief.py` for daily store health summaries and `diagnose.py` for advanced diagnostics. - Introduced documentation files `references/diagnostics.md` and `references/workflows.md`. - New high-level commands for inventory risk, promotion audits, order exceptions, and pricing anomaly detection. - "Morning Brief" aggregates key sales, inventory, promotion, and customer insights. - All new functions are documented and support JSON output for integrations.
v1.2.0
Version 1.2.0 — Adds multi-site support and MSI commands - Added support for managing multiple Magento stores via environment variable suffixes and `--site` option. - Introduced new commands for Multi-Source Inventory (MSI), including source and stock management. - All scripts now allow targeting specific sites; `system.py sites` lists all configured. - Updated documentation: API reference moved to references/api-reference.md. - Requirements now listed in requirements.txt.
v1.1.0
**Expanded Magento 2 skill to support discovery of custom modules and arbitrary API calls.** - Added scripts/custom_api.py for calling custom REST endpoints (GET/POST) on Magento 2. - Extended documentation to cover discovery of installed modules and REST schema via system.py. - Updated description to reflect support for interacting with custom modules (e.g. blog endpoints). - New commands: list installed modules, inspect REST schema, and make generic API requests. - All existing commands and authentication requirements remain unchanged.
v1.0.0
Initial release of Magento 2 skill for REST API store management. - Manage orders, catalog, customers, inventory, promotions, and sales reports via CLI scripts - Supports authenticated connection to Magento 2 / Adobe Commerce using OAuth 1.0a - Comprehensive command suite for common store operations (see documentation for full list) - Outputs data as markdown tables or definition lists, handles API errors with clear messages - Includes production safety guidance and best practices for destructive operations
元数据
Slug magento2
版本 1.3.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 5
常见问题

Magento 2 Skill 是什么?

Manage a Magento 2 / Adobe Commerce store via REST API. Use for orders, catalog, customers, inventory, promotions, and sales reporting. It can also discover... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 189 次。

如何安装 Magento 2 Skill?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install magento2」即可一键安装,无需额外配置。

Magento 2 Skill 是免费的吗?

是的,Magento 2 Skill 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Magento 2 Skill 支持哪些平台?

Magento 2 Skill 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Magento 2 Skill?

由 Caravan Of Glory(@caravanglory)开发并维护,当前版本 v1.3.1。

💬 留言讨论