effect-patterns-hub
π―Skillfrom mepuka/effect-ontology
effect-patterns-hub skill from mepuka/effect-ontology
Installation
git clone --depth=1 https://github.com/PaulJPhilp/EffectPatterns.gitSkill Details
Complete catalog of 130+ Effect-TS patterns from EffectPatterns repository. Use when looking for specific implementation patterns, best practices, or real-world examples. Complements other skills with concrete, curated patterns.
Overview
# Effect Patterns Hub
Purpose: Provide quick access to 130+ curated Effect-TS patterns from the EffectPatterns repository. Use this skill to find specific implementation patterns, compare approaches, and reference best practices.
Triggers
- Looking for a specific Effect pattern or idiom
- Need real-world examples of Effect concepts
- Want to see multiple approaches to the same problem
- Comparing implementation strategies
- Learning new Effect features
Pattern Library Location
Local Patterns: .claude/skills/effect-patterns-hub/patterns/
Documentation: docs/effect-patterns/
Count: 130+ patterns in MDX format
Quick Decision Tree
I need to...
#### Create Effects
- From value β [
constructor-succeed-some-right.mdx](patterns/constructor-succeed-some-right.mdx) - From sync code β [
constructor-sync-async.mdx](patterns/constructor-sync-async.mdx) - From promise β [
constructor-try-trypromise.mdx](patterns/constructor-try-trypromise.mdx) - From nullable β [
constructor-from-nullable-option-either.mdx](patterns/constructor-from-nullable-option-either.mdx) - Pre-resolved β [
create-pre-resolved-effect.mdx](patterns/create-pre-resolved-effect.mdx)
#### Transform & Compose
- Map values β [
combinator-map.mdx](patterns/combinator-map.mdx) - Chain effects β [
combinator-flatmap.mdx](patterns/combinator-flatmap.mdx) - Sequence operations β [
combinator-sequencing.mdx](patterns/combinator-sequencing.mdx) - Combine values β [
combinator-zip.mdx](patterns/combinator-zip.mdx) - Filter β [
combinator-filter.mdx](patterns/combinator-filter.mdx) - Conditional logic β [
combinator-conditional.mdx](patterns/combinator-conditional.mdx) - Process collections β [
combinator-foreach-all.mdx](patterns/combinator-foreach-all.mdx)
#### Control Flow
- Sequential logic β [
write-sequential-code-with-gen.mdx](patterns/write-sequential-code-with-gen.mdx) - Business logic β [
use-gen-for-business-logic.mdx](patterns/use-gen-for-business-logic.mdx) - Pipe composition β [
use-pipe-for-composition.mdx](patterns/use-pipe-for-composition.mdx) - Branching workflows β [
conditionally-branching-workflows.mdx](patterns/conditionally-branching-workflows.mdx) - Combinators β [
control-flow-with-combinators.mdx](patterns/control-flow-with-combinators.mdx) - Repetition β [
control-repetition-with-schedule.mdx](patterns/control-repetition-with-schedule.mdx)
#### Error Handling
- Define errors β [
define-tagged-errors.mdx](patterns/define-tagged-errors.mdx) - Catch specific errors β [
pattern-catchtag.mdx](patterns/pattern-catchtag.mdx) - Handle all errors β [
handle-errors-with-catch.mdx](patterns/handle-errors-with-catch.mdx) - Retry operations β [
retry-based-on-specific-errors.mdx](patterns/retry-based-on-specific-errors.mdx) - Flaky operations β [
handle-flaky-operations-with-retry-timeout.mdx](patterns/handle-flaky-operations-with-retry-timeout.mdx) - Map errors β [
mapping-errors-to-fit-your-domain.mdx](patterns/mapping-errors-to-fit-your-domain.mdx) - Handle unexpected β [
handle-unexpected-errors-with-cause.mdx](patterns/handle-unexpected-errors-with-cause.mdx) - API errors β [
handle-api-errors.mdx](patterns/handle-api-errors.mdx)
#### Concurrency
- Parallel execution β [
run-effects-in-parallel-with-all.mdx](patterns/run-effects-in-parallel-with-all.mdx) - Background tasks β [
run-background-tasks-with-fork.mdx](patterns/run-background-tasks-with-fork.mdx) - Process collections β [
process-collection-in-parallel-with-foreach.mdx](patterns/process-collection-in-parallel-with-foreach.mdx) - Race effects β [
race-concurrent-effects.mdx](patterns/race-concurrent-effects.mdx) - Fibers explained β [
understand-fibers-as-lightweight-threads.mdx](patterns/understand-fibers-as-lightweight-threads.mdx) - Decouple with queues β [
decouple-fibers-with-queue-pubsub.mdx](patterns/decouple-fibers-with-queue-pubsub.mdx) - Polling β [
poll-for-status-until-task-completes.mdx](patterns/poll-for-status-until-task-completes.mdx) - Graceful shutdown β [
implement-graceful-shutdown.mdx](patterns/implement-graceful-shutdown.mdx)
#### Services & Dependency Injection
- Model dependencies β [
model-dependencies-as-services.mdx](patterns/model-dependencies-as-services.mdx) - Understand layers β [
understand-layers-for-dependency-injection.mdx](patterns/understand-layers-for-dependency-injection.mdx) - Scoped services β [
scoped-service-layer.mdx](patterns/scoped-service-layer.mdx) - Composable modules β [
organize-layers-into-composable-modules.mdx](patterns/organize-layers-into-composable-modules.mdx) - Compose scoped layers β [
compose-scoped-layers.mdx](patterns/compose-scoped-layers.mdx) - Provide config β [
provide-config-layer.mdx](patterns/provide-config-layer.mdx) - Caching wrapper β [
add-caching-by-wrapping-a-layer.mdx](patterns/add-caching-by-wrapping-a-layer.mdx)
#### Resource Management
- Bracket pattern β [
safely-bracket-resource-usage.mdx](patterns/safely-bracket-resource-usage.mdx) - Scope management β [
manage-resource-lifecycles-with-scope.mdx](patterns/manage-resource-lifecycles-with-scope.mdx) - Manual scope β [
manual-scope-management.mdx](patterns/manual-scope-management.mdx) - Scoped resources runtime β [
create-managed-runtime-for-scoped-resources.mdx](patterns/create-managed-runtime-for-scoped-resources.mdx)
#### Streaming
- Process streaming data β [
process-streaming-data-with-stream.mdx](patterns/process-streaming-data-with-stream.mdx) - From iterable β [
stream-from-iterable.mdx](patterns/stream-from-iterable.mdx) - From file β [
stream-from-file.mdx](patterns/stream-from-file.mdx) - From paginated API β [
stream-from-paginated-api.mdx](patterns/stream-from-paginated-api.mdx) - Concurrent processing β [
stream-process-concurrently.mdx](patterns/stream-process-concurrently.mdx) - Batch processing β [
stream-process-in-batches.mdx](patterns/stream-process-in-batches.mdx) - Collect results β [
stream-collect-results.mdx](patterns/stream-collect-results.mdx) - Run for effects β [
stream-run-for-effects.mdx](patterns/stream-run-for-effects.mdx) - Manage resources β [
stream-manage-resources.mdx](patterns/stream-manage-resources.mdx) - Retry on failure β [
stream-retry-on-failure.mdx](patterns/stream-retry-on-failure.mdx)
#### Schema & Validation
- Define contracts β [
define-contracts-with-schema.mdx](patterns/define-contracts-with-schema.mdx) - Parse/decode β [
parse-with-schema-decode.mdx](patterns/parse-with-schema-decode.mdx) - Transform data β [
transform-data-with-schema.mdx](patterns/transform-data-with-schema.mdx) - Validate body β [
validate-request-body.mdx](patterns/validate-request-body.mdx) - Brand types β [
brand-model-domain-type.mdx](patterns/brand-model-domain-type.mdx) - Brand validation β [
brand-validate-parse.mdx](patterns/brand-validate-parse.mdx) - Config schema β [
define-config-schema.mdx](patterns/define-config-schema.mdx)
#### Data Types
- Option β [
data-option.mdx](patterns/data-option.mdx), [model-optional-values-with-option.mdx](patterns/model-optional-values-with-option.mdx) - Either β [
data-either.mdx](patterns/data-either.mdx), [accumulate-multiple-errors-with-either.mdx](patterns/accumulate-multiple-errors-with-either.mdx) - Chunk β [
data-chunk.mdx](patterns/data-chunk.mdx), [use-chunk-for-high-performance-collections.mdx](patterns/use-chunk-for-high-performance-collections.mdx) - Array β [
data-array.mdx](patterns/data-array.mdx) - HashSet β [
data-hashset.mdx](patterns/data-hashset.mdx) - Duration β [
data-duration.mdx](patterns/data-duration.mdx), [representing-time-spans-with-duration.mdx](patterns/representing-time-spans-with-duration.mdx) - DateTime β [
data-datetime.mdx](patterns/data-datetime.mdx), [beyond-the-date-type.mdx](patterns/beyond-the-date-type.mdx) - BigDecimal β [
data-bigdecimal.mdx](patterns/data-bigdecimal.mdx) - Cause β [
data-cause.mdx](patterns/data-cause.mdx) - Exit β [
data-exit.mdx](patterns/data-exit.mdx) - Ref β [
data-ref.mdx](patterns/data-ref.mdx), [manage-shared-state-with-ref.mdx](patterns/manage-shared-state-with-ref.mdx) - Redacted β [
data-redacted.mdx](patterns/data-redacted.mdx) - Case β [
data-case.mdx](patterns/data-case.mdx) - Class β [
data-class.mdx](patterns/data-class.mdx) - Struct β [
data-struct.mdx](patterns/data-struct.mdx) - Tuple β [
data-tuple.mdx](patterns/data-tuple.mdx)
#### Pattern Matching
- Match API β [
pattern-match.mdx](patterns/pattern-match.mdx) - Effectful match β [
pattern-matcheffect.mdx](patterns/pattern-matcheffect.mdx) - Tag matching β [
pattern-matchtag.mdx](patterns/pattern-matchtag.mdx) - Option/Either checks β [
pattern-option-either-checks.mdx](patterns/pattern-option-either-checks.mdx)
#### HTTP & Web
- Basic HTTP server β [
build-a-basic-http-server.mdx](patterns/build-a-basic-http-server.mdx) - Launch server β [
launch-http-server.mdx](patterns/launch-http-server.mdx) - Handle GET β [
handle-get-request.mdx](patterns/handle-get-request.mdx) - HTTP client request β [
make-http-client-request.mdx](patterns/make-http-client-request.mdx) - Testable HTTP client β [
create-a-testable-http-client-service.mdx](patterns/create-a-testable-http-client-service.mdx) - JSON response β [
send-json-response.mdx](patterns/send-json-response.mdx) - Path parameters β [
extract-path-parameters.mdx](patterns/extract-path-parameters.mdx) - Provide dependencies to routes β [
provide-dependencies-to-routes.mdx](patterns/provide-dependencies-to-routes.mdx)
#### Testing
- Mocking dependencies β [
mocking-dependencies-in-tests.mdx](patterns/mocking-dependencies-in-tests.mdx) - Use Default layer β [
use-default-layer-for-tests.mdx](patterns/use-default-layer-for-tests.mdx) - Tests adapt to code β [
write-tests-that-adapt-to-application-code.mdx](patterns/write-tests-that-adapt-to-application-code.mdx)
#### Observability
- Structured logging β [
leverage-structured-logging.mdx](patterns/leverage-structured-logging.mdx), [observability-structured-logging.mdx](patterns/observability-structured-logging.mdx) - Tracing spans β [
trace-operations-with-spans.mdx](patterns/trace-operations-with-spans.mdx), [observability-tracing-spans.mdx](patterns/observability-tracing-spans.mdx) - Custom metrics β [
add-custom-metrics.mdx](patterns/add-custom-metrics.mdx), [observability-custom-metrics.mdx](patterns/observability-custom-metrics.mdx) - OpenTelemetry β [
observability-opentelemetry.mdx](patterns/observability-opentelemetry.mdx) - Effect.fn instrumentation β [
observability-effect-fn.mdx](patterns/observability-effect-fn.mdx)
#### Runtime & Execution
- runPromise β [
execute-with-runpromise.mdx](patterns/execute-with-runpromise.mdx) - runSync β [
execute-with-runsync.mdx](patterns/execute-with-runsync.mdx) - runFork β [
execute-long-running-apps-with-runfork.mdx](patterns/execute-long-running-apps-with-runfork.mdx) - Reusable runtime β [
create-reusable-runtime-from-layers.mdx](patterns/create-reusable-runtime-from-layers.mdx)
#### Configuration
- Access config β [
access-config-in-context.mdx](patterns/access-config-in-context.mdx) - Define schema β [
define-config-schema.mdx](patterns/define-config-schema.mdx) - Provide layer β [
provide-config-layer.mdx](patterns/provide-config-layer.mdx)
#### Time & Scheduling
- Current time β [
accessing-current-time-with-clock.mdx](patterns/accessing-current-time-with-clock.mdx) - Duration β [
representing-time-spans-with-duration.mdx](patterns/representing-time-spans-with-duration.mdx) - DateTime β [
beyond-the-date-type.mdx](patterns/beyond-the-date-type.mdx) - Schedule repetition β [
control-repetition-with-schedule.mdx](patterns/control-repetition-with-schedule.mdx)
#### Project Setup
- New project β [
setup-new-project.mdx](patterns/setup-new-project.mdx) - Editor LSP β [
supercharge-your-editor-with-the-effect-lsp.mdx](patterns/supercharge-your-editor-with-the-effect-lsp.mdx) - AI agents MCP β [
teach-your-ai-agents-effect-with-the-mcp-server.mdx](patterns/teach-your-ai-agents-effect-with-the-mcp-server.mdx)
#### Advanced Concepts
- Structural equality β [
comparing-data-by-value-with-structural-equality.mdx](patterns/comparing-data-by-value-with-structural-equality.mdx) - Effect channels β [
understand-effect-channels.mdx](patterns/understand-effect-channels.mdx) - Effects are lazy β [
effects-are-lazy.mdx](patterns/effects-are-lazy.mdx) - Not found vs errors β [
distinguish-not-found-from-errors.mdx](patterns/distinguish-not-found-from-errors.mdx) - Promise problems β [
solve-promise-problems-with-effect.mdx](patterns/solve-promise-problems-with-effect.mdx) - Avoid long chains β [
avoid-long-andthen-chains.mdx](patterns/avoid-long-andthen-chains.mdx)
Pattern Categories
By Skill Level
Beginner (Getting Started)
- Constructor patterns (succeed, fail, sync, async)
- Basic combinators (map, flatMap, tap)
- Simple error handling (catch, catchTag)
- Effect.gen basics
- runPromise/runSync
Intermediate (Building Applications)
- Services and layers
- Schema validation
- HTTP servers and clients
- Resource management
- Concurrency basics (Effect.all, fork)
- Testing with mocks
Advanced (Production Systems)
- Complex layer composition
- Custom runtimes
- Streaming pipelines
- Graceful shutdown
- OpenTelemetry integration
- Performance optimization (Chunk, Ref)
By Use Case
Domain Modeling
- Schema definitions
- Brand types
- Tagged errors
- Option/Either for optional/fallible values
API Development
- HTTP server setup
- Route handling
- Request validation
- Error handling
- Response formatting
Data Processing
- Stream processing
- Batch operations
- Parallel processing
- Resource-safe pipelines
Application Architecture
- Service layer design
- Dependency injection
- Module composition
- Configuration management
Testing
- Mock layers
- Test utilities
- Testable services
Observability
- Structured logging
- Distributed tracing
- Custom metrics
- Performance monitoring
Search Patterns
By Keyword
Use Grep to search patterns by keyword:
```bash
# Find patterns about error handling
grep -l "error" patterns/*.mdx
# Find patterns about concurrency
grep -l "concurrent\|parallel\|fiber" patterns/*.mdx
# Find patterns about HTTP
grep -l "http\|server\|client" patterns/*.mdx
# Find patterns about testing
grep -l "test\|mock" patterns/*.mdx
```
By Frontmatter Tags
All patterns include metadata:
title: Human-readable nameid: Unique identifier (filename without extension)skillLevel: beginner, intermediate, advanceduseCase: domain-modeling, error-handling, concurrency, etc.summary: Brief descriptiontags: Keywords for searchingrelated: Links to related patterns
Common Searches
"How do I create an Effect from..."
- β Search constructor patterns:
grep -l "constructor" patterns/*.mdx - β Check
constructor-*.mdxfiles
"How do I handle errors when..."
- β Search error handling:
grep -l "error\|catch\|retry" patterns/*.mdx - β Check
handle-*.mdxandpattern-catchtag.mdx
"How do I run multiple things concurrently?"
- β Search concurrency:
grep -l "concurrent\|parallel\|all\|fork" patterns/*.mdx - β Check
run-effects-in-parallel-with-all.mdx
"How do I work with services?"
- β Search services:
grep -l "service\|layer\|dependency" patterns/*.mdx - β Check
model-dependencies-as-services.mdx,understand-layers-for-dependency-injection.mdx
"How do I validate data?"
- β Search schema:
grep -l "schema\|validate\|parse" patterns/*.mdx - β Check
define-contracts-with-schema.mdx,parse-with-schema-decode.mdx
Integration with Other Skills
Foundations β Patterns Hub
When you need concrete examples for foundation concepts, check patterns:
effect-foundationsteaches concepts β patterns show implementation
Architect β Patterns Hub
When designing systems, reference architectural patterns:
- Layer composition β
organize-layers-into-composable-modules.mdx - Service design β
model-dependencies-as-services.mdx - Scoped resources β
scoped-service-layer.mdx
Engineer β Patterns Hub
When implementing features, find relevant patterns:
- HTTP endpoints β
handle-get-request.mdx,validate-request-body.mdx - Error handling β
retry-based-on-specific-errors.mdx - Concurrency β
run-effects-in-parallel-with-all.mdx
Tester β Patterns Hub
When writing tests, reference testing patterns:
- Mock services β
mocking-dependencies-in-tests.mdx - Test layers β
use-default-layer-for-tests.mdx - Testable design β
write-tests-that-adapt-to-application-code.mdx
Usage Workflow
- Identify Need: "I need to [do something] with Effect"
- Check Decision Tree: Find relevant section above
- Read Pattern: Use
Readtool on the pattern file - Adapt to Context: Apply pattern to your specific use case
- Check Related: Follow
relatedlinks in pattern frontmatter - Consult Agent: If unclear, use
@effect-engineeror@effect-architect
Anti-Pattern Detection
If you find yourself:
- Using imperative loops β Check
process-collection-in-parallel-with-foreach.mdx - Mixing promises and Effects β Check
constructor-try-trypromise.mdx,solve-promise-problems-with-effect.mdx - Long andThen chains β Check
avoid-long-andthen-chains.mdx,use-gen-for-business-logic.mdx - Leaking requirements β Check
model-dependencies-as-services.mdx - Manual resource cleanup β Check
safely-bracket-resource-usage.mdx
Pattern File Structure
Each pattern file follows this structure:
```mdx
---
title: Human-readable title
id: kebab-case-id
skillLevel: beginner | intermediate | advanced
useCase: primary-use-case
summary: Brief description
tags:
- keyword1
- keyword2
related:
- related-pattern-id-1
- related-pattern-id-2
author: Author name
---
# Title
Guideline
What to do
Rationale
Why do it this way
Good Example
β Recommended approach
Bad Example
β What to avoid
Related Patterns
Links to related patterns
```
Maintenance
Patterns are synced from [EffectPatterns repository](https://github.com/PaulJPhilp/EffectPatterns).
To update patterns:
```bash
cd /tmp
git clone --depth=1 https://github.com/PaulJPhilp/EffectPatterns.git
cp -r EffectPatterns/content/published/* /Users/pooks/Dev/crate/.claude/skills/effect-patterns-hub/patterns/
cp -r EffectPatterns/content/published/* /Users/pooks/Dev/crate/docs/effect-patterns/
```
Summary
- 130+ patterns covering all Effect-TS concepts
- Decision tree for quick pattern lookup
- Integration with existing skills and agents
- Searchable by keyword, use case, skill level
- Examples showing good and bad practices
- Related patterns for deeper exploration
Use this skill as your go-to reference for "How do I... with Effect?"
More from this repository10
effect-concurrency-fibers skill from mepuka/effect-ontology
effect-errors-retries skill from mepuka/effect-ontology
effect-time-tracing-logging skill from mepuka/effect-ontology
effect-foundations skill from mepuka/effect-ontology
effect-index skill from mepuka/effect-ontology
effect-queues-background skill from mepuka/effect-ontology
effect-collections-datastructs skill from mepuka/effect-ontology
effect-streams-pipelines skill from mepuka/effect-ontology
effect-resources-scope skill from mepuka/effect-ontology
effect-layers-services skill from mepuka/effect-ontology