sfnext-components
БесплатноБез исполняемых скриптовНе проверенBuild and modify UI components in a Storefront Next storefront: page components with Suspense and use()/Await, createPage and withSuspense, Tailwind v4 token…
от SalesforceCommerceCloud★ 58 звёзд на GitHubОб этом скилле
Storefront Next Components
How to write, style, and verify components in your storefront. Your project already ships the rules in AGENTS.md, docs/README-UI-STYLING.md, docs/README-SHAPE-TOKENS.md, docs/README-SUSPENSE.md, and docs/README-STORYBOOK.md; this skill is the task-oriented path through them.
Before you create anything
- Search
src/components/for an existing component (ls src/components). Extend or compose it before adding a new one. - Decide the layer:
- Primitive (Button, Card, Dialog): a shadcn fork in
src/components/ui/. Only shadcn forks live there. - Composite / domain component: everything else, in
src/components/<kebab-name>/. - Optional feature: a folder under
src/extensions/(seestorefront-next:sfnext-extensions).
- Primitive (Button, Card, Dialog): a shadcn fork in
- Match the folder shape already used by neighbors:
src/components/my-widget/
├── index.tsx # implementation (default or named export)
├── index.test.tsx # Vitest + Testing Library
└── stories/
├── index.stories.tsx # Storybook (stories/ subfolder is required)
├── my-widget-snapshot.tsx # optional snapshot fixture
└── __snapshots__/ # generated baselines, commit them
Every .ts/.tsx file needs the Apache header enforced by the custom/header-format lint rule. Copy it from any existing file (or AGENTS.md).
Styling rules
- Tailwind utility classes only; merge with
cn()from@/lib/utils. No CSS modules, no per-component CSS files, nostyle={{}}(a truly dynamic API-driven value is the only exception). - Global/theme CSS lives in
src/theme/only (entrysrc/theme/index.css). There is nosrc/app.css. - Use semantic token classes, never hard-coded colors. The
custom/color-linterrule failspnpm linton raw palette classes such astext-whiteorbg-red-500; usetext-primary-foreground,text-destructive-foreground,bg-card,text-muted-foreground,border-border. - Header/footer chrome has its own classes:
bg-header-background,text-header-foreground,bg-header-menu-background,bg-footer-background. Do not writebg-[--header-background]. - A new token needs two edits: the value in
src/theme/tokens/*.cssand a--color-x: var(--x)line inside@theme inlineinsrc/theme/tailwind.css. See TOKEN-SYSTEM.md. - The shipped theme defines one (light) palette; there is no
.darktoken block. Do not promise dark mode in component work. - Breakpoints are mobile-first (
sm,md,lg,xl,2xl).
Shape tokens (read before touching Card, Button, Input, Dialog)
Radius, shadow, and card border width come from three variables in src/theme/tokens/core.css: --ui-radius, --ui-shadow, --ui-border-width, consumed through rounded-ui, shadow-ui, border-ui.
- Never add
rounded-xl,rounded-none,shadow-md,shadow-none, orborder-0to a primitive or a Card to force a shape. Change the token, or scope it:<Card className="[--ui-radius:var(--radius-xl)]">. - Always write the source names (
--ui-radius). Writing the bridge names--radius-ui/--shadow-uiis a silent no-op. border-uiis Card-only. To show a Card border use[--ui-border-width:1px], notborder.
Full mechanism and scoped-override recipes: SHAPE-TOKENS.md.
Page components and Suspense
Route components receive loaderData with deferred fields as unresolved promises. Rules from AGENTS.md: one <Suspense> per async operation, stable promise identity (never Promise.all/.then in render; compose in the loader), skeletons where layout is known.
import { Suspense, use } from 'react';
import { Await } from 'react-router';
function Reviews({ promise }: { promise: Promise<ReviewsData> }) {
const reviews = use(promise);
return <ReviewList reviews={reviews} />;
}
export default function ProductPage({ loaderData }: { loaderData: PageData }) {
return (
<>
{/* use() needs a small child component */}
<Suspense fallback={<ReviewsSkeleton />}>
<Reviews promise={loaderData.reviews} />
</Suspense>
{/* Await resolves inline and supports a local errorElement */}
<Suspense fallback={<RecsSkeleton />}>
<Await resolve={loaderData.recommendations}>{(recs) => <Recommendations items={recs} />}</Await>
</Suspense>
</>
);
}
createPage (@/components/create-page) wraps a component with the standard Suspense fallback and keys the page so navigations remount it:
import { createPage } from '@/components/create-page';
export default createPage({
component: CategoryView,
fallback: <CategorySkeleton />, // optional; default is a generic skeleton
getPageKey: (data) => data?.categoryId, // optional; default is pathname+search+hash
});
withSuspense (@/components/with-suspense) is the lower-level HOC f
Установить sfnext-components в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл sfnext-components?
Build and modify UI components in a Storefront Next storefront: page components with Suspense and use()/Await, createPage and withSuspense, Tailwind v4 token classes, shape tokens (rounded-ui, shadow-ui, border-ui), shadcn/ui primitives in src/components/ui (sync-shadcn), CVA variants, data-slot, DynamicImage, lazy-loaded overlays, and Storybook stories with snapshot tests. Use when creating or editing a component in src/components, adding a shadcn primitive, fixing styling that ignores the theme, writing a *.stories.tsx file, or running pnpm storybook:test. Do not use for re-branding colors, fonts, or logos (use `storefront-next:sfnext-theming`), route loaders (use `storefront-next:sfnext-data-fetching`), or Page Designer registration (use `storefront-next:sfnext-page-designer`).
Как установить скилл sfnext-components?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл sfnext-components запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic