← スキル一覧に戻る

react-component
by BumgeunSong
Writing App
⭐ 6🍴 0📅 2026年1月17日
SKILL.md
name: react-component description: Use when creating or modifying React components (.tsx files). Enforces component structure, import order, and hooks patterns.
React Component Patterns
Component Structure
Follow this order in every component file:
// 1. External imports
import { useState } from 'react';
import { useQuery } from '@tanstack/react-query';
// 2. Internal shared imports
import { Button } from '@/shared/ui/button';
import { useAuth } from '@/shared/hooks/useAuth';
// 3. Feature-specific imports
import { usePostEditor } from '../hooks/usePostEditor';
// 4. Types
interface PostEditorProps {
boardId: string;
initialContent?: string;
}
// 5. Component
export function PostEditor({ boardId, initialContent }: PostEditorProps) {
// hooks first
// derived state
// handlers
// render
}
Custom Hooks Pattern
Place business logic in [feature]/hooks/:
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { createPost } from '../api/post';
export function usePostEditor(boardId: string) {
const queryClient = useQueryClient();
const createMutation = useMutation({
mutationFn: (data: CreatePostData) => createPost(boardId, data),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['posts', boardId] });
},
});
return { createMutation };
}
Path Aliases
import { Component } from '@/shared/components/Component';
import { useHook } from '@board/hooks/useHook';
import { Post } from '@post/model/Post';
// Available: @/, @board/, @post/, @comment/, @draft/,
// @notification/, @user/, @shared/, @login/, @stats/
Quick Reference
| Location | Purpose |
|---|---|
[feature]/components/ | React components |
[feature]/hooks/ | Custom hooks with business logic |
[feature]/model/ | TypeScript types |
@/shared/ui/ | shadcn/ui components |
@/shared/hooks/ | Shared hooks |
スコア
総合スコア
50/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です