effect

kitlangton/skills · Agent Skill

關於使用Effect v4建立TypeScript生產應用程式指南的意見,包括工作流程、服務、層、結構、設定、排程、快取、執行緒、HTTP客戶端和測試。

前往安裝 ↓

總覽

發布者kitlangton社群
儲存庫kitlangton/skills ↗
技能資料夾effect
星352
分支6
附帶檔案10
授權MIT
最近更新2026年10月2日
連結技能原始碼 ↗ · 儲存庫 ↗

Mozgi 檢查

我們在技能檔案中發現的內容。詳細資訊需訂閱。

安全性
中等風險 · 發現 1 個需要注意的地方
相容性
僅含說明 — 適用於多數代理
相似技能
找到 144 個相似技能
訂閱另含

安裝

技能就是一個含 SKILL.md 的資料夾。選擇你的代理,在專案根目錄的終端機(macOS、Linux 或 Windows 的 Git Bash)執行指令。

把提示貼到 Claude、Codex 或其他助理:它會自行檢查並安裝技能。

Install the “effect” skill from mozgi.io (https://mozgi.io/skills/kitlangton-effect/) for me.

1. Download the archive: https://mozgi.io/skills/kitlangton-effect/download
   If it fails, take the skill folder from the source: https://github.com/kitlangton/skills/tree/main/skills/effect
2. Read SKILL.md and the other files. Check the skill is safe: no hidden commands, no sending data elsewhere, no scripts doing something other than described. If anything looks suspicious, stop and tell me.
3. Put the “effect” folder into your agent's skills folder: .claude/skills/ for Claude Code, .agents/skills/ for Codex, .cursor/skills/ for Cursor, .gemini/skills/ for Gemini CLI. Inside the project if we are in one, otherwise in the home folder (~/.claude/skills/ etc.).
4. Make sure <skills folder>/effect/SKILL.md exists.
5. Briefly tell me what this skill does and offer to try it on my task.

If you cannot do a step yourself, tell me what to click or type.

技能檔案

10 個檔案 下載 ZIP

安裝前請先檢視 SKILL.md 與相關檔案。點擊檔案即可預覽。

SKILL.md 內容

作者原文 · 唯讀

Effect

Use current Effect v4 APIs and the production defaults in this skill. Established project conventions still take precedence unless the task is explicitly changing them.

Source Rule

Reviewed against Effect 4.0.0, upstream commit

6389d9ac6 ↗.

Read references/V4_APIS.md when upgrading from v3 or a v4 prerelease.

The installed version takes precedence: prerelease APIs and import paths can differ.

Check these before guessing:

  • the nearest AGENTS.md and any project-local Effect practices doc
  • the project-pinned effect package source and version
  • current upstream Effect source when the installed package does not answer the question

Branch Chooser

Read only the branch references that match the task.

  • Data models, schemas, brands, variants, optional keys, or decoders: read references/SCHEMA.md.
  • Services, module surfaces, layers, runtime wiring, errors, Effect.fn, or test services: read references/SERVICES_LAYERS.md.
  • Runtime config, env variables, ConfigProvider, or layerConfig: read references/CONFIG.md.
  • Retry, repeat, polling, backoff, jitter, rate-limit-aware policies, or pass loops: read references/SCHEDULING.md.
  • Memoization, per-key TTL caches, deduplicating concurrent lookups, or request batching: read references/CACHING.md.
  • Streams, event sources, async iterables, queues/pubsubs, pagination, backpressure, or stream consumers: read references/STREAMS.md.
  • Outgoing HTTP calls, Effect HttpClient, status handling, or HTTP rate limiting: read references/HTTP_CLIENTS.md.
  • Effect tests, time, sleeps, concurrency synchronization, or fakes: read references/TESTING.md.

If a task spans several branches, read all matching files before editing.

Core Defaults

  • Compose workflows with Effect.gen(function* () { ... }).
  • Define public service methods and non-trivial internal service methods with Effect.fn("Domain.operation").
  • Use Effect.fnUntraced only for internal helpers where stack-frame/span metadata is intentionally unnecessary.
  • Prefer Context.Service for application services when the codebase has not standardized on another current service-tag style.
  • Build real service implementations with Layer.effect(Service, Effect.gen(...)) and return Service.of({ ... }).
  • Model records with Schema.Struct(...) plus a same-name interface.
  • Model typed Effect errors with Schema.TaggedError.
  • Read runtime config through Config, not direct process.env access in application logic.
  • Use Schedule for retry, repeat, polling, pacing, and backoff policies.
  • Use Stream for effectful sources that emit many values over time and need pull, backpressure, interruption, or transformation.
  • Prefer Effect HTTP client modules for outgoing HTTP in Effect applications when their typed errors, layers, and client transforms are useful.
  • Prefer Effect-aware tests, explicit layers, and deterministic synchronization over sleeps.
  • Decode unknown wire input with Schema.decodeUnknownEffect(...); use schema.makeEffect(...) for typed constructor input with validation. Reserve throwing schema.make(...) for trusted construction, and never use casts to skip validation.

Quick Selection Guide

  • Ordinary object record: Schema.Struct(...) plus same-name interface.
  • Scalar ID/value object: constrained branded schema.
  • Internal workflow decision or state: Data.TaggedEnum<...> plus Data.taggedEnum<...>() constructors and exhaustive $match.
  • Reusable boundary-crossing tagged variant: Schema.TaggedStruct(...) plus same-name interface.
  • Boundary-crossing tagged union: Schema.TaggedUnion(...) with .cases, .guards, and .match.
  • External/custom discriminator such as type: Schema.Struct({ type: Schema.tag("variant"), ... }) plus Schema.toTaggedUnion("type") when union helpers are needed.
  • Expected typed failure: Schema.TaggedError.
  • Unknown boundary payload: Schema.decodeUnknownEffect(...).
  • Service boundary: Context.Service<Service, Interface>()(...) plus Layer.effect(...) plus Service.of(...).
  • Public or non-trivial internal service method: Effect.fn("Domain.operation").
  • Runtime configuration: Config recipes read in layers; override with ConfigProvider in tests.
  • Event source: Stream consumed with Stream.runForEach(...) and forked with Effect.forkScoped in the owning layer.
  • Queue-backed event source: Queue for the producer boundary, Stream.fromQueue(...) for consumers.
  • Broadcast event source: PubSub / Stream.fromPubSub(...) or SubscriptionRef for latest-value state.
  • Polling worker: runPass().pipe(Effect.repeat(Schedule.spaced(...))), with typed pass failures handled before repeat.
  • Retry transient operation: Effect.retry(...) / Effect.retryOrElse(...) with a bounded Schedule.
  • Keyed lookup cache with TTL and concurrent-lookup dedupe: prefer Cache.make(...) / exit-aware Cache.makeWith(...) when their lifecycle and eviction model fit.
  • Memoize a single effect result: Effect.cached(...) / Effect.cachedWithTTL(...).
  • Batch N keys into one backend call (only when a real batch endpoint exists): Effect.request(...) + RequestResolver.
  • HTTP request in an Effect application: prefer Effect HttpClient plus request/response schema decoding.
  • HTTP transient retry: HttpClient.retryTransient(...).
  • Time-sensitive test: TestClock, not real sleeping.
  • Concurrent/background test synchronization: Deferred, Queue, Latch, Ref, or explicit test hooks.

Boundary Rules

  • Keep HTTP handlers thin: decode input, read context, call services, map typed errors to transport responses.
  • Keep business rules in services or domain functions, not transport handlers.
  • Wrap HTTP clients, SDKs, CLIs, and external integrations in named effects at adapter boundaries.
  • Decode persisted rows with Schema or SQL-specific helpers when values are not trivially trusted.
  • Keep provider/network calls outside authoritative database transactions.
  • Catch or retry only when the current boundary has a truthful response.
  • Retry only when the operation has proven idempotency.
  • Let exhausted failures remain visible unless the boundary has a real fallback.

Do Nots

  • Do not use as any, non-null assertions, or unchecked casts to silence Effect typing problems.
  • Do not introduce Schema.Class or Schema.TaggedClass as default app data-modeling patterns.
  • Do not hand-roll _tag error classes when Schema.TaggedError fits.
  • Do not use cause-level recovery when typed-error recovery is enough.
  • Do not use Layer.mergeAll(...) or provideMerge(...) as blind make-it-compile tools.
  • Do not hide required application authority, credentials, persistence, transports, or external services behind Context.Reference defaults.
  • Do not add arbitrary Effect.sleep(...) to tests when a deterministic synchronization primitive is available.
  • Do not hand-roll Map/TTL/prune caches or in-flight dedupe when effect/Cache fits.

常見問題

effect 技能有什麼用途?

關於使用Effect v4建立TypeScript生產應用程式指南的意見,包括工作流程、服務、層、結構、設定、排程、快取、執行緒、HTTP客戶端和測試。

如何安裝 effect?

打開本頁的「安裝」區塊並選擇你的代理 — Claude Code、Codex、Cursor 或 Gemini CLI:那裡有把技能資料夾複製到正確位置的現成指令。也可以複製「透過助理」分頁中的提示,讓助理自行檢查並安裝技能。

effect 適用哪些 AI 模型?

技能是純 Markdown 指示(Agent Skills 格式),因此 effect 適用任何讀取 SKILL.md 的代理:Claude Code、Codex、Cursor、Gemini CLI、GitHub Copilot、OpenCode 等。只有在任務符合技能描述時,模型才會載入指示。

effect 是免費的嗎?

此技能由 kitlangton 公開發布,採用 MIT 授權。技能本身免費 — 你只需向 AI 供應商支付實際使用的 token 費用。

安裝技能安全嗎?

技能是代理會遵循的指示,安裝前請閱讀 SKILL.md 及相關檔案。技能資料夾中的腳本只有在代理執行時才會運行 — 留意它的動作,不要授予多餘權限。

技能和 MCP 伺服器或外掛有何不同?

MCP 伺服器或外掛為模型提供新工具 — 會執行並回傳結果的程式碼。技能提供的是知識與流程:如何處理任務、要遵循哪些步驟、好的成果長什麼樣子。它不需要伺服器或 API 金鑰。

相關技能

所有技能 →