effect-ts_skill

This skill helps you implement and refactor Effect-TS patterns, services, and error handling, including Next.js integration with effects.
  • TypeScript

8

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill joncrangle/.dotfiles --skill effect-ts

  • SKILL.md16.8 KB

Overview

This skill provides practical, expert guidance for working with Effect-TS (the Effect library) in TypeScript projects. It helps with patterns for error handling, services and layers, dependency injection, resource management, concurrency, and integrating Effect with frameworks like Next.js via @prb/effect-next. Use it when writing, refactoring, or debugging code that imports from 'effect'.

How this skill works

The skill inspects code for existing Effect usage and recommends consistent, idiomatic patterns. It checks for service and layer patterns, error taxonomy, and testing approaches, and it advises when to consult the local Effect source at ~/.effect for deep type or runtime issues. For integration scenarios (including Effect + Next.js), it suggests concrete layering and lifecycle patterns and safety checks for resource management and concurrency.

When to use it

  • Implementing or refactoring Services and Layers or adding new dependencies
  • Designing typed error models and handling multiple error classes
  • Converting imperative async code (promises/try-catch) to Effect patterns
  • Managing resources, scoped lifetimes, or complex concurrency
  • Integrating Effect with Next.js using @prb/effect-next or other adapters

Best practices

  • Check the codebase first for existing Effect patterns and follow them for consistency
  • Use typed errors (Data.TaggedError) and Effect.fail/catchTag rather than throw/catch
  • Prefer Context.Tag / Effect.Service + Layer compositions for dependency injection
  • Use Effect.gen or Effect.fn for readable sequential logic and better stack traces
  • Manage resources with acquireUseRelease / scoped effects and avoid unsafe APIs (e.g., unsafeMake)

Example use cases

  • Create a Database service as a Layer and inject it into handlers via Effect.provide
  • Refactor a Promise-based API call into Effect.tryPromise with typed errors and retry Schedule
  • Implement request-scoped resources in Next.js using @prb/effect-next and scoped layers
  • Write tests that provide test-specific Layers and use Effect.result to assert failures and successes
  • Handle cancellation and interruptions separately from domain errors using catchTag and onInterrupt

FAQ

Stop and clone the Effect repository to ~/.effect before proceeding. The local source is required for deep debugging and canonical patterns.

When should I prefer Effect.fn over Effect.gen?

Use Effect.fn for named functions to get automatic telemetry and better stack traces; use Effect.gen for concise inline generator-style composition when naming is unnecessary.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational