spec-effects

Define effect algebra for morphisms and generate spec/effects.yaml.

37|5|Updated Nov 18, 2025
One-click install
npx skills add https://github.com/BellaBe/lean-os --skill spec-effects
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spec-effects
Source: https://github.com/BellaBe/lean-os/tree/main/.claude/skills/engineering-spec-effects
Command: npx skills add https://github.com/BellaBe/lean-os --skill spec-effects

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill codifies effect kinds (IO, Either, Option, Reader, State, Async) and defines the algebra for morphisms, enabling consistent effect handling.

Core Features & Use Cases

  • Effect definitions: create IO, error, reader, state, and async layers.
  • Environment and state: define Env types and threading semantics.
  • Error definitions: specify error variants for domain failures.

Quick Start

Example: "Create artifacts/v{N}/spec/effects.yaml with IO and Either layers and define UserError variants."

Frequently Asked Questions about spec-effects

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

FAQPage Schema
How do I define an effect algebra for my functional program?

Effect algebra codifies how your program handles side effects like IO, errors, and state. Define effect kinds (IO, Either, Option, Reader, State, Async) in artifacts/v{N}/spec/effects.yaml with documented semantics to enable consistent morphism handling across your codebase.

What's the difference between Reader, State, and other effect types in functional programming?

Reader provides access to immutable environment context; State threads mutable values through computations; IO wraps side effects; Either and Option handle errors and absence. Each effect type solves different concerns—choose based on whether you need environment access, mutable threading, or error tracking.

How do I structure error types in my effect system?

Define error variants in your effects specification that represent domain-specific failures. Document each variant's semantics in effects.yaml so Either and Option effects can propagate and handle errors consistently across your morphism algebra.

Can I use effect algebras with Kleisli composition?

Yes. Kleisli composition works with effect algebras by composing morphisms that return wrapped values. Define your effect kinds clearly in the algebra so Kleisli arrows chain effects correctly through type constructors like Reader, State, and Either.

Do I need to define environment types if I'm using Reader effects?

Yes. If your algebra includes Reader effects, you must define environment types in effects.yaml to specify what immutable context your computations require and how it flows through morphisms.

What happens after I generate the effects specification?

Once artifacts/v{N}/spec/effects.yaml is generated with all effect kinds, error variants, and threading semantics documented, your morphism definitions can reference the algebra consistently for IO, error handling, reader access, and state management.