Token导航 LogoToken导航TokenDH.com
开发敏感数据github未标认证来源可访问许可证需确认审计提醒

b2c-webservicesB2C 网络服务

Agent Skill

b2c-webservices 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,794

周安装

74

GitHub Stars

38

下载量

586
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

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

简介

b2c-webservices 提供基于 Service Framework 的 Web 服务集成指导,帮助在 B2C Commerce 中实现外部系统对接。

  • 适用于在 Codex、Claude、Cursor、Gemini CLI 中构建 REST API、处理认证授权或设计服务架构的场景。
  • 支持配置管理、限流熔断、日志记录和测试 Mock,提升服务可靠性和可观测性。
  • 安装方式:npx skills add https://github.com/salesforcecommercecloud/b2c-developer-tooling --skill b2c-webservices。
  • 使用前需确认权限范围、维护状态,并注意是否会触发联网、命令执行或文件读写操作。

SKILL.md

Web Services Skill

This skill guides you through implementing web service integrations in B2C Commerce using the Service Framework.

Overview

The Service Framework provides a structured way to call external services with:

FeatureDescription
ConfigurationService settings managed in Business Manager
Rate LimitingAutomatic throttling to protect external systems
Circuit BreakerAutomatic failure handling to prevent cascade failures
LoggingCommunication logging with sensitive data filtering
MockingTest services without external calls

Service Types

TypeUse CaseProtocol
HTTPREST APIs, webhooksHTTP/HTTPS
HTTPFormForm submissionsHTTP/HTTPS with form encoding
FTPFile transfers (deprecated)FTP
SFTPSecure file transfersSFTP
SOAPSOAP web servicesHTTP/HTTPS with SOAP
GENERICCustom protocolsAny

Service Framework Components

Business Manager Configuration

Services are configured in Administration > Operations > Services:

  1. Service Configuration - General settings (enabled, logging, callbacks)
  2. Service Profile - Rate limiting and circuit breaker settings
  3. Service Credential - URL and authentication credentials

Script Components

ComponentPurpose
LocalServiceRegistryCreates service instances
ServiceCallbackDefines request/response handling
ServiceBase service with common methods
ResultResponse object with status and data

Basic Pattern

'use strict';

var LocalServiceRegistry = require('dw/svc/LocalServiceRegistry');

var myService = LocalServiceRegistry.createService('my.service.id', {
    /**
     * Configure the request before it is sent
     * @param {dw.svc.HTTPService} svc - The service instance
     * @param {Object} params - Parameters passed to service.call()
     * @returns {string} Request body
     */
    createRequest: function (svc, params) {
        svc.setRequestMethod('POST');
        svc.addHeader('Content-Type', 'application/json');
        return JSON.stringify(params);
    },

    /**
     * Parse the response after a successful call
     * @param {dw.svc.HTTPService} svc - The service instance
     * @param {dw.net.HTTPClient} client - The HTTP client with response
     * @returns {Object} Parsed response
     */
    parseResponse: function (svc, client) {
        return JSON.parse(client.text);
    },

    /**
     * Filter sensitive data from logs (required for production)
     * @param {string} msg - The message to filter
     * @returns {string} Filtered message
     */
    filterLogMessage: function (msg) {
        return msg.replace(/("api_key"\s*:\s*")[^"]+"/g, '$1***"');
    }
});

// Call the service
var result = myService.call({ key: 'value' });

if (result.ok) {
    var data = result.object;
} else {
    var error = result.errorMessage;
}

Service Callbacks

CallbackRequiredDescription
createRequestYes*Configure request, return body
parseResponseYes*Parse response, return result object
executeNoCustom execution logic (replaces default)
initServiceClientNoCreate/configure underlying client
mockCallNoReturn mock response (execute phase only)
mockFullNoReturn mock response (entire call)
filterLogMessageRecommendedFilter sensitive data from logs
getRequestLogMessageNoCustom request log message
getResponseLogMessageNoCustom response log message

*Required unless execute is implemented

Result Object

The call() method returns a dw.svc.Result:

PropertyTypeDescription
okBooleanTrue if successful
statusString"OK", "ERROR", or "SERVICE_UNAVAILABLE"
objectObjectResponse from parseResponse
errorNumberError code (e.g., HTTP status)
errorMessageStringError description
unavailableReasonStringWhy service is unavailable
mockResultBooleanTrue if from mock callback

Unavailable Reasons

ReasonDescription
TIMEOUTCall timed out
RATE_LIMITEDRate limit exceeded
CIRCUIT_BROKENCircuit breaker open
DISABLEDService disabled
CONFIG_PROBLEMConfiguration error

Error Handling

var result = myService.call(params);

if (result.ok) {
    return result.object;
}

// Handle different error types
switch (result.status) {
    case 'SERVICE_UNAVAILABLE':
        switch (result.unavailableReason) {
            case 'RATE_LIMITED':
                // Retry later
                break;
            case 'CIRCUIT_BROKEN':
                // Service is down, use fallback
                break;
            case 'TIMEOUT':
                // Request timed out
                break;
        }
        break;
    case 'ERROR':
        // Check HTTP status code
        if (result.error === 401) {
            // Authentication error
        } else if (result.error === 404) {
            // Resource not found
        }
        break;
}

throw new Error('Service error: ' + result.errorMessage);

Log Filtering

Production environments require log filtering to prevent sensitive data exposure:

var myService = LocalServiceRegistry.createService('my.service', {
    createRequest: function (svc, params) {
        // ... configure request
    },

    parseResponse: function (svc, client) {
        return JSON.parse(client.text);
    },

    /**
     * Filter sensitive data from all log messages
     */
    filterLogMessage: function (msg) {
        // Filter API keys
        msg = msg.replace(/api_key=[^&]+/g, 'api_key=***');
        // Filter authorization headers
        msg = msg.replace(/Authorization:\s*[^\r\n]+/gi, 'Authorization: ***');
        // Filter passwords in JSON
        msg = msg.replace(/("password"\s*:\s*")[^"]+"/g, '$1***"');
        return msg;
    },

    /**
     * Custom request log message (optional)
     */
    getRequestLogMessage: function (request) {
        // Return custom message or null for default
        return 'Request: ' + request.substring(0, 100) + '...';
    },

    /**
     * Custom response log message (optional)
     */
    getResponseLogMessage: function (response) {
        // Return custom message or null for default
        return 'Response received';
    }
});

Mocking Services

Use mock callbacks for testing without external calls:

var myService = LocalServiceRegistry.createService('my.service', {
    createRequest: function (svc, params) {
        svc.setRequestMethod('GET');
        svc.addParam('id', params.id);
        return null;
    },

    parseResponse: function (svc, client) {
        return JSON.parse(client.text);
    },

    /**
     * Mock the execute phase only (createRequest and parseResponse still run)
     */
    mockCall: function (svc, request) {
        return {
            statusCode: 200,
            text: JSON.stringify({ id: 1, name: 'Mock Data' })
        };
    },

    /**
     * Or mock the entire call (replaces all phases)
     */
    mockFull: function (svc, params) {
        return { id: params.id, name: 'Full Mock Data' };
    }
});

// Force mock mode
myService.setMock();
var result = myService.call({ id: 123 });

Service Configuration in Business Manager

Creating a Service

  1. Go to Administration > Operations > Services
  2. Click New under Service Configurations
  3. Fill in:

- Service ID: Unique identifier (e.g., my.api.service) - Service Type: HTTP, FTP, SOAP, etc. - Enabled: Check to enable - Profile: Select or create a profile - Credential: Select or create credentials - Communication Log: Enable for debugging

Service Profile Settings

SettingDescription
TimeoutMaximum wait time in milliseconds
Rate LimitMaximum calls per time unit
Circuit Breaker EnabledEnable automatic failure handling
Max Circuit Breaker CallsCalls before circuit opens
Circuit Breaker IntervalTime window for tracking failures

Service Credential Settings

SettingDescription
IDCredential identifier
URLBase URL for the service
UserUsername for authentication
PasswordPassword for authentication

Detailed References

Script API Classes

ClassDescription
dw.svc.LocalServiceRegistryCreate service instances
dw.svc.ServiceBase service class
dw.svc.HTTPServiceHTTP service methods
dw.svc.FTPServiceFTP/SFTP service methods
dw.svc.SOAPServiceSOAP service methods
dw.svc.ResultService call result
dw.svc.ServiceConfigService configuration
dw.svc.ServiceProfileRate limit/circuit breaker config
dw.svc.ServiceCredentialAuthentication credentials
dw.net.HTTPClientUnderlying HTTP client
dw.net.FTPClientUnderlying FTP client
dw.net.SFTPClientUnderlying SFTP client

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.34%
按下载量换算219

Claude

29.56%
按下载量换算173

Cursor

16.48%
按下载量换算97

Gemini CLI

10.02%
按下载量换算59

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills