ui-patterns

Enforce a four-layer pattern separating data handling, business logic, and presentation in React components.

Updated Mar 1, 2026
One-click install
npx skills add https://github.com/murphyjoseph/dojo-kit --skill ui-patterns-murphyjoseph
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ui-patterns
Source: https://github.com/murphyjoseph/dojo-kit/tree/main/skills/ui-patterns
Command: npx skills add https://github.com/murphyjoseph/dojo-kit --skill ui-patterns-murphyjoseph

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Streamlines frontend UI development by enforcing a four-layer pattern (controller, presenter, feature, and view) that decouples data handling, business logic, and rendering for better testability and maintainability.

Core Features & Use Cases

  • Enforces separation of concerns across layers to isolate data fetching, state management, and rendering.
  • Provides a reusable contract for UI components via a view contract with renderAs, display, instructions, and effects.
  • Guides scaffolding for new components and features in React-based projects, including data-fetching components, forms, and feature pages.
  • Use when scaffolding a new feature or component to ensure clean architecture and testability from the start.

Quick Start

Create four colocated files (controller.ts, presenter.ts, feature.tsx, and view.tsx) and wire them in a client component to render the contract.

Frequently Asked Questions about ui-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I separate business logic from rendering in React components?

To separate business logic from rendering in React components, apply a four-layer pattern using dedicated files for controller, presenter, feature, and view to decouple data handling, state management, and presentation for better testability.

What is the best way to scaffold a new React feature with clean architecture?

The best way to scaffold a new React feature with clean architecture is to create four colocated files (controller.ts, presenter.ts, feature.tsx, and view.tsx) and wire them in a client component using a view contract.

How do I manage multiple UI states like loading, empty, and error in React?

Manage multiple UI states like loading, empty, and error in React by using a contract-driven view with renderAs, display, instructions, and effects, isolating state presentation from data fetching and business logic layers.

Does this UI architecture pattern require specific dependencies to work?

No, this UI architecture pattern requires no external dependencies, but it requires a React-based project environment and dedicated files for each architectural layer to enforce the client boundary and view contracts.

Why should I use a four-layer architecture for frontend UI development?

Use a four-layer architecture for frontend UI development to isolate data fetching, state management, and rendering, which streamlines testability and maintainability by enforcing strict separation of concerns across layers.