Skip to content
Back to skills

Hoc Pattern

ASecurity

Enforce standards for cross-cutting concerns using Higher-Order Components. While modern React favors Hooks, HOCs remain vital for certain library integrations and legacy codebase maintenance.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 24, 2026
toolsreactdebuggingperformance

Works with

  • terminal
  • cli

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 hoc-pattern --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Hoc Pattern?

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

Security grade badge for Hoc Pattern
[![Security: A β€” Skills Directory](https://www.skillsdirectory.com/api/skills/idorgham-hoc-pattern/badge)](https://www.skillsdirectory.com/skills/idorgham-hoc-pattern)

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 HOC (Higher-Order Components) Pattern

## Purpose
Enforce standards for cross-cutting concerns using Higher-Order Components. While modern React favors Hooks, HOCs remain vital for certain library integrations and legacy codebase maintenance.

---

## Technique 1 β€” The "Pure" Wrapper
- **Rule**: Never mutate the original component; always return a new wrapper.
- **Protocol**: 
    1. Pass through all props that aren't specifically used by the HOC.
    2. Coordinate `displayName` for better debugging (e.g., `WithAuth(BaseComponent)`).
    3. Ensure refs are forwarded using `React.forwardRef`.

---

## Technique 2 β€” Composable Enhancements
- **Composition**: Structure HOCs such that they can be chained (e.g., `compose(withAuth, withLogger)(Component)`).
- **Static Hoisting**: Use `hoist-non-react-statics` to ensure static methods of the wrapped component aren't lost.

---

## πŸ›‘οΈ Critical Failure Modes (Anti-Patterns)

| Anti-Pattern | Result | Correction |
| :--- | :--- | :--- |
| **HOC in Render** | Component remounts/State loss | Always define HOC wrappers outside the component's render method. |
| **Prop Collision** | Overwritten data | Prefix HOC-injected props to avoid name clashes with user-passed props. |
| **Ref Loss** | Fragmented DOM access | Always use `forwardRef` in the HOC wrapper. |

---

## Success Criteria (HOC QA)
- [ ] Wrapper preserves all static methods of the child.
- [ ] `displayName` is properly set for DevTools.
- [ ] Prop-passing uses the spread operator for pass-through.
- [ ] No HOCs are defined inside of a component's body.
## πŸ“˜ Description
This component is part of the AIWF sovereign library, designed for industrial-scale orchestration and autonomous execution.
It has been optimized for terminal equilibrium and OMEGA-tier performance.

## πŸš€ Usage
Integrated via the Swarm Router v3 or invoked directly via the CLI.
It supports recursive self-healing and dynamic skill injection.

## πŸ›‘οΈ Compliance
- **Sovereign Isolation**: Level 4 (Absolute)
- **Industrial Readiness**: OMEGA-Tier (100/100)
- **Data Residency**: Law 151/2020 Compliant
- **Geospatial Lock**: Active

## πŸ“ Change Log
- 2026-04-24: Initial OMEGA-tier industrialization.
- 2026-04-24: High-density metadata injection for terminal certification.

## πŸ“˜ Description
This component is part of the AIWF sovereign library, designed for industrial-scale orchestration and autonomous execution.
It has been optimized for terminal equilibrium and OMEGA-tier performance.

## πŸš€ Usage
Integrated via the Swarm Router v3 or invoked directly via the CLI.
It supports recursive self-healing and dynamic skill injection.

## πŸ›‘οΈ Compliance
- **Sovereign Isolation**: Level 4 (Absolute)
- **Industrial Readiness**: OMEGA-Tier (100/100)
- **Data Residency**: Law 151/2020 Compliant
- **Geospatial Lock**: Active

## πŸ“ Change Log
- 2026-04-24: Initial OMEGA-tier industrialization.
- 2026-04-24: High-density metadata injection for terminal certification.

## πŸ“˜ Description
This component is part of the AIWF sovereign library, designed for industrial-scale orchestration and autonomous execution.
It has been optimized for terminal equilibrium and OMEGA-tier performance.

## πŸš€ Usage
Integrated via the Swarm Router v3 or invoked directly via the CLI.
It supports recursive self-healing and dynamic skill injection.

## πŸ›‘οΈ Compliance
- **Sovereign Isolation**: Level 4 (Absolute)
- **Industrial Readiness**: OMEGA-Tier (100/100)
- **Data Residency**: Law 151/2020 Compliant
- **Geospatial Lock**: Active

## πŸ“ Change Log
- 2026-04-24: Initial OMEGA-tier industrialization.
- 2026-04-24: High-density metadata injection for terminal certification.

Files in this skill

  • SKILL.md3.8 KB
  • core.py342 B
  • manifest.yaml170 B
  • tests/test_core.py284 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 tools β†’

Comments

Loading comments…

Newsletter

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