Marketplace

applying-frontend-patterns

Framework-agnostic frontend component design patterns. Triggers: React, Vue, Angular, コンポーネント, パターン, hooks, カスタムフック, container, presentational, 分離, 状態管理, state management, composition, HOC, render props

allowed_tools: Read, Grep, Glob, Task

$ インストール

git clone https://github.com/thkt/claude-config /tmp/claude-config && cp -r /tmp/claude-config/skills/applying-frontend-patterns ~/.claude/skills/claude-config

// tip: Run this command in your terminal to install the skill


name: applying-frontend-patterns description: > Framework-agnostic frontend component design patterns. Triggers: React, Vue, Angular, コンポーネント, パターン, hooks, カスタムフック, container, presentational, 分離, 状態管理, state management, composition, HOC, render props allowed-tools: Read, Grep, Glob, Task user-invocable: false

Frontend Patterns

Purpose

Component design patterns for maintainable frontend architecture. Patterns are universal; implementations differ by framework.

Core Patterns Overview

PatternConceptWhen to Use
Container/PresentationalSeparate logic from UIData fetching + display
Custom Hooks (React)Reusable stateful logicShared behavior across components
CompositionBuild complex from simpleFlexible, reusable components
State ManagementOrganize application dataLocal → Shared → Global

Container/Presentational Pattern

Key Principle: Separate concerns

Container (Logic)Presentational (UI)
Fetches dataReceives data via props
Manages stateStateless (ideally)
Handles eventsCalls callback props
No stylingAll styling lives here

Application Rule:

  1. Start with Presentational (UI only, props-driven)
  2. Add Container when logic is needed
  3. Extract to custom hooks when reusable

Hooks Guidelines (React)

HookUse ForPitfall to Avoid
useEffectSide effectsMissing dependencies
useMemoExpensive computationsPremature optimization
useCallbackStable function refsOver-memoization
Custom hooksReusable logicNot starting with use

Dependencies Rule: Always include all values used inside the effect.

State Management Strategy

ScopeTool (React)Example
LocaluseStateForm input, toggle
SharedContextTheme, auth status
GlobalZustand/ReduxApp-wide cache

Granularity Rule: Split large state objects into separate states.

Composition Patterns

PatternUse Case
childrenWrapper components, cards, modals
render propsDynamic rendering based on data
HOCCross-cutting concerns (auth, logging)

Framework Comparison

PatternReactVueAngular
SeparationContainer/PresentationalComposition APISmart/Dumb
StateuseState, Contextref, reactiveServices
Side effectsuseEffectwatch, onMountedngOnInit
Slotschildrenslotsng-content

When NOT to Use Patterns

  • Simple one-off components
  • Prototypes (YAGNI)
  • No reuse expected

Rule: Add patterns when pain is felt, not anticipated.

References

Patterns

Related Skills

  • frontend-design (official) - Visual design quality (typography, color, animation)
  • enhancing-progressively - CSS-first progressive enhancement
  • integrating-storybook - Component visualization

Used by Commands

  • /code --frontend - React component implementation
  • /audit - Frontend pattern verification

See Also

  • /example-skills:frontend-design - Official skill for distinctive UI aesthetics