dist/codex/salesforce-commerce/skills/sf-b2c-jobs/SKILL.md
Build and manage B2C Commerce jobs — job framework, job steps (script modules, pipelines, custom), scheduling with cron expressions, job context and parameters, import/export jobs, reindex jobs, and Business Manager monitoring. Use when implementing background processing in B2C Commerce.
npx skillsauth add orcaqubits/agentic-commerce-claude-plugins sf-b2c-jobsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
ALWAYS fetch live documentation BEFORE writing any job code:
Why: Job APIs, execution contexts, and best practices evolve with each B2C Commerce release. Always verify current patterns.
The job framework provides scheduled background processing in B2C Commerce:
| Type | Description | Approach |
|------|-------------|----------|
| System jobs | Built-in import/export/reindex/cleanup | Configured in Business Manager |
| Script module steps | Custom JavaScript (modern approach) | exports.execute = function(jobStepExecution) {} |
| Pipeline steps | Legacy pipeline-based steps | Maintenance mode; avoid for new work |
| Chunk steps | Large dataset processing | Read-process-write pattern with commit intervals |
| Step Type | Use Case | Key Characteristic |
|-----------|----------|--------------------|
| Script | General custom logic | Single execute() entry point; return Status |
| Pipeline | Legacy flows | Deprecated for new development |
| Chunk | Large dataset processing | Framework manages read/process/write lifecycle with batching |
0 0 2 * * ? Every day at 2:00 AM
0 */15 * * * ? Every 15 minutes
0 0 0 1 * ? First day of month at midnight
0 0 18 ? * MON-FRI Weekdays at 6:00 PM
Format: seconds minutes hours day-of-month month day-of-week
Every job step must return a dw.system.Status object:
| Status | Constant | Meaning |
|--------|----------|---------|
| Success | Status.OK | Step completed successfully |
| Error | Status.ERROR | Step failed; may halt job depending on configuration |
There is no Status.WARN. For partial success, return Status.OK with a descriptive message (e.g., 'PARTIAL' status code with error count in the message).
// Pattern: Status return
var Status = require('dw/system/Status');
return new Status(Status.OK, 'COMPLETED', 'message');
// Fetch live docs for Status constructor
For large datasets, chunk-oriented processing follows this lifecycle:
The framework manages batching, transaction boundaries, and error recovery. Fetch live docs for the exact chunk step interface (read, process, write, afterStep methods).
Job step parameters are configured in Business Manager per job and accessed at runtime:
jobStepExecution.getParameterValue('ParamName') -- retrieve config valuesjobStepExecution.isDisabled() -- check if step is disabled| Category | Examples | |----------|---------| | Import | Catalog, inventory, pricing, customer data (XML/CSV) | | Export | Orders, products, customers | | Reindex | Search index rebuild, product availability updates | | Cleanup | Session cleanup, log rotation, temp file removal |
sfcc-ci job:run --job-id <id> and sfcc-ci job:status --job-execution-id <id>dw/system/Logger for structured logging within job stepsTransaction.wrap() per batch, not per itemStatus messages with item counts and error summariesStatus.ERROR on failureStatus.OK with descriptive messagedw/system/Logger including item identifiers for debuggingTransaction.wrap() (per batch, not per item)products.close()) in finally blocks to prevent resource leaksFetch the B2C Commerce job framework reference, cron syntax guide, and sfcc-ci documentation for exact step interfaces, parameter configuration, and chunk processing patterns before implementing.
development
Build with Spree's headless Next.js storefront — the official `spree/storefront` repo (Next.js 16 App Router with Server Actions and Turbopack, React 19 Server Components, Tailwind CSS 4, TypeScript 5, `@spree/sdk`, Sentry), server-only auth (httpOnly JWT cookies + publishable key), MeiliSearch faceted catalog, one-page checkout with Apple/Google Pay/Klarna/Affirm/SEPA, multi-region market routing, GA4 + JSON-LD SEO, and Vercel/Docker deployment. Use when forking or customizing the storefront, or evaluating headless adoption.
tools
Build Spree extensions as Rails engines — gem scaffolding, `bin/rails g spree:extension`, mounting routes/migrations/assets, the modern `prepend` decorator pattern (`*_decorator.rb` with `self.prepended(base)`), generators (`spree:model_decorator`, `spree:controller_decorator`), the four customization surfaces in preference order (Events > Webhooks > Dependencies > Decorators), Spree::Dependencies for swapping service objects, gem release/versioning, and the deprecated Deface engine. Use when building a reusable Spree extension or adding non-trivial customization to an app.
development
Build with Spree's event bus and Webhooks 2.0 — `Spree::Events` publication, `Spree::Subscriber` DSL with `subscribes_to` and `on`, wildcard matching, lifecycle events (`{model}.created/.updated/.deleted` via `publishes_lifecycle_events`), the canonical event catalog (order.*, payment.*, shipment.*, product.*), Webhooks 2.0 endpoints, HMAC-SHA256 signing (`X-Spree-Webhook-Signature`), exponential-backoff retries, and Sidekiq job orchestration. Use when wiring event-driven business logic, building webhook consumers, or replacing ActiveSupport callback chains.
tools
Cross-cutting Spree development patterns — the customization preference hierarchy (Events > Webhooks > Dependencies > Decorators), `Spree::Dependencies` service-object swapping, the `_decorator.rb` + `prepend` + `self.prepended` idiom, idempotent subscribers and webhook receivers, multi-store scoping discipline, prefixed IDs, calculator polymorphism (shipping/promotion/tax share the base), service-object composition with `dry-monads` or simple results, why to avoid `class_eval` reopening and Deface, and Spree-on-Rails idioms (Hotwire/Turbo Stimulus, ActiveStorage, Action Cable, Sidekiq). Use when designing the architecture of a Spree extension or solving cross-cutting concerns.