
B2B Commerce Open Code Integration
OfficialFreeSeamlessly integrate open source components into Salesforce B2B Commerce.
Free · Opens the source repo
What B2B Commerce Open Code Integration does
The B2B Commerce Open Code Integration skill allows developers to easily incorporate open source components from Salesforce's official repository into their B2B Commerce stores. This skill automates the process of copying all necessary components and labels into the store's site metadata, making them readily available in the Experience Builder. By streamlining this integration, developers can enhance their B2B Commerce sites with open source functionalities without the need for manual setup.
When triggered, the skill first checks for the active package directory in the project's configuration, ensuring that the integration process is set up correctly. It then verifies whether the open source repository is already cloned locally. If not, it will clone the repository, providing access to the latest components. This ensures that developers are working with the most up-to-date resources available.
The skill also checks for existing store metadata, allowing users to either reuse existing components or overwrite them with the latest versions from the repository. This flexibility is crucial for maintaining a clean and efficient development workflow. Once the components and labels are copied, users receive a confirmation message detailing the number of items integrated, along with next steps for deployment and usage in Experience Builder.
This skill is particularly useful for developers working with Salesforce B2B Commerce who want to leverage open source components to enhance their store's functionality and user experience. By automating the integration process, it saves time and reduces the potential for errors associated with manual copying and setup.
When to use it
Use this skill when you need to integrate open source B2B Commerce components into a new or existing store.
When not to use it
This skill is not suitable for integrating proprietary components or when a custom integration approach is required.
What you can build with it
Integrating New Components
Quickly add the latest open source components to a new B2B Commerce store without manual setup.
Updating Existing Components
Easily update existing components in your store with the latest versions from the open source repository.
Streamlining Development Workflows
Automate the integration process to save time and reduce errors in your B2B Commerce development.
How to install B2B Commerce Open Code Integration
View source1. Install with the skills CLI
npx skills add forcedotcom/sf-skills/commerce-b2b-open-code-components-integrate --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by forcedotcomWhen 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
- 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:
- 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 - If directory exists and contains
force-app/main/default/sfdc_cms__lwcandsfdc_cms__label, present options:"Open source repository is already cloned. How would you like to proceed?"
- Reuse existing — Use the already cloned repository
- Re-clone — Remove and clone fresh from GitHub
- 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.
- If clone fails: inform user and abort
Check 2: Store and Site Metadata
Verify a store is selected and site metadata is available locally:
- 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. - If store metadata exists: use it. If multiple stores found, ask user to select one.
- If no store metadata found: Try retrieving from the connected org before delegating:
- Run
sf org list(or checksf config get target-org) to find a connected org. Ask the user to confirm or pick one if more than one. - List
DigitalExperienceBundlesite bundles in that org withsf org list metadata --metadata-type DigitalExperienceBundle --target-org <alias>. Filter tosite/*entries. - 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/digitalExperiences/site/<storeName>/. - Only if no connected org is available, or no site bundles are found, or retrieve fails: delegate to the commerce-b2b-store-create skill.
- Run
Required state after all checks:
- Package dir — the value resolved in Check 0 (e.g.,
force-app) - Store name — the selected
fullNamevalue (e.g.,My_B2B_Store1) - Site metadata path —
<package-dir>/main/default/digitalExperiences/site/<store-name>/ - Repo path —
.tmp/b2b-commerce-open-source-components/
Integration Task
Copy all components and labels from cloned repo to site directory:
- Source:
.tmp/b2b-commerce-open-source-components/force-app/main/default/sfdc_cms__lwc/*andsfdc_cms__label/*(the open source repo's own layout — alwaysforce-app) - Destination:
<package-dir>/main/default/digitalExperiences/site/<store-name>/sfdc_cms__lwc/andsfdc_cms__label/(<package-dir>resolved in Check 0)
Steps:
- Tell user: "I'm checking if open code components already exist in your store's site metadata." Check if destination directories already contain files.
- If files exist, present options:
"Components already exist in {store-name}. How would you like to proceed?"
- Overwrite all — Replace all existing components with latest from repo
- Copy only new — Skip existing components, copy only ones not yet present
- Tell user: "I'm now copying all open code LWC components from the cloned repository into your store's site metadata directory." Copy all component directories from source to destination.
- Tell user: "I'm copying the associated label files that these components need." Copy all label directories from source to destination.
- Report: "Copied X components and Y label sets"
Output:
✅ Integration Complete!
Copied: X components and Y label sets to <store-name>
Next Steps:
1. Deploy: sf project deploy start -d <package-dir>/main/default/digitalExperiences/site/<store-name>
2. Open Experience Builder and use new components from the palette
3. Publish your site when ready
Example Interaction
User: "Integrate open code components to my store"
Agent: "I'm checking if the open source components repository is already cloned locally..."
Agent: (repo exists)
"Open source repository is already cloned. How would you like to proceed?"
- Reuse existing — Use the already cloned repository
- Re-clone — Remove and clone fresh from GitHub
User: "1"
Agent: "I'm checking if your project already has B2B store metadata locally..."
- ✓ Found store metadata for My_B2B_Store1
Agent: "I'm checking if open code components already exist in your store's site metadata..."
Agent: (files exist)
"Components already exist in My_B2B_Store1. How would you like to proceed?"
- Overwrite all — Replace all existing components with latest from repo
- Copy only new — Skip existing components, copy only ones not yet present
User: "1"
Agent: "I'm now copying all open code LWC components from the cloned repository into your store's site metadata directory..." Agent: "I'm copying the associated label files that these components need..."
- ✓ Copied 45 components and 38 label sets
✅ Integration Complete!
Copied: 45 components and 38 label sets to My_B2B_Store1
Next Steps:
1. Deploy: sf project deploy start -d force-app/main/default/digitalExperiences/site/My_B2B_Store1
2. Open Experience Builder and use new components from the palette
3. Publish your site when ready
Error Handling
| Error | Message | Action |
|---|---|---|
| Store not found | "Store '{name}' not found in org." | List stores again |
| Git clone failed | "Failed to clone repository. Check internet connection." | Retry or abort |
| Invalid repo structure | "Repository structure has changed. Expected sfdc_cms__lwc and sfdc_cms__label." | Warn user, abort |
| File copy failed | "Failed to copy files. Check file permissions." | Show error details |
Verification Checklist
- Startup Flow completed: repo cloned, store metadata available
- Components copied to correct destination path (
sfdc_cms__lwc/) - Labels copied to correct destination path (
sfdc_cms__label/) - No file permission errors during copy
- Deployment command provided and user informed about testing
Frequently asked questions about B2B Commerce Open Code Integration
Similar skills
WinMD API Search
Easily find and explore Windows desktop APIs.
WebMCPify
Transform any web app into an agent-ready platform.
Phoenix Tracing
Instrument LLM applications with OpenInference tracing.
Foundry Hosted Agent CopilotKit
Guidance for developing agentic web apps on Azure.
Power Automate Foundation
Connect AI agents to Power Automate seamlessly.
Power Automate Flow Builder
Efficiently build and deploy Power Automate flows programmatically.
