MCP HubMCP Hub
スキル一覧に戻る

component-patterns

majiayu000
更新日 Today
21 閲覧
58
9
58
GitHubで表示
メタreactdesign

について

このスキルは、ReactコンポーネントをShadow Masterで整理するためのガイドラインを提供し、特に単一ファイル構造とサブフォルダ構造の選択について説明します。これには、決定フローチャートと、モーダルや再利用可能な行コンポーネントを持つ場合など、サブフォルダを作成する際のルールが含まれています。新しいコンポーネントを作成するときや、キャラクター作成カードを追加するときに使用し、一貫したコード構成を維持してください。

クイックインストール

Claude Code

推奨
プラグインコマンド推奨
/plugin add https://github.com/majiayu000/claude-skill-registry
Git クローン代替
git clone https://github.com/majiayu000/claude-skill-registry.git ~/.claude/skills/component-patterns

このコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします

ドキュメント

Component Organization Patterns

Guidelines for structuring React components in the Shadow Master codebase.

Decision Flowchart

Does the component have modals?
├─ Yes → Create subfolder, extract modals
└─ No → Does it have reusable Row/ListItem components?
        ├─ Yes, used elsewhere → Create subfolder
        └─ No → Keep as single file with internal helpers

When to Use a Subfolder

Create a subfolder with index.ts when:

  • Component has one or more modals (selection dialogs, forms, etc.)
  • Component has reusable row/list item components used in multiple places
  • Component exceeds ~600 lines with clear separable concerns
  • Component has distinct UI pieces that could be tested independently

Subfolder structure:

/components/creation/qualities/
├── QualitiesCard.tsx        # Main card component
├── QualityModal.tsx         # Selection/edit modal
├── QualityRow.tsx           # Optional: if row is complex/reusable
├── index.ts                 # Re-exports public components

Index file pattern:

// index.ts - export only public API
export { QualitiesCard } from "./QualitiesCard";
export { QualityModal } from "./QualityModal"; // Only if used externally

When to Keep as Single File

Keep as a single file when:

  • Component is self-contained with only internal helper components
  • Internal components are tightly coupled and only make sense within the parent
  • Component is under ~400 lines with straightforward structure
  • No modals or independently reusable pieces

Creation Component Subfolders

Current organization (15 directories, 89 total components):

FolderComponentsPattern
/armor4Panel + Row + PurchaseModal + ModModal
/augmentations44 specialized modals
/contacts2Card + Modal + support files
/foci2Card + Modal
/gear4Panel + Row + 2 Modals
/identities6Card + 3 modal types
/knowledge-languages5Card + 2 Row types + 2 Modals
/magic-path2Card + Modal + utilities
/matrix-gear3Card + 2 specialized modals
/metatype2Card + Modal + support files
/qualities3Card + SelectionModal + DetailCard
/shared10Reusable utilities and hooks
/skills55 specialized modals
/vehicles44 specialized modals
/weapons4Row + 3 Modals

Adding a New Character Creation Card

  1. Determine if card needs subfolder (see decision flowchart above)

    • Has modals? → Create subfolder with index.ts
    • Simple with internal helpers? → Single file is fine
  2. Create card component in /components/creation/ or /components/creation/{feature}/

  3. Follow the CreationCard wrapper pattern from /components/creation/shared/

  4. Add to SheetCreationLayout.tsx in the appropriate column

  5. Update CreationState type in /lib/types/creation.ts if needed

  6. Export from /components/creation/index.ts


Adding a New API Endpoint

  1. Create /app/api/{path}/route.ts
  2. Export HTTP method handlers (GET, POST, PUT, DELETE)
  3. Follow authentication pattern (getSession → validate user)
  4. Call storage layer functions
  5. Return JSON responses

Adding a New Ruleset Module

  1. Define module type in /lib/types/edition.ts
  2. Add module to book payload in /data/editions/{editionCode}/
  3. Update merge logic in /lib/rules/merge.ts if special handling needed
  4. Create hook in RulesetContext.tsx for easy access

Key Reference Files

  • components/creation/shared/CreationCard.tsx - Card wrapper pattern
  • components/creation/SkillsCard.tsx - Modal-based editing example
  • components/creation/AugmentationsCard.tsx - Category tabs + list
  • app/characters/create/sheet/components/SheetCreationLayout.tsx - Three-column layout

GitHub リポジトリ

majiayu000/claude-skill-registry
パス: skills/component-patterns

関連スキル

content-collections

メタ

This skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.

スキルを見る

creating-opencode-plugins

メタ

This skill provides the structure and API specifications for creating OpenCode plugins that hook into 25+ event types like commands, files, and LSP operations. It offers implementation patterns for JavaScript/TypeScript modules that intercept and extend the AI assistant's lifecycle. Use it when you need to build event-driven plugins for monitoring, custom handling, or extending OpenCode's capabilities.

スキルを見る

polymarket

メタ

This skill enables developers to build applications with the Polymarket prediction markets platform, including API integration for trading and market data. It also provides real-time data streaming via WebSocket to monitor live trades and market activity. Use it for implementing trading strategies or creating tools that process live market updates.

スキルを見る

cloudflare-turnstile

メタ

This skill provides comprehensive guidance for implementing Cloudflare Turnstile as a CAPTCHA-alternative bot protection system. It covers integration for forms, login pages, API endpoints, and frameworks like React/Next.js/Hono, while handling invisible challenges that maintain user experience. Use it when migrating from reCAPTCHA, debugging error codes, or implementing token validation and E2E tests.

スキルを見る