sf-b2c-cartridges

Build B2C Commerce cartridges — cartridge directory structure (controllers/, models/, scripts/, templates/, static/), cartridge stacking, naming conventions (app_custom_*, plugin_*, int_*), cartridge path configuration, and certification requirements. Use when creating or modifying SFCC cartridges.

17 stars

Best use case

sf-b2c-cartridges is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Build B2C Commerce cartridges — cartridge directory structure (controllers/, models/, scripts/, templates/, static/), cartridge stacking, naming conventions (app_custom_*, plugin_*, int_*), cartridge path configuration, and certification requirements. Use when creating or modifying SFCC cartridges.

Teams using sf-b2c-cartridges should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/sf-b2c-cartridges/SKILL.md --create-dirs "https://raw.githubusercontent.com/OrcaQubits/agentic-commerce-skills-plugins/main/dist/antigravity/salesforce-commerce/.agent/skills/sf-b2c-cartridges/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/sf-b2c-cartridges/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How sf-b2c-cartridges Compares

Feature / Agentsf-b2c-cartridgesStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Build B2C Commerce cartridges — cartridge directory structure (controllers/, models/, scripts/, templates/, static/), cartridge stacking, naming conventions (app_custom_*, plugin_*, int_*), cartridge path configuration, and certification requirements. Use when creating or modifying SFCC cartridges.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# sf-b2c-cartridges

Build B2C Commerce cartridges following Salesforce Commerce Cloud architecture patterns.

## Before Writing Code

**Fetch live documentation FIRST:**

1. **Web-search** for:
   - "Salesforce B2C Commerce SFRA cartridge structure 2026"
   - "SFCC cartridge naming conventions best practices"
   - "Salesforce Commerce Cloud cartridge overlay documentation"

2. **Web-fetch** official sources:
   - https://github.com/SalesforceCommerceCloud/storefront-reference-architecture (SFRA GitHub repo)
   - Salesforce B2C Commerce cartridge development documentation
   - SFCC LINK marketplace certification requirements

3. **Verify** before coding:
   - Current SFRA version and directory structure
   - Cartridge naming prefix standards
   - Required metadata fields in cartridge.properties
   - Build tool configuration (sgmf-scripts, webpack)

## Conceptual Architecture

### Cartridge Directory Structure

```
app_custom_mysite/
├── cartridge/
│   ├── controllers/    # Route handlers
│   ├── models/         # Business logic
│   ├── scripts/        # Helpers, middleware
│   ├── templates/      # ISML + i18n resources
│   └── static/         # Compiled CSS/JS/images
└── cartridge.properties
```

### Key Directories Explained

| Directory | Contents | Notes |
|-----------|----------|-------|
| `controllers/` | Server-side JS route handlers | Each file exports route actions (e.g., `Product-Show`) |
| `models/` | Data models and business logic | Keep controllers thin; move logic here |
| `scripts/` | Utility helpers, middleware, services | Subdirs: `helpers/`, `middleware/`, `services/` |
| `templates/default/` | ISML templates per locale | `default/` is the fallback locale |
| `templates/resources/` | i18n `.properties` files | Resource bundles for `Resource.msg()` |
| `forms/default/` | XML form definitions | Server-side validation rules |
| `static/default/` | Compiled CSS, JS, images | Built from `client/default/` source |
| `client/default/` | Source SCSS and JS | Input for webpack/sgmf-scripts build |
| `experience/components/` | Page Designer components | Visual merchandising building blocks |

### Cartridge Naming Conventions

| Prefix | Purpose | Example |
|--------|---------|---------|
| `app_custom_*` | Site-specific customizations | `app_custom_mysite` |
| `plugin_*` | Reusable feature modules | `plugin_wishlists` |
| `int_*` | Third-party integrations | `int_paypal`, `int_stripe` |
| `bm_*` | Business Manager extensions | `bm_custom_admin` |
| `app_storefront_base` | Base SFRA cartridge | Core framework (do not modify) |
| `modules/` | Shared modules (non-cartridge) | Utility libraries consumed by cartridges |

### Cartridge Path and Overlay System

The **cartridge path** defines file resolution order (configured in Business Manager > Site Settings):

```
app_custom_mysite:plugin_wishlists:int_paypal:app_storefront_base
```

**Resolution**: Left to right. When SFCC resolves a file (e.g., `controllers/Product.js`), it searches each cartridge in path order and uses the first match. This enables **non-destructive customization** -- overlay specific files without modifying base cartridges.

**Overlay constraints:**
- File must have the same relative path inside `cartridge/` to override
- Controllers can extend base controllers via `module.superModule`
- Templates override entirely (no partial merge)
- Static assets (CSS/JS) override entirely per file
- Resource bundles merge at the property level (keys from left cartridge win)

### Cartridge Types

| Type | Contains | When to Use |
|------|----------|-------------|
| Storefront | Controllers, templates, static assets | Customer-facing site logic |
| Integration | Service definitions, API clients | Third-party system connections |
| Plugin | Self-contained feature | Reusable cross-site features |
| Business Manager | BM extensions, custom modules | Admin panel customizations |

### Controller Extension Pattern

Controllers can extend base behavior using `module.superModule`:

```javascript
// Pattern: extend base controller
// Fetch live docs for server.extend() API
var server = require('server');
server.extend(module.superModule);
// Add or override route actions here
```

This avoids duplicating the entire base controller when you only need to modify one action.

### Cartridge Metadata (cartridge.properties)

Required fields: cartridge ID and multi-language flag. Optional: version and compatibility version. Fetch live docs for the exact property key format (`demandware.cartridges.<id>.*`) before creating this file.

### Build Tools

SFRA uses `sgmf-scripts` for compiling client-side SCSS and JS. Source files live in `cartridge/client/default/` and compile to `cartridge/static/default/`. Webpack configuration maps entry points for JS bundles and SCSS compilation.

| Tool | Purpose |
|------|---------|
| `sgmf-scripts --compile js` | Compile client-side JavaScript |
| `sgmf-scripts --compile css` | Compile SCSS to CSS |
| `sgmf-scripts --watch` | Watch mode for development |
| `sfcc-ci` | CLI for code upload and deployment automation |

### LINK Marketplace Certification

| Category | Key Requirements |
|----------|-----------------|
| Technical | Compatible with latest SFRA; no hardcoded credentials; passes code profiler |
| Documentation | Installation guide, BM configuration steps, troubleshooting guide |
| Security | Input validation, CSRF protection, secure credential storage |
| Testing | Unit tests, integration tests, performance benchmarks, multi-site compatibility |

### Deployment

Pattern: upload cartridge code to a **code version** on the sandbox/instance, then activate that version in Business Manager. Use WebDAV upload or the `sfcc-ci` CLI tool for automation.

| Step | Action |
|------|--------|
| 1 | Upload code to a named code version via WebDAV or `sfcc-ci` |
| 2 | Set the active code version in BM > Administration > Code Deployment |
| 3 | Update cartridge path in BM > Site Settings if new cartridges were added |
| 4 | Clear caches and verify storefront behavior |

```bash
# Pattern: scaffold a new cartridge
# Fetch live docs for sgmf-scripts CLI options
mkdir -p app_custom_mysite/cartridge/{controllers,models,scripts,templates/default}
```

## Best Practices

### Cartridge Organization
- Keep site-specific code in `app_custom_*`; reusable features in `plugin_*`.
- Minimize cartridge count -- each cartridge adds file resolution overhead.
- Match `app_storefront_base` directory layout for clean overlays.
- Use `module.superModule` to extend controllers rather than copying entire files.

### Code Modularity
- Extract reusable functions to `scripts/helpers/`; keep controllers thin.
- Use models for business logic; templates for presentation only.
- Break large ISML files into `<isinclude>` components.
- Keep Page Designer components self-contained with clear input/output contracts.

### Version Control and Deployment
- Increment `cartridge.properties` version on each release.
- Use semantic versioning tags in Git; maintain a CHANGELOG.
- Always deploy to sandbox first; activate code versions after validation.
- Use `sfcc-ci` for CI/CD pipeline integration.

### Security
- Never commit secrets -- use Business Manager custom preferences or site preferences.
- Validate all inputs via form definitions and server-side checks.
- Follow OWASP guidelines, especially for payment integrations.
- Use service credentials (BM > Services) for external API keys.

### Performance
- Minimize cartridge path length to reduce file resolution overhead.
- Serve only compiled, minified assets in production.
- Configure cache headers in Business Manager for static resources.
- Profile cartridge code with the SFCC code profiler before release.

---

Fetch the SFRA GitHub repo, B2C Commerce cartridge development docs, and LINK certification guidelines for exact directory conventions, build tool APIs, and deployment procedures before implementing.

Related Skills

woo-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Test WooCommerce extensions — PHPUnit unit/integration tests, WP test suite, WooCommerce test helpers, E2E with Playwright, and WP-CLI test scaffolding. Use when writing tests for WooCommerce plugins or setting up a test environment.

woo-shipping

17
from OrcaQubits/agentic-commerce-skills-plugins

Build WooCommerce shipping methods — WC_Shipping_Method, shipping zones, shipping classes, rate calculation, tracking, and integration with carriers. Use when creating custom shipping integrations or configuring shipping logic.

woo-setup

17
from OrcaQubits/agentic-commerce-skills-plugins

Install WooCommerce, configure the development stack, and set up a local dev environment with WP-CLI, Docker, or wp-env. Use when setting up a new WooCommerce project or development environment.

woo-security

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement WooCommerce security — nonces, capabilities, input sanitization, output escaping, data validation, PCI compliance considerations, and WordPress security best practices. Use when hardening a WooCommerce store or reviewing security posture.

woo-plugin-dev

17
from OrcaQubits/agentic-commerce-skills-plugins

Create WooCommerce extensions/plugins — file structure, main plugin file, activation/deactivation hooks, custom database tables, autoloading, and WordPress plugin API. Use when building new WooCommerce extensions or structuring plugin code.

woo-performance

17
from OrcaQubits/agentic-commerce-skills-plugins

Optimize WooCommerce performance — object caching, transients, HPOS, database optimization, Action Scheduler, lazy loading, and query optimization. Use when improving store performance or diagnosing slowness.

woo-payments

17
from OrcaQubits/agentic-commerce-skills-plugins

Build WooCommerce payment gateways — WC_Payment_Gateway, direct/redirect/hosted integrations, tokenization, subscriptions support, refunds, and PCI compliance. Use when creating custom payment method integrations.

woo-hooks-filters

17
from OrcaQubits/agentic-commerce-skills-plugins

Master the WordPress hook system for WooCommerce — actions, filters, hook priorities, WooCommerce-specific hooks, and extensibility patterns. Use when adding functionality via hooks or understanding the WooCommerce execution flow.

woo-frontend

17
from OrcaQubits/agentic-commerce-skills-plugins

Customize WooCommerce frontend — template overrides, theme integration, shortcodes, hooks for product/cart/checkout display, and WooCommerce block themes. Use when modifying the storefront appearance or building WooCommerce themes.

woo-deploy

17
from OrcaQubits/agentic-commerce-skills-plugins

Deploy WooCommerce — WP-CLI automation, database migrations, zero-downtime updates, staging workflows, environment configuration, and CI/CD patterns. Use when deploying WooCommerce stores or setting up deployment pipelines.

woo-data-stores

17
from OrcaQubits/agentic-commerce-skills-plugins

Work with WooCommerce CRUD data stores — WC_Product, WC_Order, WC_Customer, WC_Coupon data objects, custom data stores, HPOS migration, and getters/setters. Use when creating or modifying WooCommerce data objects or implementing custom data stores.

woo-custom-fields

17
from OrcaQubits/agentic-commerce-skills-plugins

Work with WooCommerce product attributes, custom meta fields, taxonomies, custom product tabs, and variation data. Use when adding custom data to products, orders, or customers.