cli-command-development_skill

This skill helps you create and organize new B2C CLI commands and topics with structured templates for faster, reliable tooling.
  • TypeScript

20

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill salesforcecommercecloud/b2c-developer-tooling --skill cli-command-development

  • SKILL.md8.8 KB

Overview

This skill guides the creation of new CLI commands and topics for the B2C CLI using oclif and the B2C Tooling SDK. It explains command placement, class hierarchy, common flag patterns, table rendering, i18n, validation, client access, and error handling. The goal is to provide a repeatable template and checklist so new commands are consistent, testable, and JSON-friendly.

How this skill works

Commands are added as TypeScript files under packages/b2c-cli/src/commands, with the directory structure mapping directly to command names. Choose the appropriate base class from the B2C Tooling SDK (InstanceCommand, MrtCommand, OdsCommand, etc.) to get built-in validation, clients, and helpers. Follow the standard command template: define description, examples, args, flags, enable JSON output, implement run() with API calls and error handling, and use the provided table and i18n utilities for consistent output.

When to use it

  • Adding a new top-level command or nested topic for B2C CLI functionality
  • Implementing commands that interact with instances, WebDAV, OCAPI, MRT, or ODS APIs
  • Creating commands that must support both human and --json output
  • Standardizing flag behaviors, table output, and internationalized messages
  • Building commands that require credential or environment validation

Best practices

  • Place command files under packages/b2c-cli/src/commands mirroring the command namespace
  • Extend the most specific base class to reuse validation and client helpers
  • Set static enableJsonFlag = true and return structured objects for JSON mode
  • Use the t() i18n helper for all user-facing strings and follow keys commands.<topic>.<command>.<key>
  • Destructure response with error on API calls and use getApiErrorMessage for clean error text
  • Use TableRenderer.createTable and column defs for consistent, extendable tabular output

Example use cases

  • Add b2c code deploy to upload and activate a code version via OCAPI and WebDAV
  • Create b2c sandbox create to provision on-demand sandboxes via the ODS client
  • Implement b2c mrt env var set to manage MRT project environment variables
  • Build a b2c job run command that uses JobCommand helpers to trigger and poll jobs
  • Add a b2c site list command that renders site metadata with table columns and --extended

FAQ

Pick the most specific base class that provides the validation and clients you need (InstanceCommand for instance-level ops, MrtCommand for MRT API, OdsCommand for sandbox APIs). This avoids reimplementing credential checks and client initialization.

How should I handle errors from API calls?

Always destructure {data, error, response} and use getApiErrorMessage(error, response) to produce clear messages. Call this.error(...) for fatal errors or this.warn(...) for non-fatal issues.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational