بنقرة واحدة
component-guide
// Guide for building React components using @stellar/design-system and project SCSS conventions. Invoke when creating new components or reviewing component code.
// Guide for building React components using @stellar/design-system and project SCSS conventions. Invoke when creating new components or reviewing component code.
Commit a logical unit of work with a descriptive message. Invoke after completing a meaningful chunk (component created, store wired, tests passing) to maintain small, reviewable commits.
Bridge Figma MCP output to Stellar Lab code conventions. Invoke after calling get_design_context to translate Figma's reference code into project-appropriate components, classes, and patterns.
Correct mental models for React re-renders and memoization. Use this skill when writing, reviewing, or optimizing React components to avoid common misconceptions about performance. Debunks the myth that "props cause re-renders" and teaches when memoization actually helps.
Reference for the two Zustand store patterns in Stellar Lab — main store (querystring) and transaction flow store (sessionStorage). Invoke when creating store slices, debugging hydration, or deciding where state belongs.
Run e2e and unit tests related to files changed on the current branch. Use after making code changes to verify nothing is broken.
| name | component-guide |
| description | Guide for building React components using @stellar/design-system and project SCSS conventions. Invoke when creating new components or reviewing component code. |
| read_files | [".claude/skills/component-guide/reference/*.md"] |
Check if @stellar/design-system already has the component:
https://github.com/stellar/stellar-design-system
For the full component catalog (SDS + local layout wrappers) and props patterns, see
reference/ui-components.md(loaded automatically).
src/components/ComponentName/
├── index.tsx
└── styles.scss
src/components/ComponentName.tsx
src/app/(sidebar)/[feature]/components/ComponentName.tsx
"use client";
import { useState } from "react";
import { Button, Input, Card } from "@stellar/design-system";
import "./styles.scss";
interface ComponentNameProps {
/** Description of prop */
propName: string;
}
/**
* Brief description of what this component does
*
* @example
* <ComponentName propName="value" />
*/
export const ComponentName = ({ propName }: ComponentNameProps) => {
return (
<div className="ComponentName">
<div className="ComponentName__header">
{/* ... */}
</div>
<div className="ComponentName__content">
{/* ... */}
</div>
</div>
);
};
.ComponentName {
// Root styles
&__header {
display: flex;
align-items: center;
justify-content: space-between;
}
&__content {
display: flex;
flex-direction: column;
gap: pxToRem(16px);
}
&__footer {
display: flex;
gap: pxToRem(8px);
}
}
ComponentName__element--modifier)pxToRem() for spacing values in SCSS (skip for trivial values like
1px or -1px — e.g., borders, outlines, offsets — where rem scaling is
not meaningful)var(--sds-clr-gray-06),
var(--sds-ff-monospace), var(--sds-gap-md)data-* attributes for state-driven styling instead of modifier classes:
data-is-active, data-is-visible, data-is-selected, data-is-clickabledata-testid with dashes for test selectors (data-testid="sign-button")@example for exported components@use "../../styles/utils.scss" as *;style={} attributes — always use SCSS classes--sds-clr-*).scssclassName string concatenation — use template literals or classnames libdata-* attributesPrefer data-* attributes over CSS modifier classes for dynamic state:
// Component
<div
className="TransactionStepper__step"
data-is-active={isActive || undefined}
data-is-completed={isCompleted || undefined}
data-is-clickable={isClickable || undefined}
onClick={isClickable ? () => onStepClick(step) : undefined}
>
// SCSS — target with attribute selectors
.TransactionStepper__step {
opacity: 0.5;
&[data-is-active="true"] {
opacity: 1;
font-weight: var(--sds-fw-medium);
}
&[data-is-clickable="true"] {
cursor: pointer;
}
&[data-is-completed="true"] {
opacity: 0.8;
}
}
Pass undefined (not false) to omit the attribute from the DOM entirely.