Command Palette

Search for a command to run...

Назад к скиллам
скилл № 66769

frontend-patterns

Use when the user asks about frontend component patterns: compound components, container/presentational, custom hooks, render props, HOCs, provider pattern…

БесплатноБез исполняемых скриптов
j4flmaoот j4flmao★ 47 звёзд на GitHub

Установить frontend-patterns в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Frontend Design Patterns

Purpose

Select and implement frontend component patterns that solve specific architectural problems with idiomatic framework code.

Agent Protocol

Trigger

User request includes: frontend pattern, component pattern, react pattern, vue pattern, container pattern, hoc, render prop, compound component, hooks pattern, provider pattern, composable.

Input Context

  • Framework (React, Vue, Angular, Svelte, Solid)
  • Component hierarchy and data flow
  • Current pain points (prop drilling, re-renders, complex state logic)
  • Performance requirements

Output Artifact

A markdown document containing:

  • Selected pattern(s) with code examples
  • Pattern selection rationale (why pattern A over pattern B)
  • Refactoring plan if converting existing code
  • Testing strategy for the pattern

Response Format

Produce the artifact directly. No preamble. No postamble. No explanations. No filler/hedging/transitions. Compress output — why use many token when few do trick. If no pattern applies, output No pattern required. Current approach is sufficient. and stop.

——

Completion Criteria

  • Pattern implementation idiomatic to target framework
  • Selection criteria documented with rejected alternatives
  • Testing strategy included
  • Edge cases covered (loading, error, empty states)

Max Response Length

4096 tokens

Pattern Architecture / Decision Trees

Pattern Selection Decision Tree

What problem are you solving?

  |-- Logic scattered across lifecycle methods? -->
  |     |-- React: Custom Hooks (preferred) or HOC (legacy only)
  |     |-- Vue: Composables
  |     |-- Angular: Services + RxJS
  |     |-- Svelte: Store + reactive statements
  |
  |-- Prop drilling (>3 levels)? -->
  |     |-- React/Vue: Provider/Context pattern
  |     |-- Angular: DI + services
  |     |-- Alternative: Component composition (restructure tree)
  |
  |-- Complex multi-part UI (Tabs, Accordion, Select)? -->
  |     |-- Compound Components with context-based state
  |     |-- Each sub-component shares state via parent context
  |
  |-- Cross-cutting concern across many components? -->
  |     |-- HOC (for pre-render wrapping like auth guards)
  |     |-- Hooks (for functional composition)
  |     |-- Provider (for global state like theme, locale)
  |
  |-- Dynamic rendering logic sharing? -->
  |     |-- Render Props (when consumer needs rendering control)
  |     |-- Slots (Vue/Svelte native slot pattern)
  |
  |-- Need to override internal component behavior? -->
        |-- State Reducer pattern (for reusable component libraries)
        |-- Strategy pattern (pass behavior as prop)

Composition vs Configuration Decision Tree

How many variations does the component have?
  |-- Few variations (2-3) -->
  |     Props-based configuration is fine
  |     Example: <Button variant="primary" size="md" />
  |
  |-- Many variations (4+), composable parts -->
  |     Composition preferred
  |     Example: <Card><Card.Header><Card.Body><Card.Footer>
  |
  |-- Consumer needs full rendering control -->
        Render props / slots
        Example: <DataTable columns={...} renderRow={(row) => ...} />

Workflow

Step 1: Identify the Problem

Analyze component hierarchy, data flow, and current pain points (prop drilling, re-renders, complex state logic).

Step 2: Select the Pattern

Use the pattern selection table to match the problem to the appropriate pattern.

Step 3: Implement the Pattern

Write idiomatic framework code following the pattern catalog examples.

Step 4: Write Tests

Implement tests per pattern type using the testing strategy table.

Step 5: Review Edge Cases

Cover loading, error, and empty states for every component.

Rules

  • Prefer hooks over HOC since React 16.8 — use HOC only for legacy components or pre-render wrapping
  • Prefer hooks over Render Props since React 16.8 — use render props only for render-prop-only libraries
  • One hook per concern — single responsibility at the hook level
  • Return stable references from hooks to avoid infinite re-render loops
  • Use Provider only when data is needed by 3+ levels of nesting — prop drilling is fine for 2 levels
  • Compound components are for multi-part UI with shared state (Select, Tabs, Accordion), not single-element components
  • State Reducer pattern is only justified for reusable component libraries, not internal-only components
  • Container/Presentational split when a component has 3+ state variables or data sources

Pattern Catalog

1. Container / Presentational

Intent: Separate logic (container) from rendering (presentational).

// Container (handles data, state, events)
function OrderListContainer() {
  const { data, isLoading, error } = useOrders();
  if (isLoading) return <Loading />;
  if (error) return <ErrorState message={error.message} />;
  return <OrderListPresentation orders={data} onSelect={handleSelect} />;
}

// Presentational (pure rende
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • references/component-patterns.md
  • references/composition-patterns.md
  • references/frontend-security.md
  • references/frontend-testing.md
  • references/hooks-patterns.md
  • references/rendering-patterns.md

FAQ

Что делает скилл frontend-patterns?

Use when the user asks about frontend component patterns: compound components, container/presentational, custom hooks, render props, HOCs, provider pattern, state reducer or headless components. Produces pattern choices with framework examples. Not for app folder structure (use react-architecture) or picking a state library (use frontend-state-management).

Как установить скилл frontend-patterns?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл frontend-patterns запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить frontend-patterns с