一键导入
components
Component file structure and organization patterns for React components in this repository
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Component file structure and organization patterns for React components in this repository
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
How to build UI in this repo — the bui (@backstage/ui) design system vs legacy @backstage/core-components + MUI v4, which to reach for, and how to read Backstage Storybook component/story source. Use when creating or changing pages, cards, layouts, buttons, or any frontend component.
Patterns for implementing tables. Covers the bui Table ('@backstage/ui') — preferred for new, simple tables — and the feature-rich '@backstage/core-components' Table with search, filtering, and column-visibility persistence.
Common rules for working with this repository
Read, classify, and triage Sentry issues for this Backstage app, propose mitigations, and decide their disposition (fix, resolve, mute, or escalate). Use when given a Sentry issue URL (giantswarm.sentry.io/issues/...), asked to investigate a Sentry error/exception/CSP violation, asked why an image/script/style/font was blocked on a page, or asked to mute/ignore noisy Sentry issues.
Build Backstage backend plugins with createBackendPlugin and core services: DI, httpRouter, secure-by-default auth, Knex DB, routes, testing. Use for APIs and background jobs.
Build Backstage frontend plugins with the new Frontend System: createFrontendPlugin, blueprints, routes, Utility APIs, testing. Use for pages, nav, entity content, or cards.
| name | components |
| description | Component file structure and organization patterns for React components in this repository |
Each React component should be placed in its own directory with the same name as the component. The directory must contain:
ComponentName.tsx - Contains the component implementationindex.ts - Re-exports the component using named exportscomponents/
MyComponent/
MyComponent.tsx # Component implementation
index.ts # Named export: export { MyComponent } from './MyComponent';
AnotherComponent/
AnotherComponent.tsx
index.ts
The index.ts file should use named exports (not default exports):
// ✅ Correct - named export
export { MyComponent } from './MyComponent';
// ✅ Correct - with types
export { MyComponent } from './MyComponent';
export type { MyComponentProps } from './MyComponent';
// ❌ Incorrect - default export
export { default as MyComponent } from './MyComponent';
Component directories may also contain:
columns.tsx, helpers.ts, types.ts for component-specific utilitiesMyComponent.test.tsx for unit testsuseMyComponent.ts for component-specific hookscomponents/
DataTable/
DataTable.tsx # Main component
columns.tsx # Column definitions
helpers.ts # Helper functions
types.ts # Type definitions
index.ts # export { DataTable } from './DataTable';
When importing components from other locations, import from the directory (which resolves to index.ts):
// ✅ Correct - import from directory
import { MyComponent } from '../MyComponent';
import { ChartSelector } from './ChartSelector';
// ❌ Incorrect - import directly from file
import { MyComponent } from '../MyComponent/MyComponent';
Parent directories should have their own index.ts that re-exports child components:
// components/charts/index.ts
export { ChartProvider, useCurrentChart } from './ChartContext';
export type { Chart, ChartProviderProps } from './ChartContext';
export { ChartSelector } from './ChartSelector';
This allows clean imports from the parent directory:
import { ChartProvider, useCurrentChart, ChartSelector } from '../../charts';