π‘ Prompt-First Examples
Copy a prompt. Paste it into your AI assistant. Get a production-quality answer. Each section shows the exact request, the tool usage behind the scenes, and the kind of response you should expect.
No repetition of feature marketing hereβonly concrete, minimal, high-signal examples.
Surface: 36+ specialized tools (docs, best practices, SFRA, cartridge gen, runtime logs, job logs, system & custom objects, site preferences, code versions)
Explore an SFCC Class Quickly
Use documentation tools to pull authoritative class context, then build with confidence.
Prompt: "Show me everything important about dw.catalog.Product, including methods I actually use in pricing or variation contexts."Intent: Documentation deep dive β actionable subset
- Search for candidate classes (confirmation)search_sfcc_classes {"query": "product"}Docs Mode
- Fetch class detailsget_sfcc_class_info {"className": "dw.catalog.Product"}Docs Mode
- Cross reference pricing modelget_sfcc_class_info {"className": "dw.catalog.PriceModel"}Inspect pricing methodsDocs Mode
Assistant Consolidation (grounded in tool output):
### Focused Summary: dw.catalog.Product
Pulled full class definition (get_sfcc_class_info β dw.catalog.Product) and reduced to what typically drives storefront pricing / availability / variation logic.
Identity & Routing:
β’ ID, name, pageURL for canonical + SEO.
β’ onlineFlag vs online (flag is raw, online applies scheduling window).
Pricing:
β’ priceModel.getPrice().value / currencyCode for base price display.
β’ Use getPriceModel(optionModel) when option selections adjust pricing.
β’ Guard: priceModel can be null on offline or misconfigured variants.
Availability:
β’ availabilityModel.isInStock() and availabilityModel.getATS()?.value for inventory messaging.
β’ Avoid deprecated isAvailable()/getAvailableFlag(); rely on availabilityModel.
Variation Handling:
β’ isMaster() / isVariant() to branch logic.
β’ variationModel.getVariants() (iterate then filter by onlineFlag).
β’ Image fallback: getImage('small', 0) (uses variant images, then master fallback); avoid deprecated no-arg getImage().
Navigation / Category Context:
β’ onlineCategories preferred for building live nav trees; allCategories includes offline / non-site assignments.
Common Pitfalls & Mitigations:
1. Null priceModel β defensive optional chaining.
2. Using deprecated availability helpers β switch to availabilityModel.
3. Assuming images exist β null check getImage before URL access.
4. Iterating variants without online gating β filter by v.onlineFlag.
Minimal Access Snippet:
`var pm = p.getPriceModel();
var price = pm ? pm.getPrice().value : null;
var inStock = p.getAvailabilityModel().isInStock();
if (p.isMaster()) {
var variants = p.getVariationModel().getVariants().toArray().filter(v => v.onlineFlag);
}`Focused Class Exploration with Filtering
Use enhanced filtering and search to find exactly what you need from SFCC classes.
Prompt: "I need to understand only the getter methods in dw.catalog.Product that relate to pricing or availability. Don't show me everything."Intent: Targeted exploration with precise filtering
- Show only methods with price-related termsget_sfcc_class_info {"className": "dw.catalog.Product", "includeProperties": false, "includeConstants": false, "includeDescription": false, "includeInheritance": false, "search": "price"}Docs Mode
- Show only methods with availability termsget_sfcc_class_info {"className": "dw.catalog.Product", "includeProperties": false, "includeConstants": false, "includeDescription": false, "includeInheritance": false, "search": "availab"}Docs Mode
- Compare with full getter methodsget_sfcc_class_info {"className": "dw.catalog.Product", "includeProperties": false, "includeConstants": false, "includeDescription": false, "includeInheritance": false, "search": "get"}See complete getter landscapeDocs Mode
Focused Results (price-related methods only):
### dw.catalog.Product - Price Methods Only
**Methods:**
β’ getPriceModel() : PriceModel - Returns pricing model for current product
β’ getPriceModel(ProductOptionModel) : PriceModel - Returns pricing with option adjustments
**Key Benefits:**
- Clean, targeted view without noise from 50+ other methods
- Focus on exactly what's needed for pricing logic
- Search functionality quickly surfaces relevant APIsPro Tip: Use search parameter with partial terms like "get", "set", "price", "availab" to quickly find relevant methods. Combine with includeProperties: false to focus only on methods.
Generate a Controller from Documentation Context
Documentation β intent β runnable controller with guard rails.
Prompt: "Using SFRA patterns, create a Product-Show like controller action that handles missing products, logs errors, and renders a view model with price + availability."Intent: Transform docs into production-safe code
// app_storefront_base/cartridge/controllers/CustomProduct.js
'use strict';
var server = require('server');
var ProductMgr = require('dw/catalog/ProductMgr');
var Logger = require('dw/system/Logger');
var cache = require('*/cartridge/scripts/middleware/cache');
server.get('Show', cache.applyDefaultCache, function (req, res, next) {
var pid = req.querystring.pid;
if (!pid) {
res.setStatusCode(400); res.render('error/badrequest'); return next();
}
try {
var product = ProductMgr.getProduct(pid);
if (!product || !product.onlineFlag) {
res.setStatusCode(404); res.render('error/notfound'); return next();
}
var availability = product.getAvailabilityModel();
var priceModel = product.getPriceModel();
var viewModel = {
id: product.ID,
name: product.name,
price: priceModel ? priceModel.getPrice().value : null,
currency: priceModel ? priceModel.getPrice().currencyCode : null,
inStock: availability.isInStock(),
ats: availability.getATS && availability.getATS().value,
images: product.getImages('small', 0).toArray().map(function(i){return i.URL;})
};
res.render('product/customProduct', viewModel);
} catch (e) {
Logger.error('CustomProduct.Show error: {0}', e.message);
res.setStatusCode(500); res.render('error/general');
}
return next();
});
module.exports = server.exports();Scaffold a Feature Cartridge
Go from blank folder to structured integration base.
Prompt: "Generate a cartridge structure for a shipment tracking integration using hooks + a service layer and note follow-up tasks."Intent: Structural generation + next actions
- Generate skeletongenerate_cartridge_structure {"cartridgeName": "int_tracking"}Docs Mode
- Request best practice follow-upget_best_practice_guide {"guideName": "cartridge_creation"}Assistant merges guidanceDocs Mode
Generated Tree (excerpt):
int_tracking/
βββ cartridge/
βββ controllers/
β βββ Tracking.js
βββ scripts/
β βββ hooks/
β β βββ shipment.js
β βββ services/
β βββ TrackingService.js
βββ templates/default/tracking/
β βββ trackingstatus.isml
βββ static/default/js/tracking/Assistant Adds Next Steps:
1. Configure LocalServiceRegistry service: tracking.api
2. Implement hooks: updateShippingInfo, exportStatus
3. Add ISML partial to PDP for shipment ETA
4. Add logging category: TrackingIntegration
5. Write integration test harness for mocked API responsesEnhance with Live Logs (Full Mode)
Same style of promptβbut now the assistant executes log tooling to ground its answer.
Prompt: "Checkout is intermittently failing with payment declinesβidentify root causes from recent logs and propose concrete mitigations."Intent: Diagnostic + remediation planning
- Daily context snapshotsummarize_logs {"date": "20250916"}High-level counts firstFull Mode
- Attempt error retrievalget_latest_error {"limit": 15}May return none β fall back to warningsFull Mode
- Focus on recurring warning patternsearch_logs {"pattern": "cookie_hint", "logLevel": "warn", "limit": 5}Isolate noisy asset issueFull Mode
- Cross-check security guidelines (token lifecycle / logging hygiene)get_best_practice_guide {"guideName": "security"}Docs Mode
Assistant Narrative (validated with real tool set):
### Live Log Triage (No Errors Detected Today)
1. summarize_logs β Errors: 0, Warnings: 27, no debug/info noise. Healthy baseline but warning cluster present.
2. get_latest_error β Returned none (expectedβerror file absent). Pivoting to warnings.
3. search_logs (pattern=cookie_hint, level=warn) β Multiple repeats: "Content asset with ID cookie_hint is offline" across distinct request contexts.
Assessment:
β’ Repeated offline content asset warnings inflate noise floor; risk of masking future meaningful warnings.
β’ No payment/auth related issues surfaced; current checkout remediation unnecessary.
Recommended Actions:
β’ Restore or intentionally remove the cookie_hint asset; if intentionally removed, suppress via conditional include.
β’ Add lightweight monitoring rule: if warning count for a single asset > X per hour, raise housekeeping task instead of polluting logs.
β’ Keep error path watch in place; re-run summarize_logs after remediation to confirm warning reduction.
If Errors Had Been Present (Pattern Skeleton):
β’ Step 1 would still be summarize_logs for counts β then targeted search_logs for signatures (e.g., AUTH_TIMEOUT, TOKEN_EXPIRED) followed by best practice cross-reference.Investigate a Failing Job
Targeted job log inspection with focused summarization.
Prompt: "Analyze the latest CatalogFeed job execution β summarize step durations, failures, and recommend optimizations."Intent: Temporal + failure analysis
- Discover job logs (filtered)search_job_logs_by_name {"jobName": "CatalogFeed", "limit": 5 }Find specific job log filenamesFull Mode
- List latest job logs (context)get_latest_job_log_files {"limit": 5 }Recency overview (no name filter)Full Mode
- Fetch recent entriesget_job_log_entries {"jobName": "CatalogFeed", "limit": 50, "level": "all" }Multi-level snapshotFull Mode
- Search for errorssearch_job_logs {"pattern": "ERROR", "jobName": "CatalogFeed", "limit": 20 }If none β treat as healthy caseFull Mode
- Execution summaryget_job_execution_summary {"jobName": "CatalogFeed"}Full Mode
### CatalogFeed Execution Analysis (Validated Flow)
Flow Used:
1. search_job_logs_by_name β confirm job exists.
2. get_latest_job_log_files β establish relative recency.
3. get_job_log_entries (limit 50, all levels) β capture operational window.
4. search_job_logs (pattern=ERROR) β branch: errors vs healthy.
5. get_job_execution_summary β aggregate timing + status.
Illustrative Degraded Scenario (for instructional value):
Duration: 7m42s (β18% vs rolling average)
Step Highlights:
β’ LOAD_PRODUCTS: 2m10s (warning β 312 fallback fetches suggests cache miss storm)
β’ EXPORT: 15 socket timeout retries before success (dominant latency source)
Primary Bottleneck: External export endpoint + un-jittered linear retry compounding latency.
Recommendations (priority order):
1. Reduce batch size 200β120 to shrink payload variance.
2. Exponential backoff + jitter (β€800ms, cap 6) for EXPORT retries.
3. Parallelize transform stage (2 workers) given idle CPU.
4. Emit structured metrics: step_duration_ms, retry_count to confirm remediation.
Healthy Case Note: If error search returns 0 (common for maintenance/cleanup jobs) emit concise summary only and skip remediation suggestions.Surface High-Value Custom Attributes
Focus on signal: only the attributes you will likely act on in code.
Prompt: "List only non-system custom Product attributes that impact pricing, display, or integrationsβinclude access examples."Intent: Selective attribute curation
- Search attribute definitionssearch_system_object_attribute_definitions {"objectType": "Product", "searchRequest": {"query": {"match_all_query": {}}}}Full Mode
- Filter & rankAssistant filters system vs custom, groups by usage relevance
### Curated Product Attribute Focus (Grounded in Live Metadata)
Source: search_system_object_attribute_definitions β 113 total attributes (first 30 sampled). We extracted *custom* (system=false) fields + a few pivotal system ones (clearly flagged) that materially influence merchandising, variation, UX, integration, or feed logic. Purely operational / audit (UUID, creationDate) or low-impact marketing fluff excluded.
Legend:
β’ Cat: Category of impact (Disp = Display/UX, Var = Variation, Facet = Faceting/Search, Int = Integration/Channel, Enr = Enrichment, Dim = Dimensions/Shipping)
β’ MV = multi-value (enum_of_string or multi_value_type true)
β’ SYS = system attribute retained for high value (otherwise we focus on custom)
| Attribute | Cat | Type | Flags | Rationale | Access Snippet |
|-----------|-----|------|-------|-----------|----------------|
| brand (SYS) | Facet/Disp | string | visible | Drives brand badges & facet grouping; high-frequency filter. | `p.brand` (system field, not in p.custom) |
| color | Var | string | custom | Variation presentation / swatch resolution; stored custom but effectively a core merchandising dimension. | `p.custom.color` |
| availableForInStorePickup | Int | boolean | custom, site-agnostic | Gating for store pickup workflows & conditional UI messaging. | `if (p.custom.availableForInStorePickup) showPickup();` |
| batteryLife | Enr/Disp | string | custom, visible | PDP spec table + comparison view; enriches SEO content. | `p.custom.batteryLife` |
| batteryType | Enr/Disp | string | custom, visible | Hardware spec grouping; feed enrichment for certain channels. | `p.custom.batteryType` |
| bootType | Facet | enum_of_string | custom, MV | Multi-select refinement facet; influences search narrowing logic. | `p.custom.bootType && p.custom.bootType.toArray()` |
| bottomType | Facet | enum_of_string | custom, MV | Apparel categorization & layered navigation. | `(p.custom.bottomType||[]).toArray()` |
| consoleWarranty | Int/Disp | string | custom | Extended service offering display + export to warranty provider feed. | `p.custom.consoleWarranty` |
| digitalCameraFeatures | Facet/Enr | enum_of_string | custom, MV, visible | Feature badges + facet refinement; high cardinality set. | `p.custom.digitalCameraFeatures?.toArray()` |
| digitalCameraPixels | Disp/Enr | string | custom, visible | Marketing resolution highlight; conditional comparison logic. | `p.custom.digitalCameraPixels` |
| digitalCameraType | Facet | string | custom, visible | Primary camera classification facet. | `p.custom.digitalCameraType` |
| digitalCameraWarranty | Int | string | custom | Feed & PDP legal/service disclosure. | `p.custom.digitalCameraWarranty` |
| dimDepth | Dim | string | custom, visible | Shipping dimensional weight calc if external DIM service absent. | `Number(p.custom.dimDepth)` |
| dimHeight | Dim | string | custom, visible | Parcel sizing / volumetric charge triggers. | `Number(p.custom.dimHeight)` |
| dimWeight | Dim | string | custom, visible | Fallback for missing system weight or override scenario. | `Number(p.custom.dimWeight)` |
| dimWidth | Dim | string | custom, visible | Combined with others for cubic volume. | `Number(p.custom.dimWidth)` |
| displaySize | Disp | string | custom, visible | Prominence in electronics PDP hero section + compare grid. | `p.custom.displaySize` |
| facebookEnabled (SYS) | Int | boolean | system, site_specific | Channel feed toggle β dictates inclusion in FB catalog export. | `p.facebookEnabled` |
| gameGenre | Facet | enum_of_string | custom, MV, visible | Multi-select discovery facet for gaming taxonomy. | `p.custom.gameGenre?.toArray()` |
| gameRating | Facet/Compliance | string | custom, visible | Age rating badge + compliance gating (e.g., age verification). | `p.custom.gameRating` |
| gameSystemType | Facet | string | custom, visible | Platform segmentation (PS/Xbox/Nintendo) β major navigation axis. | `p.custom.gameSystemType` |
| gpsFeatures | Facet/Enr | enum_of_string | custom, MV, visible | Feature-level refinement & badge cluster. | `p.custom.gpsFeatures?.toArray()` |
| Wool | Enr/Disp | string | custom, localizable, visible | Care instruction overlay & localized PDP sustainability note. | `p.custom.Wool` |
Why exclude others like EAN / UPC (system, typically handled upstream) or UUID (audit only)? They rarely drive conditional storefront logic once imported and are better treated as pass-through feed fields.
Implementation Notes:
1. Multi-value handling: Always null-check before toArray(); some may be undefined on non-merchandised variants.
2. Numeric coercion: DIM fields are strings β coerce with Number() and guard NaN before calculations.
3. Site specificity: facebookEnabled is site_specific β avoid caching decisions across sites without keying by site ID.
4. Variation interplay: color selection should reference variationAttribute values; treat p.custom.color as display fallback not authoritative source.
5. Performance: When projecting many attributes into a model, prefer a single transform object rather than repeated p.custom dereferencing inside loops.
Minimal Extraction Snippet:
`var c = p.custom;
var model = {
brand: p.brand,
color: c.color,
pickupEligible: !!c.availableForInStorePickup,
dims: ['dimHeight','dimWidth','dimDepth','dimWeight'].reduce(function(acc,k){var v=c[k]; if(v && !isNaN(v)) acc[k.replace('dim','').toLowerCase()]=Number(v); return acc;}, {}),
features: (c.digitalCameraFeatures && c.digitalCameraFeatures.toArray()) || [],
care: c.Wool,
fbActive: p.facebookEnabled
};
if (c.bootType) model.bootType = c.bootType.toArray();
if (c.gameGenre) model.gameGenre = c.gameGenre.toArray();`Discover Site Preferences Safely
Locate configuration switches before you hardcode assumptions.
Prompt: "Find all site preferences in the checkout group related to tax or shipping so I can reference them defensively in code."Intent: Configuration discovery
- List groups (if unknown)search_system_object_attribute_groups {"objectType": "SitePreferences", "searchRequest": {"query": {"match_all_query": {}}}}Optional first pass β discover group IDsFull Mode
- Search preferences in groupsearch_site_preferences {"groupId": "checkout", "searchRequest": {"query": {"text_query": {"fields": ["id","display_name","description"], "search_phrase": "tax"}}, "count": 50}}Full Mode
- Broaden to shippingsearch_site_preferences {"groupId": "checkout", "searchRequest": {"query": {"text_query": {"fields": ["id","display_name","description"], "search_phrase": "ship"}}, "count": 50}}Full Mode
### Interpreting Results
Each preference includes: id, display_name, value_type, (optionally) value definition.
Security: Password-type preference values are masked by default.
Usage Pattern:
`var prefs = Site.getCurrent().getPreferences().getCustom();
var enableAltTax = prefs.enableAlternativeTaxEngine;
if (enableAltTax) { /* branch logic */ }`
Defensive Access Tips:
1. Guard optional boolean flags with !! to normalize (e.g., !!prefs.enableGiftWrap)
2. Never log preference values directly (especially STRING/LONG_TEXT types containing tokens)
3. Document critical preference dependencies in controller/module JSDocTarget Custom Object Attributes
Search attributes precisely instead of browsing blindly.
Prompt: "For custom object type Global_String, list only searchable non-system attributes and show how to query one in script."Intent: Metadata β usage
- Query searchable attributessearch_custom_object_attribute_definitions {"objectType": "Global_String", "searchRequest": {"query": {"bool_query": {"must": [{"term_query": {"fields": ["searchable"], "operator": "is", "values": ["true"]}}]}}, "count": 100}}Full Mode
- (Optional) broaden if emptyFallback: use match_all_query then client-side filter
### Usage Extraction
Attribute Sample: altValueMapping (type=string, searchable=true)
Script Access:
`var CustomObjectMgr = require('dw/object/CustomObjectMgr');
var co = CustomObjectMgr.getCustomObject('Global_String', key);
var mapped = co && co.custom.altValueMapping;`
Guidelines:
- Null-check custom object fetch before dereferencing .custom
- Prefer specific term_query filtering serverside rather than large client-side scans
- If attribute becomes critical path, add defensive logging (category=MetadataAccess, level=debug) selectively (avoid value leakage)Micro Job Log Triage
Fast 3-step health read of a job without noise.
Prompt: "Give me a 3-step minimal health read for the nightly InventorySync job and only call tools you truly need."Intent: Minimal observation pipeline
- Confirm presencesearch_job_logs_by_name {"jobName": "InventorySync", "limit": 3 }Full Mode
- Get recent entries (tail)get_job_log_entries {"jobName": "InventorySync", "limit": 40 }Mixed levels in single job fileFull Mode
- Execution summaryget_job_execution_summary {"jobName": "InventorySync"}Roll-up status + durationsFull Mode
### Minimal InventorySync Health Snapshot
Outcome: SUCCESS (duration 2m14s, 0 errors, 3 warnings)
Warnings Focus:
β’ 2x RETRY: External API 429 backoffs (acceptable within thresholds)
β’ 1x Deprecated attribute reference (non-blocking; schedule fix)
Next Actions (Only If Persistent):
1. Track retry ratio vs baseline (add metric instrumentation)
2. Replace deprecated attribute before Q4 freezePrompt Patterns & Anti-Patterns
Tight prompts yield grounded, production-usable outputs.
Effective Patterns
- Role + Scope: "Act as SFRA dev β generate..."
- Constraint: "Only include attributes affecting pricing."
- Mode Awareness: "Use live logs to confirm before proposing fixes."
- Transformation: "Summarize for junior dev handoff."
Anti-Patterns
- "Explain everything about SFCC" (Too broad)
- "Fix checkout" (No signal / context)
- Omitting objective (no success definition)
- Forgetting mode capabilities (asks for logs in docs-only)
Prompt Refinement Example:
Weak:
"Help with product page"
Improved:
"Generate an SFRA controller extension to enrich Product-Show with cached ATS and badge if sustainabilityRating >=3. Provide only changed code + template snippet."Ready to try these yourself?