From d08549956ff667b84413fe32693483e5f2912735 Mon Sep 17 00:00:00 2001 From: nkurapati Date: Sat, 11 Apr 2026 21:12:57 +0530 Subject: [PATCH] adding rule to for agent --- .../SKILL.md | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/skills/integrating-b2b-commerce-open-code-components/SKILL.md b/skills/integrating-b2b-commerce-open-code-components/SKILL.md index 065c6fe..f43b94a 100644 --- a/skills/integrating-b2b-commerce-open-code-components/SKILL.md +++ b/skills/integrating-b2b-commerce-open-code-components/SKILL.md @@ -16,6 +16,10 @@ Use this skill when you need to: - 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. @@ -30,21 +34,25 @@ When this skill is triggered, perform these checks automatically before copying. Verify the repo is cloned at `.tmp/b2b-commerce-open-source-components`: -1. **If directory does not exist:** clone silently — `git clone https://github.com/forcedotcom/b2b-commerce-open-source-components .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:** remove and re-clone automatically +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. Check if `force-app/main/default/digitalExperiences/site/` contains any store directories +1. Tell user: "I'm checking if your project already has B2B store metadata locally." + Check if `force-app/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:** delegate to the **creating-b2b-commerce-store** skill (`skills/creating-b2b-commerce-store/SKILL.md`) to create/select a store and retrieve metadata. +3. **If no store metadata found:** Tell user: "No store metadata found locally. I'll help you create or select a B2B store and retrieve its metadata." + Then delegate to the **creating-b2b-commerce-store** skill (`skills/creating-b2b-commerce-store/SKILL.md`). **Required state** after both checks: - **Store name** — the selected `fullName` value (e.g., `My_B2B_Store1`) @@ -62,13 +70,16 @@ Copy all components and labels from cloned repo to site directory: **Steps:** -1. Check if destination directories already contain files +1. Tell user: "I'm checking if open code components already exist in your store's site metadata." + Check if destination directories already contain files. 2. If files exist, present options: > "Components already exist in **{store-name}**. How would you like to proceed?" > 1. **Overwrite all** — Replace all existing components with latest from repo > 2. **Copy only new** — Skip existing components, copy only ones not yet present -3. Copy all component directories from source to destination -4. Copy all label directories from source to destination +3. 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. +4. Tell user: "I'm copying the associated label files that these components need." + Copy all label directories from source to destination. 5. Report: "Copied X components and Y label sets" **Output:** @@ -89,24 +100,29 @@ Next Steps: **User:** "Integrate open code components to my store" -**Agent:** _(Check 1: repo exists)_ +**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?" > 1. **Reuse existing** — Use the already cloned repository > 2. **Re-clone** — Remove and clone fresh from GitHub **User:** "1" -**Agent:** _(Check 2: store metadata)_ +**Agent:** "I'm checking if your project already has B2B store metadata locally..." - ✓ Found store metadata for My_B2B_Store1 -**Agent:** _(Integration Task: files exist)_ +**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?" > 1. **Overwrite all** — Replace all existing components with latest from repo > 2. **Copy only new** — Skip existing components, copy only ones not yet present **User:** "1" -**Agent:** +**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 ```