Token导航 LogoToken导航

Agent Skill · 研究检索

b2c-querying-data(B2C 查询数据)

用于辅助数据整理、表格处理、CSV/Excel 分析、指标计算和图表准备。它适合让 Agent 清洗字段、汇总数据、发现异常、生成统计口径或把分析结果转成可读说明。使用时需要确认数据来源、字段含义和时间范围,避免把样本数据当全量事实;涉及敏感数据、导出文件或批量写回时,应先确认权限和脱敏边界。

b2c-querying-data 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 37,302。

总安装 1,763周安装 72GitHub Stars 38下载 564核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:b2c-querying-data(B2C 查询数据)
来源仓库:https://github.com/salesforcecommercecloud/b2c-developer-tooling
仓库路径:skills/b2c-querying-data
安装命令:
npx skills add https://github.com/salesforcecommercecloud/b2c-developer-tooling --skill b2c-querying-data
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/salesforcecommercecloud/b2c-developer-tooling --skill b2c-querying-data

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于高效查询 B2C Commerce 中的产品、订单和客户数据。推荐使用 ProductSearchModel 进行索引 backed 搜索,保障高并发性能。支持分类筛选、排序规则和可订购商品过滤等常用操作。安装需使用 npx skills add 命令从指定 GitHub 仓库添加技能。

复杂查询应考虑分页机制,防止单次请求负载过高。

来源仓库内路径:skills/b2c-querying-data

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/salesforcecommercecloud/b2c-developer-tooling…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

b2c-querying-data 怎么安装?

在终端执行 npx skills add https://github.com/salesforcecommercecloud/b2c-developer-tooling --skill b2…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

b2c-querying-data 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

b2c-querying-data 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

b2c-querying-data 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

b2c-querying-data 用的人多吗?

公开数据是累计安装 1,763 次,近一周安装 72 次,下载 564 次,GitHub 38 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

b2c-querying-data 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
b2c-querying-data

B2C 查询数据 · 本页

1,76338需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Querying Data in B2C Commerce

Efficient data querying is critical for storefront performance and job stability. B2C Commerce provides index-backed search APIs and database query APIs—choosing the right one for each use case avoids performance problems.

Product Search (Storefront)

Use ProductSearchModel for all storefront product searches. It is index-backed and designed for high-traffic pages.

Basic Product Search

var ProductSearchModel = require('dw/catalog/ProductSearchModel');

var psm = new ProductSearchModel();
psm.setCategoryID('electronics');
psm.setOrderableProductsOnly(true); // Only in-stock products
psm.setSearchPhrase('laptop');
psm.search();

var hits = psm.getProductSearchHits();
while (hits.hasNext()) {
    var hit = hits.next();
    var productID = hit.productID;
    var minPrice = hit.minPrice;
    var maxPrice = hit.maxPrice;
}
hits.close();

Paging Search Results

Always page results—never load the full result set:

var ProductSearchModel = require('dw/catalog/ProductSearchModel');
var PagingModel = require('dw/web/PagingModel');

var psm = new ProductSearchModel();
psm.setCategoryID('mens-clothing');
psm.setOrderableProductsOnly(true);
psm.search();

var pagingModel = new PagingModel(psm.getProductSearchHits(), psm.count);
pagingModel.setPageSize(12);
pagingModel.setStart(0); // page offset

var pageElements = pagingModel.pageElements;
while (pageElements.hasNext()) {
    var hit = pageElements.next();
    // Render product tile
}

Getting Variation Data from Search Hits

Use ProductSearchHit methods instead of loading full product objects:

// GOOD: Get variation info from the search hit (index-backed)
var representedColors = hit.getRepresentedVariationValues('color');
var representedIDs = hit.getRepresentedProductIDs();
var minPrice = hit.getMinPrice();
var maxPrice = hit.getMaxPrice();

// BAD: Loading the full product and iterating variants (database-intensive)
var product = hit.product;
var variants = product.getVariants(); // Expensive!
var priceModel = product.getPriceModel(); // Expensive!

Search Refinements

var psm = new ProductSearchModel();
psm.setCategoryID('shoes');
psm.addRefinementValues('color', 'blue');
psm.addRefinementValues('size', '10');
psm.setPriceMin(50);
psm.setPriceMax(200);
psm.search();

// Get available refinement values for the current result set
var refinements = psm.getRefinements();
var colorValues = refinements.getNextLevelRefinementValues(
    refinements.getRefinementDefinitionByName('color')
);

ProductSearchModel API Summary

MethodDescription
search()Execute the search
setCategoryID(id)Filter by category
setSearchPhrase(phrase)Set search keywords
setOrderableProductsOnly(flag)Exclude out-of-stock
addRefinementValues(name, value)Add refinement filter
setPriceMin(price) / setPriceMax(price)Price range filter
setSortingRule(rule)Set sorting rule
getProductSearchHits()Get result iterator
getRefinements()Get available refinements
countTotal result count

Order Queries

OrderMgr.searchOrders / queryOrders

Use searchOrders for index-backed order lookups and queryOrders for database queries:

var OrderMgr = require('dw/order/OrderMgr');
var Order = require('dw/order/Order');

// Index-backed search (preferred for common lookups)
var orders = OrderMgr.searchOrders(
    'customerEmail = {0} AND status != {1}',
    'creationDate desc',
    'customer@example.com',
    Order.ORDER_STATUS_FAILED
);

while (orders.hasNext()) {
    var order = orders.next();
    // Process order
}
orders.close(); // Always close iterators

Query by Date Range

var OrderMgr = require('dw/order/OrderMgr');
var Calendar = require('dw/util/Calendar');
var Order = require('dw/order/Order');

var startDate = new Calendar();
startDate.add(Calendar.DAY_OF_YEAR, -7);

var orders = OrderMgr.searchOrders(
    'creationDate >= {0} AND status = {1}',
    'creationDate desc',
    startDate.time,
    Order.ORDER_STATUS_NEW
);

while (orders.hasNext()) {
    var order = orders.next();
    // Process
}
orders.close();

searchOrders vs queryOrders

AspectsearchOrdersqueryOrders
BackingSearch indexDatabase
PerformanceFast for indexed fieldsSlower, full table scan possible
Use whenQuerying indexed attributes (status, email, dates)Querying non-indexed or custom attributes
Result limitUp to 1000 hitsNo hard limit (but use paging)

Prefer searchOrders for storefront and high-traffic code paths. Use queryOrders only when you need to query attributes not available in the search index.

Customer / Profile Queries

CustomerMgr (Preferred)

Use searchProfiles for index-backed searches and processProfiles for batch processing in jobs:

var CustomerMgr = require('dw/customer/CustomerMgr');

// Index-backed search (storefront use)
var profiles = CustomerMgr.searchProfiles(
    'email = {0}',
    'lastLoginTime desc',
    'customer@example.com'
);

while (profiles.hasNext()) {
    var profile = profiles.next();
    // Process profile
}
profiles.close();

Batch Processing (Jobs)

Use processProfiles for jobs that need to iterate over many profiles—it has optimized memory management:

var CustomerMgr = require('dw/customer/CustomerMgr');

function processProfile(profile) {
    // Process each profile individually
    // Memory is managed automatically
}

// Process all profiles matching the query
CustomerMgr.processProfiles('gender = {0}', processProfile, 1);

Important: processProfiles replaces the older queryProfiles and SystemObjectMgr.querySystemObjects for customer data. It uses the full-text search service with better performance and memory characteristics.

Customer Query Behaviors

  • Wildcards (*, %, +) are filtered from queries and replaced by spaces
  • LIKE and ILIKE execute as full-text queries (match whole words, not substrings)
  • LIKE is case-insensitive
  • Combining AND and OR in the same query degrades performance
  • Range queries (e.g., a > b) impact performance
  • Results are limited to the first 1000 hits

System Object Queries (SystemObjectMgr)

For querying system objects other than customers (e.g., SitePreferences, catalogs):

var SystemObjectMgr = require('dw/object/SystemObjectMgr');

// Query system objects
var results = SystemObjectMgr.querySystemObjects(
    'Profile',
    'custom.loyaltyTier = {0}',
    'lastLoginTime desc',
    'Gold'
);

while (results.hasNext()) {
    var obj = results.next();
    // Process
}
results.close();

Note: For customer profiles specifically, prefer CustomerMgr.searchProfiles or CustomerMgr.processProfiles over SystemObjectMgr.querySystemObjects—they use the search index and perform significantly better.

Database-Intensive APIs to Avoid

These APIs hit the database directly and are expensive on high-traffic pages. Replace them with index-friendly alternatives. See Performance-Critical APIs for the complete list with impact details.

Avoid (Database-Intensive)Use Instead (Index-Friendly)
Category.getProducts() / getOnlineProducts()ProductSearchModel.setCategoryID()
ProductMgr.queryAllSiteProducts()ProductSearchModel.search()
Product.getVariants() / getVariationModel()ProductSearchHit methods
Product.getPriceModel() (in loops)ProductSearchHit.getMinPrice() / getMaxPrice()
CustomerMgr.queryProfiles()CustomerMgr.searchProfiles() or processProfiles()

Related Skills

Best Practices

Do

  • Always close iterators — unclosed iterators leak resources (results.close())
  • Page results — use PagingModel or limit result counts; never load unbounded result sets
  • Put all filtering in the query — don't post-process or filter results in custom code
  • Use index-backed APIs — ProductSearchModel, searchOrders, searchProfiles for storefront pages
  • Use processProfiles for batch customer operations in jobs (optimized memory)
  • Limit page size — maximum ~120 products per page for search result pages
  • Use setOrderableProductsOnly(true) — to filter unavailable products at the search level

Don't

  • Don't iterate over product variants on search result pages — use ProductSearchHit methods instead
  • Don't post-process search results — all criteria must go into the query for efficient execution
  • Don't use queryAllSiteProducts() on storefront pages — it bypasses the search index
  • Don't combine AND + OR in customer queries — it degrades performance
  • Don't rely on getting more than 1000 results — search APIs cap at 1000 hits
  • Don't call database-intensive APIs on high-traffic pages — category pages, search results, PDPs, and homepage

Job-Specific Guidelines

  • Use processProfiles over queryProfiles for large customer data sets
  • Design loop logic so memory consumption doesn't grow with result set size
  • Keep only the currently processed object in memory; don't retain references
  • Stream data to files regularly; don't build large structures in memory
  • Limit transaction size to under 1000 modified business objects

Detailed References

平台分布

Codex

32.31%
按下载量换算182

Claude

31.04%
按下载量换算175

Cursor

20.77%
按下载量换算117

Gemini CLI

10.06%
按下载量换算57

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills