effect-react-vm

Build reactive ViewModel state for React components using Effect and Effect-Atom.

22|1|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/mpsuesser/pi-effect-harness --skill effect-react-vm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-react-vm
Source: https://github.com/mpsuesser/pi-effect-harness/tree/main/harnesses/effect/skills/effect-react-vm
Command: npx skills add https://github.com/mpsuesser/pi-effect-harness --skill effect-react-vm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the problem of mixing UI rendering with state management and business/formatting logic in React apps by providing a clear ViewModel pattern built on Effect and Effect-Atom.

Core Features & Use Cases

  • Zero UI Logic VM Output: Ensures components only render UI-ready values while VMs handle formatting, transformation, and error-to-UI mapping.
  • Effect-Scoped State Management: Defines atoms inside Effect layers so VM lifecycles, resources, and derived state are handled consistently.
  • Testable Reactive Architecture: Enables deterministic VM testing by mocking services at the Layer level without relying on UI.
  • Async Actions Done Right: Uses Atom.fn patterns for effectful actions with built-in waiting/results to drive UI states cleanly.

Use case: building a wallet screen where a domain service exposes connect/disconnect behavior, while the VM exposes UI-ready state variants (Disconnected/Connecting/Connected) and formatted display fields for the component.

Quick Start

Use the effect-react-vm skill to design a paired Component.tsx and Component.vm.tsx where the VM owns Effect/Atom state, formatting, and actions, and the component only subscribes and renders.

Frequently Asked Questions about effect-react-vm

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

FAQPage Schema
How do I separate business logic from UI rendering in React using a ViewModel pattern?

To separate business logic from React UI rendering, use a ViewModel pattern to ensure components only subscribe to and render UI-ready values. ViewModels handle formatting, transformation, and error-to-UI mapping, keeping components clean.

How does Effect manage reactive state for React components?

Effect manages reactive state for React by defining atoms inside Effect layers. This ensures consistent handling of VM lifecycles, resources, and derived state, bridging domain services into UI-ready atoms for components to consume.

What is the best way to handle async actions and UI state in a React ViewModel?

The best way to handle async actions in a React ViewModel is using Atom.fn patterns for effectful actions. These patterns provide built-in waiting and results states, allowing you to drive UI state machines cleanly using Data.TaggedEnum.

Can I test React ViewModels deterministically without relying on the UI layer?

Yes, you can test React ViewModels deterministically by mocking services at the Layer level. This testable reactive architecture isolates VM logic from the UI, ensuring formatting and transformation are validated independently.

Does this reactive ViewModel architecture work with existing React state management libraries?

This architecture specifically bridges domain services into UI-ready atoms using Effect and Effect-Atom. It requires VM layers created with Layer.effect and components rendering from atom values using the provided VMRuntime hook.

Why should I not put formatting and state logic directly inside my React components?

Mixing UI rendering with state management and business logic creates unmaintainable React apps. Moving this logic into a ViewModel built on Effect ensures components only render UI-ready values, preventing formatting and error mapping from cluttering the UI.