prefer-effect-ts
OfficialSafer, composable async and error handling
System Documentation
What problem does it solve?
Effect-TS replaces scattered Promise-based code, try/catch blocks, and manual dependency handling with a unified, type-safe approach for asynchronous operations and error management in the Apex language server codebase. This reduces runtime errors, improves observability through integrated logging, and makes service dependencies explicit and testable.
Core Features & Use Cases
- Type-safe async flows: Replace Promise and async/await patterns with composable Effect operations for predictable sequencing and failure handling.
- Structured error handling: Use Effect.fail, catchTag, and catchAll to surface and handle typed errors rather than relying on ad-hoc exceptions.
- Dependency management: Use Context.Tag and Layer to declare and provide dependencies for services and validators for easier testing and composition.
- Integrated logging: Route Effect.log* calls through EffectLspLoggerLive to emit workspace/logMessage notifications to the LSP output channel.
- Testability: Provide test logger layers such as EffectTestLoggerLive and use deterministic Effects in unit and integration tests.
Quick Start
Implement a new validator or service using Effect.gen, provide the EffectLspLoggerLive layer when running in production (or EffectTestLoggerLive in tests), and execute the program with Effect.runPromise.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: prefer-effect-ts Download link: https://github.com/forcedotcom/apex-language-support/archive/main.zip#prefer-effect-ts Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.