Skip to content
Back to skills

Component Design

ASecurity

Reactコンポーネントの設計原則と実装ガイドライン

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
developmenttypescriptreactnodetestingfrontend

Works with

  • cli

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill component-design --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Component Design?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Component Design
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-component-design/badge)](https://www.skillsdirectory.com/skills/david-li0406-component-design)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: component-design
description: "Reactコンポーネントの設計原則と実装ガイドライン"
---

# Component Design Skill

## 概要

このSkillは、プロジェクトにおけるReactコンポーネントの設計原則と実装ガイドラインを提供します。

## 基本原則

### 1. 単一責任の原則
- 各コンポーネントは単一の機能・責任を持つ
- 複数の機能が必要な場合は、複数のコンポーネントに分割する

### 2. 再利用可能性
- プロジェクト全体で再利用可能なコンポーネントを作成する
- プロパティ(props)による柔軟なカスタマイズを可能にする

### 3. 型安全性
- TypeScriptの型定義を必須とする
- プロパティ、状態、イベントハンドラーは全て型定義する

### 4. Co-location(共存配置)
- 機能固有のコンポーネントは関連するページの近くに配置する
- `_components` ディレクトリを使用してページ固有のコンポーネントを管理する
- 複数のページで共有されるコンポーネントのみ `src/components/` に配置する

## 詳細ドキュメント

各カテゴリの詳細な規約は以下を参照してください:

- [ディレクトリ構造](./reference/directory-structure.md) - ファイル配置とディレクトリ設計
- [Props設計パターン](./reference/props-patterns.md) - Props設計とイベントハンドリング
- [スタイリングガイド](./reference/styling-guide.md) - Panda CSSを使用したスタイリング規約

## クイックリファレンス

### ディレクトリ構造

```
src/
├── components/
│   ├── ui/                 # 基本的なUIコンポーネント
│   │   ├── Button/
│   │   ├── Input/
│   │   └── ...
│   └── shared/             # 共通コンポーネント(レイアウト含む)
│       ├── Header/
│       ├── Footer/
│       └── ...
└── app/
    ├── dashboard/
    │   ├── page.tsx
    │   └── _components/    # ページ固有のコンポーネント
    │       ├── DashboardChart/
    │       └── StatsCard/
    └── ...
```

### コンポーネント命名規則

- **ファイル名**: PascalCase(例: `Button.tsx`, `UserProfile.tsx`)
- **例外**: shadcn/uiコンポーネントはkebab-case(例: `button.tsx`)

### コンポーネントディレクトリ構造

```
ComponentName/
├── index.tsx           # コンポーネント本体
└── styles.ts          # Panda CSS スタイル定義(必要に応じて)
```

### 基本的な型定義

```typescript
interface ButtonProps {
  children: React.ReactNode;
  variant?: "primary" | "secondary" | "danger";
  size?: "sm" | "md" | "lg";
  disabled?: boolean;
  onClick?: () => void;
}
```

## チェックリスト

新しいコンポーネントを作成する際の確認事項:

- [ ] 適切なディレクトリに配置されている
- [ ] TypeScript の型定義が完全
- [ ] Panda CSS でスタイリングされている
- [ ] プロパティのデフォルト値が設定されている
- [ ] アクセシビリティが考慮されている
- [ ] 単体テストが実装されている

## 関連Skill・ドキュメント

- [coding-standards](../einja-coding-standards/SKILL.md) - コーディング規約
- `docs/einja/steering/development/testing-strategy.md` - テスト戦略
- `docs/einja/steering/development/frontend-development.md` - フロントエンド開発ガイド

## 参考資料

- [React 公式ドキュメント](https://react.dev)
- [TypeScript 公式ドキュメント](https://www.typescriptlang.org)
- [Panda CSS ドキュメント](https://panda-css.com)

Files in this skill

  • SKILL.md3.7 KB
  • reference/directory-structure.md3.6 KB
  • reference/frontend-development.md67 B
  • reference/props-patterns.md3.1 KB
  • reference/styling-guide.md3.6 KB
  • reference/testing-strategy.md63 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…