Logo Effect V4

Effect V4

Cộng đồng
peterpme
effect-v4

Effect v4 (4.0.0) for TypeScript. Use when writing, reviewing, or testing Effect code — Effect.gen, Effect.fn, Schema, TaggedError, Context.Service, Layer, ManagedRuntime, Config, Scope, Fiber, Queue, Ref, Schedule, Stream, Cache, HttpClient, HttpRouter, HttpApi, SqlClient, SqlSchema, effect/ai, the Vercel AI SDK inside Effect, @effect/vitest, TestClock — or running Effect on Cloudflare Workers.

Tổng quan

Nhà phát hànhpeterpme
Kho mãskills
Tên kỹ năngeffect-v4
Sao
28
Bản fork
0
Tệp đi kèm
17
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI là Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 17 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được peterpme công bố trên GitHub. Hãy đọc nội dung nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Effect V4 trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL thư mục kỹ năng bên dưới và xác nhận.
    https://github.com/peterpme/skills/tree/main/effect-v4
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/peterpme/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/effect-v4 .claude/skills/effect-v4
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Effect V4 trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự tải Effect V4 ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên Effect V4 không bị giới hạn ở mô hình mà kỹ năng này được viết cho. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên kỹ năng chưa dùng không tốn chi phí.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Effect v4

Effect 4.0.0 is the stable release. Write v4. Model memory and effect.website default to v3. Do not trust either. Every example that starts with import compiles against effect@4.0.0. Blocks under Fail review on are wrong on purpose.

The model

Effect.Effect<A, E, R> describes work. Building it runs nothing.

  • A is the success value.
  • E is the expected failures, as tagged errors.
  • R is the services still required. A Layer provides them.

Run an Effect once, at the program edge. Everything below the edge returns an Effect. Hover A, E, and R. Inference is the documentation.

Imports

NeedImport
Coreimport { Effect, Layer, Schema, Context } from "effect"
HTTP client and servereffect/http
HttpApieffect/http-api
SQLeffect/sql
LLMseffect/ai
Test serviceseffect/testing
Everything elseeffect/<area>: cli, rpc, workflow, cluster, persistence, reactivity, observability, encoding, process, socket, workers, eventlog, schema
Runtimes, drivers, providers@effect/platform-node, @effect/sql-sqlite-node, @effect/sql-d1, @effect/ai-openai, @effect/ai-anthropic, @effect/vitest

effect/unstable/*, @effect/platform, @effect/sql, and @effect/ai are prerelease paths. They do not exist in 4.0.0.

Most of effect/<area> is tagged @stability unstable. It is production code, but a 4.x minor can break it. Pin effect and every @effect/* to one exact version. Upgrade them together.

House rules

Write

  1. A reusable effectful function is Effect.fn("Owner.method"). One-off sequencing is inline Effect.gen. The name is the span.
  2. Pure work stays plain TypeScript. xs.map(f), never Effect.forEach(xs, (x) => Effect.succeed(f(x))).
  3. No ambient globals in Effect code. fetch → HttpClient. Date.now() → Clock or DateTime. console → Effect.log*. setTimeout → Effect.sleep. Math.random() → Random.
  4. Run effects only at the entry point. Never Effect.runPromise inside a helper.

Errors

  1. An expected failure is a Schema.TaggedError class. Fail with return yield* new ItemMissing({ id }). Returning { _tag: "ItemMissing" } is a success.
  2. _tag is the only discriminant. Success unions use Data.taggedEnum. Never write { _tag: "X" as const }.
  3. Handle an error only where you have a real answer: a fallback, a retry, a response, a settlement. Otherwise leave it in E.
  4. Never swallow. No Effect.ignore, no catch-to-void. Best-effort work returns a tagged outcome and logs it.
  5. Bugs and impossible states die. Only the entry point inspects Cause.

Data

  1. Decode unknown input once, at the boundary, with Schema. Do not decode values you just built.

Services

  1. A service owns I/O, state, credentials, or policy. Everything else is a function.
  2. Yield dependencies once in Layer.effect and close over them. Public methods have R = never.
  3. Service keys are path-shaped and unique: "@app/store/ItemStore".
  4. Provide shared infrastructure once, at the composition root: HTTP transport, SQL driver, logger.

Config

  1. Read env and host bindings only at the entry point. Pass plain typed values into layer constructors: catalogLayer({ baseUrl, apiKey }).
  2. Every setting is required. No ?? fallbacks. No Config.withDefault for business constants. Keep constants in one config module.

Retry

  1. One retry owner per failure. Bound every retry with times and a schedule. Set SDK retries to zero when Effect retries.

Testing

  1. No module mocks. No fake services. No stubbed HttpClient. Test pure functions, recorded fixtures through the production schema, and real local engines (SQLite :memory:, temp directories) with TestClock.
  2. Prove a workflow change with the project's real end-to-end run. Show the output.

Style

  1. No comments on functions. Names and types are the docs.

Choose

I needUseRead
Sequence effectsEffect.gen + yield*core
A named, traced operationEffect.fn("X.y")core
A value that may be absentOptioncore
A success-or-failure value, not an effectResultcore
Exhaustive branching on a unionMatch, $matchcore
Durations and datesDuration, DateTimecore
A typed expected failureSchema.TaggedErrorerrors
Recover from one failurecatchTag, catchTags, catchReasonerrors
Wrap a Promise or SDK callEffect.tryPromiseerrors
Validate unknown inputSchema.decodeUnknownEffectschema
Parse JSON textSchema.fromJsonStringschema
A dependency or capabilityContext.Service + Layerservices
Settings and secretsConfig, Redacted at the entryservices
Start the programNodeRuntime.runMain, ManagedRuntimeservices
Do work in parallelEffect.forEach(xs, f, { concurrency }), Effect.allconcurrency
Open and close a resourceEffect.acquireRelease, Scopeconcurrency
A background loopEffect.forkScoped in a layerconcurrency
Shared mutable stateRef, SynchronizedRef, SubscriptionRefconcurrency
Wait for a signal, limit accessDeferred, Latch, Semaphoreconcurrency
A work queue or fan-outQueue, PubSubconcurrency
Retry, repeat, pollEffect.retry, Effect.repeat, Scheduletime
A deadlineEffect.timeoutOrElsetime
Values over time, pagination, SSEStreamstreams
Memoize a lookupCache, Effect.cachedWithTTLcaching
Batch many lookups into one callRequest, RequestResolvercaching
Logs, spans, metricsEffect.log*, Effect.fn, Metricobservability
Call an HTTP APIHttpClienthttp
Serve HTTPHttpRouter, HttpApihttp
Query SQLSqlClient, SqlSchemasql
Call an LLMVercel AI SDK or effect/aillm
Files, paths, child processes, CLIsFileSystem, Path, ChildProcess, effect/cliplatform
Write a test@effect/vitest, TestClocktesting
RPC, durable workflows, cluster, persistence, atoms, event logs—modules
You wrote a v3 or prerelease name—v3 traps
Cloudflare Workers—cloudflare

Verify an API

Do not guess a signature. The installed package ships its source and docs:

  • node_modules/effect/src/<Module>.ts, or src/<area>/ for subpaths. Exports carry When to use and Gotchas JSDoc.
  • node_modules/effect/ai-docs/src/ holds the official examples by topic.
  • node_modules/effect/AGENTS.md is the upstream agent guide.

With pnpm, look under the package that depends on effect: <package>/node_modules/effect. rg smart case makes lowercase patterns case-insensitive. Search with rg -s. The Effect language service (@effect/tsgo) reports v3 names as outdatedApi. Run the typecheck.

Cloudflare Workers

Effect runs on Workers with no platform package. Build the layer graph per invocation from env. Use FetchHttpClient.layer and @effect/sql-d1. D1 has no transactions. Use batch([...]) on the D1Client service. Read cloudflare only for Workers work. Nothing else in this skill depends on it.

Review

  • Hover R. A service in R that no layer provides defects at run time → reject.
  • Hover E. A new error class with no catchTag update means an exhaustive edge is lying.
  • Effect.forEach whose callback only wraps a pure value → reject. That is xs.map.
  • { _tag: "X" as const } → reject. Use a constructor.
  • yield* of a service inside a public method → reject. Capture it in the layer.
  • Global fetch inside tryPromise for an HTTP API → reject. Use HttpClient.
  • Effect.ignore, catchCause, or a handler returning Effect.void below the entry → reject.
  • A retry without times → reject. It retries forever.
  • Cache.make without timeToLive → reject. It caches failures forever.
  • vi.mock, Layer.mock, Layer.succeed of an app service, or HttpClient.make in a test → reject.

Provenance

A copy of this skill also lives in a work repository. Update both copies when either changes.

Tệp đi kèm

Mô hình đọc các tệp này khi cần trong lúc kỹ năng được tải. Các tệp được cung cấp ở dạng có thể đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Effect V4 làm được gì?

Effect v4 (4.0.0) for TypeScript. Use when writing, reviewing, or testing Effect code — Effect.gen, Effect.fn, Schema, TaggedError, Context.Service, Layer, ManagedRuntime, Config, Scope, Fiber, Queue, Ref, Schedule, Stream, Cache, HttpClient, HttpRouter, HttpApi, SqlClient, SqlSchema, effect/ai, the Vercel AI SDK inside Effect, @effect/vitest, TestClock — or running Effect on Cloudflare Workers.

Vì sao nên dùng Effect V4 trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Effect V4 là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Effect V4 trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/peterpme/skills/tree/main/effect-v4. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm và cài đặt thành một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Effect V4?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Bạn có thể dùng Effect V4 với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Effect V4 với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Effect V4 có miễn phí không?

Kỹ năng này được peterpme phát hành trên GitHub. Hãy xem điều khoản giấy phép trong kho mã. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp cho mô hình các công cụ mới để gọi — mã được chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và tiêu chí của đầu ra tốt. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇