effect-config

Load and validate typed configuration with Effect Config and ConfigProvider.

1|Updated Aug 24, 2026
One-click install
npx skills add https://github.com/lambdasolver2/opencode-effect-harness --skill effect-config-lambdasolver2
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-config
Source: https://github.com/lambdasolver2/opencode-effect-harness/tree/main/packages/module-typescript/assets/skills/effect-config
Command: npx skills add https://github.com/lambdasolver2/opencode-effect-harness --skill effect-config-lambdasolver2

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires effect.

What problem does it solve? Reading raw environment variables with process.env is untyped, unvalidated, and hard to test. This Skill guides you to load, validate, and compose typed configuration in Effect TypeScript applications using Config and ConfigProvider, producing structured ConfigError values instead of ad-hoc runtime failures. ## Core Features & Use Cases - Typed Config Primitives: Decode strings into number, boolean, Date, Duration, URL, port, log level, and redacted secrets with constructors like Config.int, Config.port, and Config.redacted. - Structured Config with Schema: Use Config.schema with Schema.Struct to decode whole config sections, with automatic string-to-type conversion and nesting via prefixes. - Composable Providers: Source config from environment variables, .env files, plain objects, directory trees (Kubernetes ConfigMap/Secret), or custom stores, and combine them with orElse, nested, and constantCase. - Use Case: You need a server config with host, port, and log level plus a database section. Define them with Config.schema, yield the combined config in Effect.gen for production, and test deterministically with ConfigProvider.fromUnknown without touching process.env. ## Quick Start Ask the AI to define a typed application config using Effect Config.schema for server and database sections and show how to test it with ConfigProvider.fromUnknown.

Frequently Asked Questions about effect-config

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

FAQPage Schema
How do I read environment variables in Effect TypeScript?

Use Config primitives like Config.string('HOST') or Config.int('PORT') and yield them inside Effect.gen, which reads from the default ConfigProvider backed by process.env. For structured config, use Config.schema with Schema.Struct to decode whole sections at once.

How do I test Effect config without mocking process.env?

Use ConfigProvider.fromUnknown with a plain object and either call config.parse(provider) directly or install it with ConfigProvider.layer. This gives deterministic, hermetic tests without mutating global environment state.

What is the difference between Config.withDefault and Config.orElse?

Config.withDefault only recovers when data is missing; validation errors like wrong types still propagate. Config.orElse catches all ConfigError values, including validation failures, and falls back to an alternative config.

Can Effect Config load .env files or Kubernetes secrets?

Yes. ConfigProvider.fromDotEnv reads .env files from disk, fromDotEnvContents parses .env strings with variable expansion, and fromDir reads directory trees where each file is a config leaf, matching Kubernetes ConfigMap and Secret mounts.

Why does Config.withDefault not catch my validation error?

withDefault and Config.option only recover from missing-data errors, not SchemaError validation failures. An out-of-range port or wrong type will still fail; use Config.orElse if you need to catch all ConfigError cases.