← スキル一覧に戻る

tsx-modular-component-pattern
by TrueNine
⭐ 1🍴 1📅 2025年12月3日
SKILL.md
name: tsx-modular-component-pattern description: Guide for outputting React/TSX components by prioritizing reusable sub-components, controlling length, and declaring them as const before the main component to ensure clear structure and maintainability.
Component Structure
When generating React/TSX components, follow these structural points to maintain information focus under Primacy/Recency:
- Decompose logically related UI modules into independent sub-components, ensuring each handles a single responsibility.
- Declare all sub-components as
constbefore the main component, making dependency order clear at a glance. - Keep each sub-component within 30-40 lines, continue decomposing to finer granularity if needed.
- Use semantic naming (e.g.,
VideoOverlay,ActionButton,CreatorInfo) for quick retrieval and reuse. - Use Props to clarify data and event flow, let main component only handle assembly and state dispatch.
- Regularly review if sub-components can be extracted to shared directory to avoid duplicate implementations.
Reference example:
// Sub-components defined first
const PlayOverlay = ({ isPlaying, onToggle }: PlayOverlayProps) => (
<div className="...">...</div>
)
const ActionButtons = ({ likes, comments }: ActionButtonsProps) => (
<div className="...">...</div>
)
// Main component uses sub-components
export function VideoFeed({ videos }: VideoFeedProps) {
return (
<div>
{videos.map(v => (
<PlayOverlay ... />
<ActionButtons ... />
))}
</div>
)
}
Final confirmation: Main component handles orchestration, sub-components handle details, achieving a stable pipeline of "decompose first, then compose".
スコア
総合スコア
60/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です