Skip to content
cccskills
FreePublished on GitHub

custom-component

비대한 React 컴포넌트를 스코프별 서브 컴포넌트로 분리, 시맨틱 HTML 적용, 전용 서브디렉토리 구조화

The English summary is being prepared. Showing the original description.

See how to install

Files included (1)

  • SKILL.md3.4 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Custom Component

비대한 React 컴포넌트의 스코프별 서브 컴포넌트 분리, 시맨틱 HTML 적용, 전용 서브디렉토리 구조화.

When to Activate

  • 단일 컴포넌트가 100줄 이상이고 여러 시각적/논리적 영역을 포함할 때
  • 컴포넌트 내부에 조건부 렌더링이 복잡하게 얽혀 있을 때
  • $ARGUMENTS로 대상 컴포넌트 파일 경로가 주어질 때

Workflow

1단계: 분석

  1. 대상 컴포넌트 파일 읽기
  2. 해당 컴포넌트의 사용처와 의존성 Grep 파악
  3. 프로젝트 내 기존 컴포넌트 분리 패턴 탐색 (예: tier-card/ 패턴)

2단계: 분리 설계

  1. 시각적/논리적 영역별 분리 지점 식별
  2. 각 영역에 적합한 시맨틱 HTML 태그 매핑:
    • 페이지 섹션 → <section>
    • 도입부/제목 → <header>
    • 보조/장식 콘텐츠 → <aside>
    • 이름-값 쌍 → <dl>/<dt>/<dd>
    • 동적 알림 → role="alert"
  3. 각 서브 컴포넌트의 책임과 props interface 정의

3단계: 서브 컴포넌트 생성

  1. 의존성 없는 서브 컴포넌트부터 생성 (leaf → root 순서)
  2. 레이아웃 컴포넌트는 children: ReactNode 기반 composition 패턴 사용
  3. prop pass-through 발생 시 children composition 대체

4단계: 오케스트레이터 리팩터

  1. 오케스트레이터 JSX는 HTML 태그 없이 컴포넌트만 조합:
    <Layout>
      <Content>
        <ChildA ... />
        <ChildB />
      </Content>
      <Sidebar />
    </Layout>
    
  2. 오케스트레이터 로직(상태, 이펙트, 핸들러, API 호출)은 전용 훅으로 분리 (/custom-hook 참조)
  3. 서브 컴포넌트로 이동한 import 정리

5단계: 디렉토리 구조화

  1. 오케스트레이터 전용 서브 모듈은 동명 서브디렉토리 안의 _components/, _hooks/로 분류:
    component.tsx
    component/
      _components/
        sub-a.tsx
        sub-b.tsx
      _hooks/
        use-sub-action.ts
    
  2. 서브 컴포넌트 전용 훅은 _hooks/ 하위 배치, 전용 서브 훅은 훅 동명 서브디렉토리에 배치:
    component/
      _hooks/
        use-sub-action.ts
        use-sub-action/
          use-state.ts
          use-auth.ts
    
  3. 다른 곳에서도 사용되는 독립 컴포넌트/훅은 상위 디렉토리에 유지
  4. import 경로 업데이트

6단계: 검증

  1. pnpm build 성공 확인
  2. pnpm lint 통과 확인
  3. 시각적 변경 없음 확인 (Tailwind preflight가 시맨틱 태그 기본 스타일 초기화)

Constraints

  • 오케스트레이터 JSX의 HTML 태그 금지 — 컴포넌트만 조합
  • prop pass-through 대신 children composition 패턴 우선
  • 프로젝트 코드 규칙 준수 (CLAUDE.md 참조): arrow function, named export, Tailwind only 등
  • 기존 프로젝트 분리 패턴(tier-card/ 등) 기준 일관성 유지

Success Criteria

  • 오케스트레이터 return문의 HTML 태그 없음
  • 각 서브 컴포넌트의 단일 책임
  • 전용 서브 컴포넌트의 하위 디렉토리 격리
  • 빌드/린트 통과
  • 시각적 변경 없음

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

commit

Free

커밋 생성. 변경사항 분석 후 .claude/skills/commit 기준 커밋 메시지 작성과 커밋 실행

The English summary is being prepared. Showing the original description.

OU9999/codex-webtoon14Updated Jul 1, 2026

비대한 React 컴포넌트의 스코프별 서브 컴포넌트 분리. .claude/skills/custom-component 기준

The English summary is being prepared. Showing the original description.

OU9999/codex-webtoon14Updated Jul 1, 2026

비대한 커스텀 훅을 스코프별 서브 훅으로 분리, composer 패턴 적용, 전용 서브디렉토리 구조화

The English summary is being prepared. Showing the original description.

OU9999/codex-webtoon14Updated Jul 1, 2026

비대한 커스텀 훅의 스코프별 서브 훅 분리. .claude/skills/custom-hook 기준

The English summary is being prepared. Showing the original description.

OU9999/codex-webtoon14Updated Jul 1, 2026

deploy

Free

배포. release 브랜치 main 반영, 빌드 검증, push 실행. .claude/skills/deploy 기준

The English summary is being prepared. Showing the original description.

OU9999/codex-webtoon14Updated Jul 1, 2026

웹 테스트, 폼 입력, 스크린샷, 데이터 추출 등 브라우저 자동화. .claude/skills/playwright-cli 기준

The English summary is being prepared. Showing the original description.

OU9999/codex-webtoon14Updated Jul 1, 2026

See all skills by OU9999

Report a problem with this skill