
Integrating B2b Commerce Open Code Components
Copy Salesforce B2B Commerce open-source Experience Builder components from GitHub into your store metadata so they appear in the builder palette.
Install
npx skills add https://github.com/forcedotcom/sf-skills --skill integrating-b2b-commerce-open-code-componentsWhat is this skill?
- Integrates all components from forcedotcom/b2b-commerce-open-source-components
- Copies components and labels into B2B Commerce store site metadata
- Makes open components available in Experience Builder after copy
- Requires explaining each git clone and cp step before execution
- Uses Bash git clone and file copy with Read for guided storefront setup
Adoption & trust: 265 installs on skills.sh; 513 GitHub stars; 2/3 security scanners passed (skills.sh audits).
Recommended Skills
Journey fit
The skill is a one-shot integration task—clone official OSS components and copy site metadata—so it belongs on the Build integrations shelf. Integrations subphase reflects wiring external Salesforce GitHub assets into an existing B2B Commerce store, not greenfield frontend from scratch.
Common Questions / FAQ
Is Integrating B2b Commerce Open Code Components safe to install?
skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Integrating B2b Commerce Open Code Components
## When to Use This Skill Use this skill when you need to: - Integrate all open source B2B Commerce components into a store - Add open source components to a new or existing B2B Commerce store - Make open code components available in Experience Builder ## Rules 1. **Always explain before executing.** Before running any command, you MUST tell the user what the command does and why you are running it. Never just show a raw command and ask for permission. The user should be able to read your explanation and understand the purpose before approving. ## Overview This skill copies all open source B2B Commerce components from the official Salesforce repository (https://github.com/forcedotcom/b2b-commerce-open-source-components) into a B2B Commerce store's site metadata. After integration, the components appear in the Experience Builder component palette. --- ## Startup Flow When this skill is triggered, perform these checks automatically before copying. ### Check 0: Resolve Package Directory 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. ### Check 1: Open Source Repository Verify the repo is cloned at `.tmp/b2b-commerce-open-source-components`: 1. **If directory does not exist:** Tell user: "I'm cloning the official B2B Commerce open source components repository from GitHub into a local `.tmp/` folder. This gives us access to all the open code components." Then run: `git clone https://github.com/forcedotcom/b2b-commerce-open-source-components .tmp/b2b-commerce-open-source-components` 2. **If directory exists** and contains `force-app/main/default/sfdc_cms__lwc` and `sfdc_cms__label`, present options: > "Open source repository is already cloned. How would you like to proceed?" > 1. **Reuse existing** — Use the already cloned repository > 2. **Re-clone** — Remove and clone fresh from GitHub 3. **If directory exists but structure is invalid:** Tell user: "The cloned repository has an unexpected structure. I'll remove it and clone a fresh copy." Then remove and re-clone. 4. **If clone fails:** inform user and abort ### Check 2: Store and Site Metadata Verify a store is selected and site metadata is available locally: 1. Tell user: "I'm checking if your project already has B2B store metadata locally." Check if `<package-dir>/main/default/digitalExperiences/site/` contains any store directories. 2. **If store metadata exists:** use it. If multiple stores found, ask user to select one. 3. **If no store metadata found:** Try retrieving from the connected org before delegating: 1. Run `sf org list` (or check `sf config get target-org`) to find a connected org. Ask the user to confirm or pick one if more than one. 2. List `DigitalExperienceBundle` site bundles in that org with `sf org list metadata --metadata-type DigitalExperienceBundle --target-org <alias>`. Filter to `site/*` entries. 3. If at least one site bundle exists, ask the user which to use, then run: `sf project retrieve start --metadata "DigitalExperienceBundle:site/<storeName>" --target-org <alias>` The bundle lands at `<package-dir>/main/default/digitalE