/vtex-ai-skills:vtex-io-session-appsfrom vtex-ai-skills
Guides building and debugging VTEX IO session transform apps (vtex.session). Covers namespace ownership, input vs output fields, DAG transform ordering, public-as-input vs private-as-read model, cross-namespace propagation, configuration.json contracts, caching, and frontend session consumption.
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.
None: SKILL.md is the whole skill.
Use this skill when your VTEX IO app integrates with the VTEX session system (vtex.session) to derive, compute, or propagate state that downstream transforms, the storefront, or checkout depend on.
vtex.session/configuration.jsonpublic.* inputs so native transforms (profile, search, checkout) re-runstorefront-permissions, custom transforms, and checkout interactDo not use this skill for:
vtex-io-service-apps)vtex-io-application-performance)vtex-io-graphql-api)rona, myapp, storefront-permissions).storefront-permissions owns storefront-permissions.organization, your transform must not overwrite it—read it as an input instead.storefront-permissions, profile, checkout, or store. Your namespace should contain only data that comes from your backend or computation.public is input, private is read modelpublic.* fields are an input surface: values the shopper or a flow sets so session transforms can run (e.g. geolocation, flags, UTMs, user intent). Do not treat public.* as the canonical read model in storefront code.profile, checkout, store, search, storefront-permissions, your custom namespace) are the read model: computed outputs derived from inputs. Frontend components should read private namespace fields for business rules and display.public.* input fields that native apps declare as inputs—so the platform re-runs those upstream transforms and private outputs stay consistent. This is input propagation, not duplicating truth.vtex.session/configuration.json.storefront-permissions.costcenter, your transform runs after storefront-permissions outputs that field.storefront-permissions outputs and profile outputs, declare both as inputs so the platform schedules you after both.account and workspace (see vtex-io-application-performance).items= query parameter (e.g. items=rona.storeNumber,storefront-permissions.costcenter).rona.*, storefront-permissions.*, profile.*, etc.) for canonical state.public.* only when setting user intent (e.g. selecting a location, switching a flag). Never write to public.* as a "cache" for values that private namespaces already provide.Your session transform must output only fields that come from your computation or backend. Copying identity, address, or org fields that storefront-permissions, profile, or checkout already own creates two sources of truth that diverge on partial failures.
Why this matters — When two namespaces contain the same fact (e.g. costCenterId in both your namespace and storefront-permissions), consumers read inconsistent values after a session that partially updated. Debug time skyrockets and race conditions appear.
Detection — Your transform's output includes fields like organization, costcenter, postalCode, country that mirror storefront-permissions.* or profile.* outputs. Or frontend reads the same logical field from two different namespaces.
Correct — Read storefront-permissions.costcenter as an input; use it to compute your backend-specific fields (e.g. myapp.priceTable, myapp.storeNumber); output only those derived fields.
{
"my-session-app": {
"input": {
"storefront-permissions": ["costcenter", "organization"]
},
"output": {
"myapp": ["priceTable", "storeNumber"]
}
}
}
Wrong — Output duplicates of VTEX-owned fields.
{
"my-session-app": {
"output": {
"myapp": [
"costcenter",
"organization",
"postalCode",
"priceTable",
"storeNumber"
]
}
}
}
When your transform derives a value (e.g. postal code from a cost center address) that native apps consume, set it as an input field those apps declare (typically public.postalCode, public.country)—not by writing directly to checkout.postalCode or search.postalCode.
Why this matters — Native transforms expect their input fields to change so they can recompute their output fields. Writing directly to their output namespaces bypasses recomputation and leaves stale derived state (e.g. regionId not updated, checkout address inconsistent).
Detection — Your transform declares output fields in namespaces owned by other apps (e.g. output: { checkout: [...] } or output: { search: [...] }). Or you PATCH session with values in a namespace you don't own.
Correct — Declare output in public for fields that native apps consume as inputs, verified against each native app's vtex.session/configuration.json.
{
"my-session-app": {
"output": {
"myapp": ["storeNumber", "priceTable"],
"public": ["postalCode", "country", "state"]
}
}
}
Wrong — Writing to search or checkout output namespaces directly.
{
"my-session-app": {
"output": {
"myapp": ["storeNumber", "priceTable"],
"checkout": ["postalCode", "country"],
"search": ["facets"]
}
}
}
public, for canonical business stateStorefront components and middleware must read session data from the authoritative private namespace (e.g. storefront-permissions.organization, profile.email, myapp.priceTable), not from public.* fields.
Why this matters — public.* fields are inputs that may be stale, user-set, or partial. Private namespace fields are the computed truth after all transforms have run. Reading public.postalCode instead of the profile- or checkout-derived value leads to displaying stale or inconsistent data.
Detection — React components or middleware that read public.storeNumber, public.organization, or public.costCenter for display or business logic instead of the corresponding private field.
Correct
// Read from the authoritative namespace
const { data } = useSessionItems([
"myapp.storeNumber",
"myapp.priceTable",
"storefront-permissions.costcenter",
"storefront-permissions.organization",
]);
Wrong
// Reading from public as if it were the source of truth
const { data } = useSessionItems([
"public.storeNumber",
"public.organization",
"public.costCenter",
]);
vtex.session/configuration.jsonDeclare your transform's input dependencies and output fields:
{
"my-session-app": {
"input": {
"storefront-permissions": [
"costcenter",
"organization",
"costCenterAddressId"
]
},
"output": {
"myapp": ["storeNumber", "priceTable"]
}
}
}
// node/handlers/transform.ts
export async function transform(ctx: Context) {
const { costcenter, organization } = parseSfpInputs(ctx.request.body);
if (!costcenter) {
ctx.body = { myapp: {} };
return;
}
const costCenterData = await getCostCenterCached(ctx, costcenter);
const pricing = await resolvePricing(ctx, costCenterData);
ctx.body = {
myapp: {
storeNumber: pricing.storeNumber,
priceTable: pricing.priceTable,
},
};
}
// Two-layer cache: LRU (sub-ms) -> VBase (persistent, SWR) -> API
const costCenterLRU = new LRU<string, CostCenterData>({
max: 1000,
ttl: 600_000,
});
async function getCostCenterCached(ctx: Context, costCenterId: string) {
const { account, workspace } = ctx.vtex;
const key = `${account}:${workspace}:${costCenterId}`;
const lruHit = costCenterLRU.get(key);
if (lruHit) return lruHit;
const result = await staleFromVBaseWhileRevalidate(
ctx.clients.vbase,
"cost-centers",
costCenterId,
() => fetchCostCenterFromAPI(ctx, costCenterId),
{ ttlMs: 1_800_000 },
);
costCenterLRU.set(key, result);
return result;
}
service.json route{
"routes": {
"transform": {
"path": "/_v/my-session-app/session/transform",
"public": true
}
}
}
When building a transform, map out the transform DAG for your store:
authentication-session → impersonate-session → profile-session
profile-session → store-session → checkout-session
profile-session → search-session
authentication-session + checkout-session + impersonate-session → storefront-permissions
storefront-permissions → YOUR-TRANSFORM (reads SFP outputs)
Your transform sits at the end of whatever dependency chain it requires. Declaring inputs correctly ensures the platform schedules you after all upstream transforms.
updateSession — Instead of letting storefront-permissions + your transform compute B2B session fields, the frontend PATCHes them directly. This creates race conditions, partial state, and duplicated sources of truth.costcenter, organization, or postalCode into your namespace when they already live in storefront-permissions or profile.public.* as source of truth — Frontend components reading public.organization or public.storeNumber instead of the private namespace field, leading to stale or inconsistent display.checkout, search, or storefront-permissions namespaces you don't own, bypassing native transform recomputation.account:workspace, unsafe on multi-tenant shared pods.vtex.session/configuration.json?public.* inputs when propagation is needed)?public.* used only for input propagation, not as a second read model?public.*, for business state?account:workspace for multi-tenant safety?updateSession been removed from frontend code for fields the transform computes?What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub vtex/skills --plugin vtex-ai-skills46 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.Other plugins' skills for the same job