Loading...
Loading...
Enforce consistent React component naming conventions using domain + role patterns. Use when creating, reviewing, or refactoring components.
npx skill4agent add sgcarstrends/sgcarstrends component-naming// ✅ Good
export const TrendChart = () => {};
export const HeroPost = () => {};
// ❌ Bad
export const trendChart = () => {};
export const trend_chart = () => {};// ✅ Good - Clear domain and role
export const TrendChart = () => {}; // Trend (domain) + Chart (role)
export const HeroPost = () => {}; // Hero (domain) + Post (role)
export const MetricCard = () => {}; // Metric (domain) + Card (role)
export const LatestCoePremium = () => {}; // LatestCoe (domain) + Premium (role)
// ❌ Bad - Too generic or unclear
export const Chart = () => {}; // No domain context
export const Data = () => {}; // Meaningless
export const Item = () => {}; // No specificity// ✅ Good - Compound component pattern
export const HeroPost = () => {};
HeroPost.Image = () => {};
HeroPost.Title = () => {};
HeroPost.Meta = () => {};
// Usage
<HeroPost>
<HeroPost.Image src={...} />
<HeroPost.Title>...</HeroPost.Title>
<HeroPost.Meta date={...} />
</HeroPost>
// ❌ Bad - Flat naming for related components
export const HeroPostImage = () => {};
export const HeroPostTitle = () => {};
export const HeroPostMeta = () => {};// ❌ Avoid these suffixes
export const MetricCardContainer = () => {}; // -Container
export const ChartWrapper = () => {}; // -Wrapper
export const DataComponent = () => {}; // -Component
export const ListElement = () => {}; // -Element
// ✅ Use clear domain + role instead
export const MetricCard = () => {};
export const TrendChart = () => {};
export const RegistrationList = () => {};// ❌ Bad - Describes layout/styling
export const LeftSidebar = () => {};
export const BigHeader = () => {};
export const RedButton = () => {};
export const TwoColumnLayout = () => {};
// ✅ Good - Describes purpose
export const NavigationSidebar = () => {};
export const PageHeader = () => {};
export const DangerButton = () => {};
export const ComparisonLayout = () => {};| Component | File Name |
|---|---|
| |
| |
| |
| |
TrendAreaChartMarketShareDonutTopMakesChartPremiumBannerMetricCardLatestCoePremiumChartCardListDataLeftPanelMainContentTopSectionCardContainerListWrapperItemComponentapps/web/CLAUDE.mdapps/web/src/components/apps/web/src/app/admin/components/