Skip to content

forcedotcom/sf-skills / plugins/builder/experience-react/skills/experience-ui-bundle-agentforce-client-generate

experience-ui-bundle-agentforce-client-generate

Verified

Use this skill when the user asks to add, embed, integrate, configure, style, or remove an agent, chatbot, chat widget, conversation client, or AI assistant in a UI Bundle project (React or Angular). TRIGGER when: project contains a uiBundles/*/src/ directory and the task involves adding or modifying a chat widget, chatbot, or conversational AI; files under uiBundles/*/src/ import AgentforceConversationClient in React `.tsx`/`.jsx` files, or use the app-agentforce-conversation-client element in Angular `.html` templates and AgentforceConversationClientComponent in `.component.ts` files; user asks to add any chat or agent functionality to a page. DO NOT TRIGGER when: user wants to create a custom agent, chatbot, or chat widget component from scratch; the project has no uiBundles directory.

FileKindSize
SKILL.mdskill md18.7 KB
references/agent-id-resolution.mdmarkdown1.1 KB
references/constraints.mdmarkdown5.4 KB
references/examples.mdmarkdown5.1 KB
references/style-tokens.mdmarkdown14.7 KB
references/troubleshooting.mdmarkdown2.1 KB
scripts/detect-framework.shexecutablescript2.0 KB

references/constraints.md

View on GitHub
# Constraints and Anti-Patterns

This document lists all invalid approaches and patterns to avoid when working with AgentforceConversationClient.

## Never Edit Implementation Files

**CRITICAL: Only edit files where the component is USED, never the component implementation itself.** This applies to both React and Angular.

- **DO edit**: Files that import and use the element (for example, shared shells/layouts, route components, or feature pages) — React `*.tsx`/`*.jsx`, Angular host `*.html` + its `*.ts`
- **DO NOT edit (React)**: `AgentforceConversationClient.tsx`, `AgentforceConversationClient.jsx`, `index.tsx`, `index.jsx`, or any files inside:
  - `node_modules/@salesforce/ui-bundle-template-feature-react-agentforce-conversation-client/src/`
  - `packages/template/feature/feature-react-agentforce-conversation-client/src/`
  - `src/components/AgentforceConversationClient.tsx` (patched templates)
  - Any path containing `/components/AgentforceConversationClient.`
- **DO NOT edit (Angular)**: the feature component/service implementation:
  - `node_modules/@salesforce/ui-bundle-template-feature-angular-agentforce-conversation-client/`
  - `packages/template/feature/feature-angular-agentforce-conversation-client/src/`
  - `conversation.ts`, `conversation.html`, `agentforce-embed.service.ts`
  - `__inherit__conversation.ts` (the composed-in feature copy — import it, don't edit it)

**If you're reading the component implementation (`AgentforceConversationClient.tsx`, `conversation.ts`, or `agentforce-embed.service.ts`), you're in the wrong place. Stop and search for the USAGE instead.**

## Invalid Props

The Agentforce client uses a flat prop/input API and does NOT accept these:

- `containerStyle` - Use `width` and `height` directly instead
- `style` - Use `styleTokens` for theming
- `className` (React) / `class` (Angular) - Not supported for theming
- Any standard host-element/div props - This wraps an embedded iframe, not a div

**Why:** The component is a wrapper around an embedded iframe using Lightning Out 2.0. Standard framework styling props don't apply.

## Angular-Specific Anti-Patterns

- Forgetting to add `AgentforceConversationClientComponent` to the host `@Component({ imports: [...] })` — the `<app-agentforce-conversation-client>` element then renders nothing (Angular does not error on an unknown/unregistered element by default in this template setup).
- Passing booleans/numbers/objects as bare attributes: `inline`, `headerEnabled="false"`, `styleTokens="..."`. These become strings. Use property binding: `[inline]="true"`, `[headerEnabled]="false"`, `[styleTokens]="{ ... }"`.
- Editing `__inherit__conversation.ts` (the composed feature copy) — treat it as the component source and import from it, never modify it.

## Invalid Styling Approaches

**CRITICAL: For ALL styling, theming, branding, or color changes - ONLY use `styleTokens` prop.**

Never use these approaches:

- Creating CSS files (e.g., `agent-styles.css`, `theme.css`)
- Creating `<style>` tags or internal stylesheets
- Using `style` attribute on the component
- Using `className` prop
- Inline styles
- CSS modules
- Styled-components or any CSS-in-JS libraries

**Why:** The component controls its own internal styling through the `styleTokens` API. External CSS cannot reach into the embedded iframe.

## Invalid Implementation Approaches

Never do these:

- Create custom chat UIs from scratch
- Use third-party chat libraries (socket.io, WebSocket libraries, etc.)
- Call `embedAgentforceClient` directly from `@salesforce/agentforce-conversation-client`
- Build custom WebSocket or REST API chat implementations

**Why:** The AgentforceConversationClient component is the official wrapper that handles authentication, Lightning Out 2.0 initialization, and all communication with Salesforce agents. Custom implementations will not work.

## Invalid Update Patterns

When updating an existing component:

- Delete and recreate the component
- Remove all props and start over
- Copy the entire component to a new file

**Why:** This loses configuration, introduces errors, and creates unnecessary diffs. Always update props in place.

## Examples

### Wrong - Using containerStyle

```tsx
<AgentforceConversationClient agentId="0Xx..." containerStyle={{ width: 420, height: 600 }} />
```

### Correct - Using width/height directly

```tsx
<AgentforceConversationClient agentId="0Xx..." width="420px" height="600px" />
```

### Wrong - Creating CSS file

```css
/* agent-styles.css */
.agentforce-chat {
  background: red;
  color: white;
}
```

```tsx
import "./agent-styles.css";

<AgentforceConversationClient className="agentforce-chat" />;
```

### Correct - Using styleTokens

```tsx
<AgentforceConversationClient
  agentId="0Xx..."
  styleTokens={{
    headerBlockBackground: "red",
    headerBlockTextColor: "white",
  }}
/>
```

### Wrong - Creating style tag

```tsx
<>
  <style>{`.agent-chat { background: blue; }`}</style>
  <AgentforceConversationClient agentId="0Xx..." />
</>
```

### Correct - Using styleTokens

```tsx
<AgentforceConversationClient
  agentId="0Xx..."
  styleTokens={{
    headerBlockBackground: "blue",
  }}
/>
```

### Wrong - Editing implementation file

Reading or editing: `node_modules/@salesforce/ui-bundle-template-feature-react-agentforce-conversation-client/src/AgentforceConversationClient.tsx`

### Correct - Editing usage file

Reading and editing: usage files where the component is imported and used (for example, `src/app.tsx`, a route component, or a feature page)
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall