← 返回 Skills 市场
druyang

Target Shopping

作者 druyang · GitHub ↗ · v0.1.1 · MIT-0
cross-platform ✓ 安全检测通过
69
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install target-shopping
功能描述
Search Target.com, look up products, check per-store stock and pickup ETAs near a ZIP, and build a deep link that pre-populates a guest cart. Read-only brows...
使用说明 (SKILL.md)

target-com-shopper

Browse Target.com from the assistant. Wraps a handful of Target's public-facing JSON endpoints (the same ones target.com itself loads) and one local URL builder that pre-populates a guest cart in the user's browser.

Disclaimers & limitations

Unofficial. Not affiliated with, endorsed by, or sponsored by Target Corporation. "Target" and the Target bullseye are trademarks of Target Brands, Inc.; they are used here only to describe the service this skill talks to.

Public web endpoints, not a stable API. The skill calls Target's public-facing web API (the same JSON endpoints target.com itself loads in your browser) and carts.target.com. These are not a documented public API. Field shapes, auth keys, throttling, and even endpoint availability can change without notice; expect breakage and pin the version you tested against.

No warranty on prices, stock, or pickup ETAs. Results are point-in-time snapshots of what the API returned. Prices and availability change constantly and may differ from what the user actually sees at checkout. Always direct the user to buy_url for the source of truth before they commit to a purchase.

Personal / light use only. Single-shot lookups for a real shopping task, not bulk scraping, competitive price monitoring, or inventory mirroring. The in-script throttle (TARGET_MIN_INTERVAL, default 1s) is the floor — do not lower it. See references/tos-and-etiquette.md.

The cart-link feature creates a real server-side guest cart. It mints a 24-hour anonymous bearer token against gsp.target.com and POSTs TCINs to carts.target.com. Treat the resulting URL like a one-time share link: it grants ~24h of cart-write access to whoever holds it. No login, payment info, or shipping address is ever transmitted.

No checkout, payment, or auth. Checkout, returns, saved carts, Circle deals tied to an account, and order history are out of scope and will stay out of scope. If you need any of those, open target.com in a browser.

When to use

  • "Search Target for X."
  • "What's the price / rating / spec on Target product \x3CTCIN or URL>?"
  • "Is this in stock near ZIP \x3Cz>? When can I pick it up?"
  • "Find Target stores near me."
  • "Build me a Target cart link for these items."

When NOT to use

  • Anything requiring login (saved carts, Circle deals tied to account, order history, returns, gift registry edits). This skill is read-only and intentionally unauthenticated.
  • Checkout, payment, or shipping addresses. The skill builds a cart URL the user opens in their own browser; everything from there is on them.
  • Bulk scraping or price monitoring. See references/tos-and-etiquette.md.

Setup (once)

The skill ships as a uv project under its own directory. From the skill root (~/.openclaw/workspace/skills/target-com-shopper/ at runtime):

uv sync

That's it — runtime is stdlib-only; uv is just used for the venv and to run scripts reproducibly.

Discover the user's store first

store_id shapes every product/price/fulfillment response. Ask the user for their ZIP code (or city) before calling product endpoints, then look up nearby stores:

uv run python -m scripts.stores 55403 --limit 5

Pick a store_id from the results and pass it as --store-id to search, pdp, and summary. (Or set TARGET_DEFAULT_STORE_ID in the environment for the session.) If the user truly doesn't care about location, the default store (2281, San Jose Central) is fine for keyword search and PDP, but not for accurate "in stock today" answers.

Common tasks

Search

uv run python -m scripts.search "wireless earbuds" --count 10 --store-id 1375
uv run python -m scripts.search --category 5xteg --count 10
uv run python -m scripts.search "chicken breast" --category 4tgi7   # keyword AND category

--raw returns the full API payload. Default trims to tcin, title, brand, price, rating, buy_url, image.

Fresh-grocery searches: generic keyword search drowns fresh items in shelf-stable hits (e.g. "chicken breast" returns canned chicken first). Combine the keyword with a category N-ID to scope — see references/categories.md for the curated list of common N-IDs (Fresh Chicken, Fresh Produce, Herbs & Spices, etc.).

Building a multi-item shopping list? The skill has no batched search endpoint — plp_search_v2 accepts one query at a time. Fire individual scripts.search calls in parallel from the agent runtime; the in-script TARGET_MIN_INTERVAL throttle (default 1s) protects the upstream. For a 6-item list expect ~6 seconds wall time. Do not lower TARGET_MIN_INTERVAL below 0.5s — see references/tos-and-etiquette.md.

Product detail

uv run python -m scripts.pdp 89827259 --store-id 1375

Returns title, brand, price, bullets, images, promotions, variant TCINs.

Multi-product fulfillment summary

For a shortlist (e.g. comparing 3–5 candidates) use summary instead of calling pdp N times — one round trip:

uv run python -m scripts.summary 89827259 94783927 --zip 55403 --store-id 1375

Note: summary does not return price. Combine with pdp if needed.

Per-store stock & pickup ETA

uv run python -m scripts.fulfillment 89827259 --zip 55403 --radius 25 --only-available

Find nearby stores

uv run python -m scripts.stores "Minneapolis, MN" --limit 5
uv run python -m scripts.stores 55403 --within 25

Build a cart deep link

This actually pre-populates the recipient's cart. Behind the scenes the script mints a 24h anonymous guest token (gsp.target.com), creates a real server-side cart by POSTing each TCIN to carts.target.com, writes a local HTML redirect file, and tries to launch the user's default browser at:

https://www.target.com/cart?access_token=\x3CTOKEN>

When the browser opens it, target.com merges the items into the session cart and lands on /cart. No login required.

uv run python -m scripts.cart_link 89827259 94783927 --quantities 1 2
uv run python -m scripts.cart_link 89827259                 # qty defaults to 1
uv run python -m scripts.cart_link 111 222 333 --quantities 2  # qty=2 for all
uv run python -m scripts.cart_link 89827259 --refresh-token    # force new token
uv run python -m scripts.cart_link 89827259 --no-open          # just write the file
uv run python -m scripts.cart_link 89827259 --cart-file ~/Downloads/cart.html

CRITICAL — DO NOT inline the url field into your chat reply. The token is ~600 characters. Most chat UIs truncate URLs of that length, which silently breaks the cart handoff (the recipient lands on /cart with an invalid access_token and an empty basket). Always hand off via:

  1. auto_opened: true — the script already launched the user's browser; just confirm in the reply.
  2. cart_file — short local path (e.g. /tmp/target-com-shopper/cart-XXX.html). Tell the user to open that file if the browser didn't launch.
  3. shopping_list_markdown — clickable per-item PDP links as a fallback, in case the auto-merge fails. Each link is short and click-safe.

The skill emits url_preview (truncated for logging) and url_length so you can see at a glance how oversized the raw URL is. The full url stays in the output for programmatic callers, but treat it as private.

Treat the URL like a one-time share link. It contains a bearer token that grants ~24h of cart-write access. Do not commit it, do not paste it into long-lived chat history. The skill caches the token under $TMPDIR/target-com-shopper/anonymous-token.json (mode 0600) and reuses it across calls until ~10 min before expiry.

Output JSON includes cart_file, auto_opened, cart_id, guest_id, total_cart_item_quantity, items_added (with per-item title, unit_price, current_price), items_failed, shopping_list_markdown, shopping_list_text, token_expires_in_hours, url_length, url_preview, url_warning, and url. If any TCIN fails to add, it appears under items_failed and the script exits 2.

Reviews

uv run python -m scripts.reviews 89827259

Returns the review count and average rating only. Full review text is not exposed by product_review_v1 — point the user at buy_url to read reviews on target.com.

Environment variables

Var Default Purpose
TARGET_API_KEY baked-in public key Override if Target rotates the public web key. Not a secret.
TARGET_DEFAULT_STORE_ID 2281 Fallback store when --store-id is omitted.
TARGET_USER_AGENT target-com-shopper-skill/0.1 ... UA string sent on every request.
TARGET_HTTP_TIMEOUT 10 Seconds.
TARGET_MIN_INTERVAL 1.0 Minimum seconds between requests (politeness throttle).
TARGET_LIVE_TESTS unset Set to 1 to enable live-network tests.

Tests

uv run pytest                           # offline only (default)
TARGET_LIVE_TESTS=1 uv run pytest -m live -v   # hit the real API

References

  • references/endpoints.md — every API operation used, required params, field-path gotchas.
  • references/categories.md — curated Target category N-IDs (grocery, fresh meat, produce, spices, etc.) for use with scripts.search --category.
  • references/status-codes.md — what 206/400/410/429/5xx mean here.
  • references/tos-and-etiquette.md — be a polite client.
安全使用建议
Before installing, be comfortable with an unofficial Target integration that calls Target web endpoints and can create a short-lived anonymous guest cart. Use it for user-directed shopping lookups, avoid sharing full cart URLs, and confirm prices and availability on Target.com before buying.
功能分析
Type: OpenClaw Skill Name: target-shopping Version: 0.1.1 The target-com-shopper skill is a well-documented and transparent tool for searching Target.com and generating guest cart links. It uses Python's standard library (urllib) for network requests, implements a mandatory 1-second throttle for API etiquette, and follows security best practices such as setting restrictive file permissions (0600) on cached anonymous tokens in scripts/_auth.py and using html.escape to prevent injection in generated redirect files in scripts/cart_link.py. No evidence of data exfiltration, malicious execution, or harmful prompt injection was found; all network activity is directed at legitimate Target domains (redsky.target.com, gsp.target.com, and carts.target.com).
能力标签
cryptocan-make-purchasesrequires-oauth-tokenrequires-sensitive-credentials
能力评估
Purpose & Capability
The product search, stock lookup, store lookup, and guest-cart-link behavior all match the stated shopping purpose. The cart feature is a real server-side guest cart mutation, not checkout or payment.
Instruction Scope
Instructions generally keep use scoped to user-directed shopping tasks, ZIP/store-specific lookup, and light personal use. One reference document inconsistently says all calls are GET-only, while the main docs and code disclose POST-based cart creation.
Install Mechanism
Setup uses `uv sync` for a local Python project with no runtime dependencies declared and no install script or remote bootstrap shown.
Credentials
The skill makes network calls to Target public web endpoints and may use ZIP/city, store IDs, TCINs, and optional environment overrides. It does not require Target login credentials, payment data, or user account cookies.
Persistence & Privilege
The cart flow caches an anonymous bearer token and writes a local HTML redirect file containing a cart access token. The code warns that the link grants cart-write access for about 24 hours and sets token-cache file permissions to 0600.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install target-shopping
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /target-shopping 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.1
- Initial public release of the Target.com shopping skill (target-com-shopper). - Search for products, look up details, and check per-store stock and pickup ETAs by ZIP code. - Build deep links that pre-populate a guest cart; supports multiple items and specific quantities. - Browse Target.com data without requiring login or checkout—read-only with unauthenticated guest-cart builder. - Emphasizes privacy, responsible use, and limitations: unofficial, no guarantee of price/availability, no checkout or order history. - Includes CLI scripts for searching, store lookup, product details, fulfillment, and cart link creation.
v0.1.0
Initial release of target-com-shopper, a skill for browsing Target.com, checking stock and prices, and building guest cart links. - Search for products on Target.com and view detailed product info. - Check local store stock and pickup ETAs near a ZIP code. - List Target stores nearby by ZIP code or city. - Build a sharable cart deep link (no login or checkout). - Read-only, unauthenticated browsing and guest cart creation. No payment or account actions.
元数据
Slug target-shopping
版本 0.1.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

Target Shopping 是什么?

Search Target.com, look up products, check per-store stock and pickup ETAs near a ZIP, and build a deep link that pre-populates a guest cart. Read-only brows... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 69 次。

如何安装 Target Shopping?

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

Target Shopping 是免费的吗?

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

Target Shopping 支持哪些平台?

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

谁开发了 Target Shopping?

由 druyang(@druyang)开发并维护,当前版本 v0.1.1。

💬 留言讨论