effect-pattern-matching

Replace manual tag checks with exhaustive Effect v4 pattern matching.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you avoid brittle, non-exhaustive manual tag checks when working with discriminated unions, ADTs, Options, and schema unions in Effect v4 code.

Core Features & Use Cases

  • Use Data.TaggedEnum pattern matching to get exhaustive, type-safe handling of tagged variants with $match and single-case guards with $is.
  • Prefer Effect.match over Effect.result + manual checks to ensure both success and failure paths are handled declaratively.
  • Handle common tagged structures correctly by using Option.match for Option types and Match.typeTags for Schema-based unions.

Use it when you are implementing state machines, domain events, command/result types, and conditional control flow that must remain correct as variants evolve.

Quick Start

Use the effect-pattern-matching skill to refactor your existing _tag/Result/Option branching into exhaustive $match handlers and type-safe $is guards.

Frequently Asked Questions about effect-pattern-matching

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

FAQPage Schema
How do I write exhaustive pattern matching for tagged enums in Effect?

Use Data.TaggedEnum with the $match utility to get exhaustive, type-safe pattern matching for tagged variants in Effect v4. This replaces manual tag checks, ensuring all variants are handled correctly as your discriminated unions evolve.

What is the best way to handle success and failure paths in Effect without manual result unwrapping?

Prefer Effect.match over combining Effect.result with manual conditional checks. Effect.match declaratively forces you to handle both success and failure paths exhaustively, preventing silent failures and improving pipeline maintainability.

How do I perform type-safe matching on Schema unions in Effect?

Use Match.typeTags to perform exhaustive pattern matching on Schema-based unions. This ensures your workflow and state logic remain correct and type-safe as new variants are added to your schema definitions.

When should I replace manual _tag conditional branching with pattern matching in Effect?

Replace manual _tag conditional branching when implementing state machines, domain events, or error-handling pipelines that must remain exhaustive. Using $match and $is guards ensures your code stays correct as variants change over time.

Does this pattern matching approach work with Option types in Effect?

Yes, use Option.match to handle Option types exhaustively. It provides a declarative way to manage both Some and None cases, replacing partial unwrapping and ensuring your functional control flow is completely type-safe.