# Commerce B2b Open Code Components Replace

Replace OOTB (out-of-the-box) B2B Commerce components with open source equivalents in...

- Repository: https://github.com/forcedotcom/sf-skills (1134 stars)
- Category: Engineering
- License: Apache-2.0
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add forcedotcom/sf-skills --skill commerce-b2b-open-code-components-replace -g -a claude-code -y`
Codex: `npx skills add forcedotcom/sf-skills --skill commerce-b2b-open-code-components-replace -g -a codex -y`
Cursor: `npx skills add forcedotcom/sf-skills --skill commerce-b2b-open-code-components-replace -g -a cursor -y`
Gemini CLI: `npx skills add forcedotcom/sf-skills --skill commerce-b2b-open-code-components-replace -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add forcedotcom/sf-skills`

## Description

Replace OOTB (out-of-the-box) B2B Commerce components with open source equivalents in site metadata content.json files, or look up the equivalent open code `site:` component for OOTB definitions. Use when users mention \"replace OOTB components\", \"replace commerce components with open code\", \"swap OOTB for open source\", \"replace commerce_builder:\", \"replace OOTB in site\", \"replace component in site metadata\", \"replace component definition\", \"find open code equivalent\", \"equivalent open code component\", \"OOTB to open code mapping\", \"what is the site component for\", components \"in this view\" or \"for a given view\", or a specific list of component names, and want to update or only discover mappings in their store metadata.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Replacing OOTB B2B Commerce Components with Open Code

This skill replaces OOTB (out-of-the-box) B2B Commerce component definitions in site metadata `content.json` files with their open source `site:` equivalents, or looks up the equivalent open code component for given OOTB definitions without making changes. It uses an authoritative mapping loaded from `assets/ootb-to-open-code-mapping.json`.

## Scope

**Modes:** **Full replace** runs the scan (Step 1), user selection if needed, then `content.json` updates (Step 2, 3). **Lookup only** (user asks for equivalents but not to change files): apply the mapping-authority rule and report OOTB → `site:` for the named components or for definitions found in the scoped `content.json`, **do not** call Write unless the user confirms replacement. **View-scoped** work: limit file discovery and reads to `sfdc_cms__view/<ViewName>/` (or the path the user gives) instead of all views.

---

## Prerequisites

### Resolve `<package-dir>`

Read `sfdx-project.json` and pick the active package directory. Extract `packageDirectories[]` and use the entry with `"default": true`; if no entry is flagged default, use the first entry. Use this value as `<package-dir>` everywhere below. If `sfdx-project.json` is missing or has no `packageDirectories`, tell the user and abort.

### Delegate setup

Before replacing components, delegate to the **commerce-b2b-open-code-components-integrate** skill to ensure:

1. Open source repository is cloned at `.tmp/b2b-commerce-open-source-components`
2. Store is selected and site metadata is retrieved locally
3. Open code components are copied to the store's site metadata

The integrating skill owns the `.tmp/` clone lifecycle (it prompts the user to reuse or re-clone an existing checkout); this skill assumes the clone is already present.

The rest: https://github.com/forcedotcom/sf-skills/blob/HEAD/plugins/builder/commerce-b2b/skills/commerce-b2b-open-code-components-replace/SKILL.md
