Skip to content
Back to skills

React Design Patterns

ASecurity

Enforce industry-standard design patterns for React applications as defined by Patterns.dev. This skill focuses on code reusability, performance optimization, and clean architectural separation of concerns (SoC). It ensures that every React component added to the Sovereign Factory follows world-class engineering standards.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 24, 2026
code-qualityreactapiperformance

Works with

  • api

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned November 24, 2026

npx -y skills add iDorgham/Workspace-Factory --skill react-design-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of React Design Patterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for React Design Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/idorgham-react-design-patterns/badge)](https://www.skillsdirectory.com/skills/idorgham-react-design-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
type: Skill
subagents: [core-validator, integrity-bot]
agents: [master-guide, swarm-router]
dependencies: [core-orchestration, global-sync]
version: 1.0.0
---



# ⚛️ React Design Patterns (Patterns.dev)

## Purpose
Enforce industry-standard design patterns for React applications as defined by Patterns.dev. This skill focuses on code reusability, performance optimization, and clean architectural separation of concerns (SoC). It ensures that every React component added to the Sovereign Factory follows world-class engineering standards.

---

## Technique 1 — HOC & Render Props (Cross-Cutting Concerns)
- **Rule**: Use High-Order Components (HOC) or Render Props to share logic between multiple components without duplicating code.
- **Protocol**: 
    1. Identify shared logic (e.g., authentication checks, data fetching, logging).
    2. Encapsulate the logic in an HOC (e.g., `withAuth`) or a Render Prop component (e.g., `UserData`).
    3. Wrap or inject the logic into the target "Presentational" component.
    4. Benefit: Keeps the UI code clean and allows the "Logic" to be tested and maintained in isolation.

---

## Technique 2 — Compound Components (Implicit State)
- **Rule**: Use the Compound Component pattern for complex UI sets (e.g., Tabs, Accords, Dropdowns) to allow users more control over the rendered structure while maintaining internal state consistency.
- **Protocol**: 
    1. Create a parent "Context" provider.
    2. Create child sub-components (e.g., `Tabs.Trigger`, `Tabs.Content`).
    3. Use `React.Children.map` or Context to pass required state (active index, handlers) implicitly.
    4. Benefit: Eliminates "Prop Drilling" and provides a clean, declarative API.

---

## 🛡️ Critical Failure Modes (Anti-Patterns)

| Anti-Pattern | Result | Correction |
| :--- | :--- | :--- |
| **Fat Components** | Reduced maintainability | Break down components that exceed 200 lines into smaller, atomic sub-components. |
| **Over-Using Context** | "Re-render Hell" | Use Context only for global data (Theme, Auth); use local state or specialized stores (Zustand) for tactical data. |
| **Prop Drilling (Depth > 3)** | Brittle data flow | Use the Compound Component pattern or a global store to pass data to deep children. |

---

## Success Criteria (React QA)
- [ ] 100% of complex UI elements (Tabs, Modals) use the Compound Component pattern.
- [ ] "Logic-heavy" components are split into a "Container" (logic) and "Presentational" (UI) pair.
- [ ] Memoization (`useMemo`, `useCallback`) is applied to prevent unnecessary re-renders in large lists.
- [ ] Component architecture passes the standard "Patterns.dev" quality audit.

Files in this skill

  • SKILL.md2.6 KB
  • core.py371 B
  • manifest.yaml190 B
  • tests/test_core.py311 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in code-quality →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.