B2C Controllers

🌐Community
by salesforcecommercecloud · vlatest · Repository

B2C Controllers manage complex customer journeys across Salesforce Commerce Cloud, streamlining personalization and improving conversion rates for enhanced experiences.

Install on your platform

We auto-selected Claude Code based on this skill’s supported platforms.

1

Run in terminal (recommended)

terminal
claude mcp add b2c-controllers npx -- -y @trustedskills/b2c-controllers
2

Or manually add to ~/.claude/settings.json

~/.claude/settings.json
{
  "mcpServers": {
    "b2c-controllers": {
      "command": "npx",
      "args": [
        "-y",
        "@trustedskills/b2c-controllers"
      ]
    }
  }
}

Requires Claude Code (claude CLI). Run claude --version to verify your install.

About This Skill

What it does

This skill enables AI agents to assist in creating storefront controllers for Salesforce B2C Commerce. Controllers are JavaScript modules that handle HTTP requests and render responses, effectively managing customer journeys and personalizing experiences within a Salesforce Commerce Cloud storefront. The skill guides users through the process of building these controllers, which define specific URLs and associated functionality.

When to use it

  • Creating custom endpoints for your B2C Commerce storefront.
  • Developing simple APIs or handling requests in non-SFRA projects.
  • Implementing personalized experiences by controlling how content is delivered based on user interactions.
  • Working with Storefront Reference Architecture (SFRA) sites, which is the recommended approach for most development.

Key capabilities

  • Controller Creation: Guides users through building storefront controllers.
  • Pattern Support: Supports both SFRA (recommended) and Classic controller patterns.
  • File Structure Guidance: Provides information on where to place controller files within a cartridge directory (/cartridge/controllers).
  • Request & Response Handling: Explains how to use the req (request) and res (response) objects for handling HTTP requests, form data, rendering templates, returning JSON, and more.
  • Middleware Integration: Demonstrates how to apply middleware (e.g., caching, consent tracking, CSRF protection) to controller routes.

Example prompts

  • "How do I create a 'Home' controller in SFRA?"
  • "Show me an example of a Classic controller that returns JSON data."
  • "What are the available properties on the req object for handling form submissions?"

Tips & gotchas

  • SFRA Recommendation: For most storefront development, using the SFRA (Storefront Reference Architecture) controller pattern is recommended.
  • Naming Conventions: Controller filenames directly influence the URL prefix (e.g., Home.js creates URLs starting with Home-{function}).
  • File Location: Ensure controllers are placed in the /cartridge/controllers directory within your cartridge.

Tags

🛡️

TrustedSkills Verification

Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.

Security Audits

Gen Agent Trust HubPass
SocketPass
SnykPass

Details

Version
vlatest
License
Author
salesforcecommercecloud
Installs
40

🌐 Community

Passed automated security scans.