원클릭으로
components-best-practices
Use this skill whenever working on CDS React components in any package.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use this skill whenever working on CDS React components in any package.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | components.best-practices |
| description | Use this skill whenever working on CDS React components in any package. |
| user-invocable | false |
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;
Component modules encapsulate two prop Types: *BaseProps (platform-agnostic) and *Props (extends BaseProps with platform and component specific properties like className, classNames, styles, etc.)
Reuse other components' Types via utilities: Pick being preferred then secondarily Omit/Exclude
Compose prop types using Typescript intersections (&) 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;
};
When accepting components as props, define the contract types (*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;
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 existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
Provides a structured workflow for writing high quality Coinbase Design System (CDS) code. Use this skill every time you are asked to create or update a user interface using React or React Native. Additinoally, this skill may be used to conduct a code review on existing code for CDS adherence. Trigger examples: "build this screen", "update this component", "perform a CDS audit on our changes", "check our codebase for CDS adherence", "does this feature use CDS well?"
Turn Figma designs into CDS React (cds-web) or React Native (cds-mobile) code. Use when the user shares a Figma design URL (e.g. `figma.com/design/...?node-id=...`) or asks to "implement this design" or "build this from Figma" in a frontend project that is using Coinbase Design System (CDS). Do not use for general CDS UI work with no Figma reference (use `cds-code`), or for design critique without an implementation request.
Reviews already-written Coinbase Design System (CDS) UI for accessibility: verifying documented accessibility props (e.g. accessibilityLabel, accessibilityState), confirming the chosen CDS primitives cover the right assistive technology behavior, and checking usage against official CDS documentation—not generic web ARIA tutorials. Use this skill to review CDS UI for screen reader, keyboard, and labeled control requirements after the code has been written.
Guidelines writing styles API (styles, classNames, and static classNames) for a CDS component. Use this skill when adding customization options to a React component via `styles` or `classNames` props or when needing to update the docsite with component styles documentation.
Back-port a specific commit from master to a release branch via cherry-pick. Creates a dedicated backport branch, attempts the cherry-pick, pushes it, and opens a PR by default. Returns to the original branch when done (success or failure). If there are merge conflicts, diagnoses the root cause without attempting an autonomous resolution. Use when asked to "backport", "cherry-pick to release", or "port a fix to a release branch".