smithery/shosan16

react-components

Next.js 15のReactコンポーネント設計パターンを提供します。新しいコンポーネント作成時、既存コンポーネント修正時に参?

Installation

$ npx skills add smithery/shosan16 --skill react-components

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery/shosan16.

npx skills add smithery/shosan16

Browse all from smithery/shosan16

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,939 B
  • docs SUMMARY.md 210 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

React/Next.js コンポーネント設計

Server Components 優先

デフォルトは Server Component。以下の場合のみ 'use client'

  • イベントハンドラ(onClick, onChange等)
  • useState, useEffect 等のフック使用
  • ブラウザAPIアクセス
// Server Component(デフォルト)
export default async function Page() {
  const data = await fetchData();
  return <List items={data} />;
}
// Client Component
'use client';
export function Counter() {
  const [count, setCount] = useState(0);
  return <button onClick={() => setCount((c) => c + 1)}>{count}</button>;
}

ディレクトリ構造

src/client/features/{feature}/
├── components/
│   └── {ComponentName}/
│       ├── {ComponentName}.tsx
│       ├── {ComponentName}.test.tsx
│       └── index.ts
├── hooks/
├── utils/
└── types/

コンポーネント構成

type ButtonProps = {
  variant: 'primary' | 'secondary';
  children: React.ReactNode;
  onClick?: () => void;
};

export function Button({ variant, children, onClick }: ButtonProps) {
  return (
    <button className={cn(baseStyles, variantStyles[variant])} onClick={onClick}>
      {children}
    </button>
  );
}

最適化

  • 不要な再レンダリング防止: React.memo, useMemo, useCallback
  • 画像: next/image 使用
  • フォント: next/font 使用

アクセシビリティ

  • セマンティックHTML
  • ARIA属性
  • キーボードナビゲーション

状態管理パターン

  • ローカル状態: useState
  • サーバー状態: SWR / TanStack Query
  • グローバル状態: Zustand