/vtex-ai-skills:sales-app-extensibilityfrom vtex-ai-skills
Guides building, customizing, and deploying extensions for VTEX Sales App. Covers the 7-step workflow from prerequisites through code generation to deployment, including extension points (cart, PDP, menu), React hooks, TypeScript types, and secure API integration.
Ships in vtex-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use this skill when building, customizing, or deploying extensions for VTEX Sales App.
Do not use this skill for:
faststore-storefront)vtex-io-* skills)The project root must contain: biome.json, faststore.json, package.json, tsconfig.json, turbo.json.
If any are missing, STOP. The user must install FastStore first:
npx @vtex/fsp-cli init
# Prompt: "What is the application name?" → enter name or press Enter for default
cd <application-name> && yarn
Documentation: https://beta.fast.store/getting-started
Inside the FastStore project, a Sales App workspace must exist (typically at packages/sales-app) with src/, package.json, and tsconfig.json. Check root package.json "workspaces" for a path containing sales-app. If missing, STOP:
yarn add @vtex/sales-app -D -W
npx fsp create
# Prompts: account name → "Sales App" → path (default or custom)
# Then add the path to root package.json "workspaces" array
yarn install
Documentation: https://beta.fast.store/sales-app/setting-up
Do NOT proceed to discovery or code generation until both prerequisites are confirmed.
Follow the mandatory 7-step workflow (Steps 0–6) in order. Do not skip steps.
| Step | Purpose | Gate |
|---|---|---|
| 0 | Check prerequisites | FastStore + Sales App installed → proceed; otherwise STOP |
| 1 | Discovery | Understand what the user wants to build |
| 2 | Requirements & Plan | Map requirements → generate plan → wait for user approval |
| 3 | Code Generation & Validation | Generate Component.tsx + Component.css (plain CSS, never .module.css) + index.tsx → validate |
| 4 | Documentation | Generate docs/<ExtensionName>.md explaining the extension |
| 5 | Local Testing | Provide dev commands and URLs |
| 6 | Build & Deploy | Build command → deployment guide |
| Extension Point | Category | Available Hooks | Layout Shift |
|---|---|---|---|
cart.cart-list.after | Cart | useCart, useExtension | No |
cart.cart-item.after | Cart | useCart, useCartItem, useExtension | Yes |
cart.order-summary.after | Cart | useCart, useExtension | Yes |
pdp.sidebar.before | PDP | usePDP, useCart, useExtension | Yes |
pdp.sidebar.after | PDP | usePDP, useCart, useExtension | Yes |
pdp.content.after | PDP | usePDP, useCart, useExtension | Yes |
menu.item | Menu | useExtension | No |
menu.drawer-content | Menu | useCurrentUser, useExtension | No |
cart.cart-item.after onlymenu.drawer-content only${DATA_INTERFACE} placeholdercredentials: 'include' with a relative path (/_v/my-api/data).defineExtensions expects ExtensionPointComponent which returns Element, not Element | null.
Why this matters
Returning null causes a TypeScript compilation error. The build will fail.
Detection
return null in any component registered with defineExtensions.
Correct
export function MyExtension(): JSX.Element {
if (!data) return (<></>);
return <div>{data.value}</div>;
}
Wrong
export function MyExtension(): JSX.Element | null {
if (!data) return null;
return <div>{data.value}</div>;
}
CartItem.manualPrice (number | undefined), CartItem.productRefId (string | undefined), CartItem.attachments (Attachment[] | undefined) must be guarded.
Why this matters TypeScript strict mode rejects accessing possibly-undefined values.
Detection
item.manualPrice, item.productRefId, or item.attachments without ?., ??, &&, or != null.
Correct
const price = item.manualPrice ?? item.sellingPrice;
const refId = item.productRefId ?? 'N/A';
const count = item.attachments?.length ?? 0;
Wrong
const price = item.manualPrice;
const refId = item.productRefId.toUpperCase();
const count = item.attachments.length;
item from useCartItem() is CartItem | undefined.
Why this matters
Accessing properties on undefined causes a runtime crash.
Detection
Destructured item from useCartItem() used without if (!item) guard.
Correct
const { item } = useCartItem();
if (!item) return (<></>);
return <div>{item.name}</div>;
Wrong
const { item } = useCartItem();
return <div>{item.name}</div>;
Entry point must use defineExtensions from @vtex/sales-app.
Why this matters Without it, the build succeeds but no extensions render.
Detection
Missing defineExtensions import or call in index.tsx.
Correct
import { defineExtensions } from '@vtex/sales-app';
import { MyExtension } from './components/MyExtension';
export default defineExtensions({ 'cart.cart-list.after': MyExtension });
Wrong
import { MyExtension } from './components/MyExtension';
export default { 'cart.cart-list.after': MyExtension };
IDs are a fixed set. Non-existent names silently fail.
Why this matters The extension renders nowhere. No build error — invisible at runtime.
Detection
Any name not in: cart.cart-list.after, cart.cart-item.after, cart.order-summary.after, pdp.sidebar.before, pdp.sidebar.after, pdp.content.after, menu.item, menu.drawer-content.
Correct
defineExtensions({ 'cart.cart-list.after': MyExtension });
Wrong
defineExtensions({ 'cart.list.after': MyExtension });
Each hook has an available_in restriction.
Why this matters Hook context is only mounted for specific extension points. Using elsewhere throws runtime errors.
Detection
useCartItem in PDP/menu. useCurrentUser in cart. usePDP in menu/cart-list.
Correct
// useCartItem in cart.cart-item.after ✓
defineExtensions({ 'cart.cart-item.after': ItemWarranty });
Wrong
// useCartItem in pdp.sidebar.after ✗ — will fail at runtime
defineExtensions({ 'pdp.sidebar.after': ItemWarranty });
Step 0 — Check FastStore + Sales App prerequisites. STOP if missing.
Step 1 — Discovery. Detect use case from keywords, ask follow-up questions, determine API auth strategy. If the user provides API documentation (URL, OpenAPI/Swagger file, Markdown, or inline text), ingest it to extract endpoint details and response shapes — skip the equivalent manual questions. Validate extracted information with the user. Load the discovery reference for detailed question flows and the API Documentation Ingestion section.
Step 2 — Map requirements to extension point + hooks + template. Present plan listing the files to be created: components/<ComponentName>.tsx, components/<ComponentName>.css (plain CSS — never .module.css), and index.tsx. Wait for approval.
Step 3 — Generate <ComponentName>.tsx, <ComponentName>.css (plain CSS, never .module.css), and index.tsx.
Required references for this step (load before generating):
index.tsx template, type generation rules, and the custom fetch hook pattern.@vtex/fsp-analyzer. Run these checks on all generated files.If API documentation was ingested in Step 1, generate TypeScript interfaces from the extracted response shapes and use them in the component instead of the ${DATA_INTERFACE} placeholder. If the extension calls 2+ endpoints, extract fetch logic into custom hook(s). Validate against the 12-point checklist in code-templates-and-patterns.md. Fix all violations before presenting code; surface warnings to the user.
Step 4 — Generate docs/<ExtensionName>.md inside the Sales App package (create the docs/ folder if needed). Load the documentation template reference for the required 9-section structure and the markdown skeleton to fill in.
Step 5 — Provide local dev commands and test URLs. Load the dev/build/deploy reference.
Step 6 — Build command and deployment guide. Load the dev/build/deploy reference.
Load these on demand based on what the task requires. Do not load all of them upfront.
| File | Load when… |
|---|---|
| references/extension-points-hooks-and-types.md | Choosing an extension point, selecting hooks, looking up TypeScript types (CartItem, ProductSku, Totalizers, Attachment), or checking hook return values and availability per extension point |
| references/code-templates-and-patterns.md | Generating extension code — simple, hook, API, IO Proxy, or Direct Auth templates; CSS template with the full Sales App design system inlined (tokens, typography, spacing, responsive); index.tsx with defineExtensions; hook initialization; validation checklist |
| references/discovery-and-use-cases.md | Running Step 1 (Discovery) — use case detection keywords, follow-up questions, API auth decision tree, IO Proxy vs Direct Auth flow |
| references/local-dev-build-and-deploy.md | Running Steps 5–6 — dev server commands, test URLs, build command, common build errors, FastStore WebOps deployment, monitoring, rollback |
| references/static-analysis-rules.md | Validating generated code (Step 3) — sandbox security, CSS containment, and React performance rules from @vtex/fsp-analyzer; full rule catalog with violation IDs, detection patterns, and correct/wrong examples |
| references/design-guidelines.md | Writing UI text (sentence case rule) or using icons (Phosphor Icons). CSS-related design rules — tokens, typography, spacing, responsive — are inlined directly in the CSS template inside code-templates-and-patterns.md, so this file is not needed for CSS generation. |
| references/documentation-template.md | Writing the docs/<ExtensionName>.md file in Step 4 — the 9-section structure and markdown skeleton |
docs/<ExtensionName>.md. Load documentation-template.md for the required structure.fetch calls inside the component body. Extract into custom hook(s) in hooks/use{Purpose}.ts.Code-level violations (DOM APIs, Node imports, eval, CSS containment, React performance, design tokens) are enforced by
@vtex/fsp-analyzerand caught during Step 3 validation. See static-analysis-rules.md and design-guidelines.md.
Workflow gates
docs/<ExtensionName>.md (9 sections, using documentation-template.md)?hooks/?yarn fsp build {account} sales-app?yarn fsp dev {account}?TypeScript / runtime guards (not caught by fsp-analyzer)
All other code-level rules (sandbox APIs, CSS containment, React performance, design tokens) are enforced by
@vtex/fsp-analyzerand checked during Step 3. See static-analysis-rules.md and design-guidelines.md.
faststore-storefront — storefront customization outside Sales Appvtex-io-app-contract — building VTEX IO proxy apps for secure API integrationreferences/code-templates-and-patterns.md (opens in a new tab)references/design-guidelines.md (opens in a new tab)references/discovery-and-use-cases.md (opens in a new tab)references/documentation-template.md (opens in a new tab)references/extension-points-hooks-and-types.md (opens in a new tab)references/local-dev-build-and-deploy.md (opens in a new tab)references/static-analysis-rules.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
46 skills in this plugin
/architecture-well-architected-commerceApply when scoping, reviewing, or documenting cross-cutting VTEX commerce architecture across storefront, IO, headless, marketplace, payments, or any other VTEX module. Grounds work in the Well-Architected Commerce framework—Technical Foundation (reliability, trust, integrity; security, infrastructure, compliance), Future-proof (innovation, simplicity, efficiency; scalable and adaptable solutions), and Operational Excellence (accuracy, accountability, data-driven improvement; process and customer experience). Routes implementation detail to product tracks (IO caching and paths, Master Data strategy, marketplace integrations). Use for solution design, architecture reviews, and RFP-level technical structure./faststore-storefrontCore coding rules and workflow for developing VTEX FastStore storefronts. Use when starting any FastStore development task, writing TypeScript/React components, creating section overrides, extending the BFF, or styling. Covers all primary conventions, safety rules, and the development workflow used across every FastStore project./headless-bff-architectureApply when designing or modifying a BFF (Backend-for-Frontend) layer, middleware, or API proxy for a headless VTEX storefront. Covers BFF middleware architecture, public vs private API classification, VtexIdclientAutCookie management, API key protection, and secure request proxying. Use for any headless commerce project that must never expose VTEX_APP_KEY or call private VTEX APIs from the browser.npx claudepluginhub vtex/skills --plugin vtex-ai-skillsOther plugins' skills for the same job