Claude-skill-registry create-standard-component

표준 RNBT 컴포넌트를 생성합니다. 페이지가 GlobalDataPublisher로 데이터를 제어합니다.

install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/create-standard-component" ~/.claude/skills/majiayu000-claude-skill-registry-create-standard-component && rm -rf "$T"
manifest: skills/data/create-standard-component/SKILL.md
source content

표준 컴포넌트 생성

페이지가 GlobalDataPublisher로 데이터를 제어하고, 컴포넌트는 구독만 합니다.


⚠️ 작업 전 필수 확인

코드 작성 전 반드시 다음 파일들을 Read 도구로 읽으세요. 이전에 읽었더라도 매번 다시 읽어야 합니다 - 캐싱하거나 생략하지 마세요.

  1. /RNBT_architecture/README.md - 아키텍처 이해
  2. /.claude/guides/CODING_STYLE.md - 코딩 스타일

핵심 원칙

1. 역할 분리

페이지 = 오케스트레이터
- 데이터 정의 (globalDataMappings)
- Interval 관리 (refreshIntervals)
- 이벤트 핸들러 등록 (eventBusHandlers)

컴포넌트 = 독립적 구독자
- topic 구독 (subscriptions)
- 이벤트 발행 (@eventName)
- 렌더링만 집중

2. 메서드 분리 (재사용성)

핵심: 컴포넌트 재사용을 위해 메서드를 철저히 분리한다.

// 고정 (재사용)
function renderChart(config, { response }) {
    const { optionBuilder, ...chartCfg } = config;
    const option = optionBuilder(chartCfg, data);
    this.chartInstance.setOption(option, true);
}

// 가변 (컴포넌트별)
const chartConfig = { optionBuilder: getChartOption };
this.renderChart = renderChart.bind(this, chartConfig);
구분역할재사용
renderChart / renderTable규격화된 렌더링 함수O (고정)
chartConfig / tableConfig데이터 매핑 + 옵션X (컴포넌트별)
optionBuilderECharts/Tabulator 옵션 생성X (컴포넌트별)

3. 이벤트 처리 기준

페이지가 알아야 하는가?처리예시
아니오
_internalHandlers
Clear, Toggle
customEvents
+
bindEvents
행 선택, 필터 변경

4. 응답 구조

// response 키가 한 번 더 감싸져 있음
function renderData(config, { response }) {
    const { data, meta } = response;
}

출력 구조

[ComponentName]/
├── views/component.html
├── styles/component.css
├── scripts/
│   ├── register.js
│   └── beforeDestroy.js
├── preview.html
└── README.md

핵심 패턴

PUB-SUB (GlobalDataPublisher)

this.subscriptions = {
    topicA: ['renderData'],
    topicB: ['renderList', 'updateCount']
};

Event-Driven (Weventbus)

this.customEvents = {
    click: { '.btn-refresh': '@refreshClicked' },
    change: { '.filter-select': '@filterChanged' }
};

금지 사항

  • ❌ 컴포넌트가 직접 fetch (팝업 없이)
  • ❌ 생성 후 정리 누락
  • function(response)
    사용 →
    function({ response })
    필수

관련 자료

문서위치
예제/RNBT_architecture/Examples/SimpleDashboard/