dist/codex/bigcommerce-commerce/skills/js-modern/SKILL.md
Write modern JavaScript and TypeScript — ES6+ features, async/await, modules, destructuring, optional chaining, TypeScript types, and modern tooling. Use when writing JavaScript/TypeScript for BigCommerce themes, apps, or headless storefronts.
npx skillsauth add orcaqubits/agentic-commerce-claude-plugins js-modernInstall 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.
Fetch live docs: Web-search site:developer.mozilla.org javascript for MDN JavaScript reference. Check https://www.typescriptlang.org/docs/ for TypeScript documentation.
Concise function syntax with lexical this:
const add = (a, b) => a + b;this, arguments, super, or new.targetString interpolation and multi-line strings:
`Hello, ${name}!`Extract values from objects/arrays:
const { name, price } = product;const [first, ...rest] = items;const { name = 'Unknown' } = product;const { address: { city } } = customer;[...arr1, ...arr2], { ...obj1, ...obj2 }function(...args) {}, const { a, ...rest } = obj;import { func } from './module.js';export const value = 42; / export default class {}const mod = await import('./lazy.js');obj?.property?.nested — short-circuits to undefined if any part is nullishvalue ?? defaultValue — returns right side only if left is null/undefined (not falsy)new Promise((resolve, reject) => { ... }).then(), .catch(), .finally()Promise.all(), Promise.allSettled(), Promise.race(), Promise.any()async function fetchData() { const data = await fetch(url); }const [a, b] = await Promise.all([fetchA(), fetchB()]);const response = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
});
const result = await response.json();
let name: string = 'Product';function getPrice(id: number): Promise<number> { ... }const product: Product = { ... };interface Product {
id: number;
name: string;
price: number;
variants?: Variant[];
}
Partial<T> — all properties optionalRequired<T> — all properties requiredPick<T, K> — subset of propertiesOmit<T, K> — exclude propertiesRecord<K, V> — key-value mappingReturnType<T> — extract return type of functionfunction fetchResource<T>(url: string): Promise<T> {
return fetch(url).then(res => res.json());
}
const product = await fetchResource<Product>('/api/products/1');
enum OrderStatus {
Pending = 'pending',
Shipped = 'shipped',
Completed = 'completed',
}
type ApiResponse<T> =
| { status: 'success'; data: T }
| { status: 'error'; message: string };
map, filter, reduce, find, findIndexsome, every — boolean checksflat, flatMap — array flatteningArray.from(), Array.isArray()Object.entries(), Object.fromEntries(), Object.keys(), Object.values()structuredClone() — deep clonePageManager lifecycle for page-specific codethis.contextjsonwebtoken libraryconst by default, let when reassignment is needed, never var=== instead of == for comparisonsFetch MDN and TypeScript docs for exact syntax, browser compatibility, and new features 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.