Use this skill whenever working on CDS React components in any package.
npx skills add https://github.com/coinbase/cds --skill components.best-practices
These high quality components demonstrate proper use of patterns/conventions:
Every main CDS component should live within its own folder:
ComponentName/
├── ComponentName.tsx # Main component file
├── SubComponent.tsx # Supporting component (if needed)
├── index.ts # Re-exports for public API
├── __stories__/ # Storybook stories
│ └── ComponentName.stories.tsx
├── __tests__/ # Unit tests
│ └── ComponentName.test.tsx
├── __figma__/ # Figma Code Connect files
│ └── ComponentName.figma.tsx
Organize components into category folders:
buttons - Button, IconButton, SlideButtoncontrols - TextInput, Select, Checkbox, Radio, Switchcards - Card, DataCard, ContentCardoverlays - Modal, Toast, Alert, Drawerlayout - Box, Stack, Dividertypography - Text, Headingicons - Iconnavigation - Tabs, Breadcrumb@default tags*BaseProps and *Props type (e.g., ButtonBaseProps, ButtonProps)testID prop on root element for every componentDesign tokens are defined in packages/common/src/core/theme.ts:
Colors use a spectrum system with hue + step notation:
Semantic tokens map to spectrum colors and adapt to light/dark mode:
fgPrimary: blue60 (light) / blue70 (dark)bgPrimary: blue60 (light) / blue70 (dark)bgNegative: red60 (both modes)bgPositive: green60 (both modes)space: {
'0': 0, // 0px
'0.25': 2, // 2px
'0.5': 4, // 4px
'0.75': 6, // 6px
'1': 8, // 8px - base unit
'1.5': 12, // 12px
'2': 16, // 16px
'3': 24, // 24px
'4': 32, // 32px
'5': 40, // 40px
// ... up to 10 (80px)
}
*Component/Default* naming: NavigationComponent = DefaultCarouselNavigation,
PaginationComponent = DefaultCarouselPagination,
classNames.pagination, styles.pagination).Benefits:
use*Context() hooks that throw descriptive errors on misuse: export const useCarouselContext = () => {
const context = useContext(CarouselContext);
if (!context) throw new Error('useCarouselContext must be used within Carousel');
return context;
};
value but not onChange)const open = openProp ?? openInternal; type SelectComponent = <Type extends SelectType, Value extends string>(
props: SelectProps<Type, Value>,
) => React.ReactElement;
*BaseProps (platform-agnostic) and *Props (extends BaseProps with platform and component specific properties like className, classNames, styles, etc.)Pick being preferred then secondarily Omit/Exclude&) in this order: (1) full types (2) Picks (3) Omits (4) other type literal(s): type MyComponentProps = BoxBaseProps &
Pick<OtherComponentProps, 'someProp'> &
Omit<AnotherComponentProps, 'otherProp'> & {
propA: string;
propB: number;
};
*Props, *Component) in the main component file. These child component contracts do not use the *BaseProps pattern—only the main component needs BaseProps/Props separation. Default implementations can extend the contract with additional props in their own file: // In MyComponent.tsx - defines the contract
type ChildProps = { id: string; label: ReactNode };
type ChildComponent = React.FC<ChildProps>;
// In DefaultChild.tsx - extends for default implementation
type DefaultChildProps = SharedProps & Omit<HStackProps, 'children'> & ChildProps;
Use Expo DOM components to run web code in a webview on native and as-is on web. Migrate web code to native incrementally.
Frontend development guidelines for React/TypeScript applications. Modern patterns including Suspense, lazy loading, useSuspenseQuery, file organization with features directory, MUI v7 styling, TanStack Router, performance optimization, and TypeScript best practices. Use when creating components, pages, features, fetching data, styling, routing, or working with frontend code.
Next.js 16 Cache Components - PPR, use cache directive, cacheLife, cacheTag, updateTag
| Build Shopify apps, extensions, themes using GraphQL Admin API, Shopify CLI, Polaris UI, and Liquid. "shopify theme", "liquid template", "polaris", "shopify graphql", "shopify webhook", "shopify billing", "app subscription", "metafields", "shopify functions"
Build Gradio web UIs and demos in Python. Use when creating or editing Gradio apps, components, event listeners, layouts, or chatbots.
MANDATORY prerequisite — load this skill BEFORE every `generate_diagram` tool call. NEVER call `generate_diagram` directly without loading this skill first. Trigger whenever the user asks to create, generate, draw, render, sketch, or build a diagram — flowchart, architecture diagram, sequence diagram, ERD or entity-relationship diagram, state diagram or state machine, gantt chart, or timeline. Also trigger when the user mentions Mermaid syntax or wants a system architecture, decision tree, dependency graph, API call flow, auth handshake, schema, or pipeline visualized in FigJam. Routes to type-specific guidance, sets universal Mermaid constraints, and tells you when to use a different diagram type or skip the tool entirely (mindmaps, pie charts, class diagrams, etc.).
Analyzes web performance using Chrome DevTools MCP. Measures Core Web Vitals (LCP, INP, CLS) and supplementary metrics (FCP, TBT, Speed Index), identifies render-blocking resources, network dependency chains, layout shifts, caching issues, and accessibility gaps. Use when asked to audit, profile, debug, or optimize page load performance, Lighthouse scores, or site speed. Biases towards retrieval from current documentation over pre-trained knowledge.
Algorithmic philosophies are computational aesthetic movements that are then expressed through code. Output .md files (philosophy), .html files (interactive viewer), and .js files (generative algorithms).
Take coinbase/components.best-practices from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.