Effectのロゴ

Effect

コミュニティ
jpoehnelt
effect

Apply Effect v4 conventions for services, layers, tagged errors, boundary runners, resources, retries, deadlines, HTTP, and tests. Use when writing or reviewing TypeScript that imports effect, adds a service or error class, chooses where to run a program, bounds external I/O, or tests Effect code.

概要

公開者jpoehnelt
リポジトリskills
スキル名effect
スター
23
フォーク
1
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    jpoehneltがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルEffectをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/jpoehnelt/skills/tree/main/effect
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jpoehnelt/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/effect .claude/skills/effect
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでEffectを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にEffectを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Effectは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Effect v4

Assumes Effect v4 (the effect@4.0.x line, including its release candidates). Effect 3 differs in names and modules (Context.Tag, Effect.catchAll, @effect/platform); do not mix the two. Read the installed version before using an API you have not seen in the repo, and follow the repo's AGENTS.md where it differs from this skill: a repo rule or a documented exception wins.

Repo facts (from AGENTS.md): pinned Effect version and how bumps land, import policy (deep imports, effect/unstable/* barrels), boundary runners and the shared ManagedRuntime, the house error file, Effect lint gates, test runner and helpers, check and test commands.

Boundaries

A boundary is where a Promise or process exit is the contract: an HTTP or route handler, a framework load or action, a Durable Object method, a queue or workflow step body, an extension or CLI entrypoint. Everything else returns an Effect under its own name and composes with yield*.

  • Run programs only at boundaries, through the repo's runner and one ManagedRuntime per process (NodeRuntime.runMain for Node entrypoints). No Effect.runPromise/runSync/runFork in domain code outside tests.
  • No fooEffect twin, no Promise wrapper lifted back with Effect.promise, no runner's Promise re-entered as an Effect.
  • Browser code may import pure modules (Schema, Option, Data, Result) but never runs a program that needs services.
  • Deep imports (import * as Effect from "effect/Effect") unless the repo says otherwise. Keep every package on the same exact Effect version; bump it in its own change.

Errors

  • One class per expected failure, owned by the package that raises it. Schema.TaggedError when the error crosses a serialization boundary (wire, RPC, journal); Data.TaggedError is fine in-process if the repo allows it. Type cause as Schema.Defect().
  • Class name, _tag, wire code, and catchTag argument are one identifier, unique across everything a consumer can see. The compiler cannot catch a duplicate tag; use the repo's check if it has one.
  • Derive message on the class; never author it at the call site.
ts
class OrderNotFound extends Schema.TaggedError<OrderNotFound>()("OrderNotFound", {
  id: Schema.String,
}) {
  override get message() {
    return `order ${this.id} not found`;
  }
}
const load = Effect.fn("loadOrder")(function* (id: string) {
  const row = yield* findOrder(id);
  if (!row) return yield* new OrderNotFound({ id });
  return row;
});
  • Narrow with Effect.catchTag/catchTags, never by comparing a code or message string.
  • Lift a Promise API with Effect.tryPromise({ try, catch: (cause) => new SpecificError({ cause }) }). Never a zero-arg catch, never one generic catch-all class. An unmapped throw stays a defect.
  • Decode an error of unknown shape (RPC envelope, stored JSON, step failure) with a Schema.Union of the classes that operation admits, and derive the type from that schema. Never guess a class.
  • The public wire shape is an explicit projection ({ code, message } plus any public fields). Never encode the error class itself: that emits name, message, and nested cause.
  • Defects (bugs, missing config, broken bindings, failed setup) stay defects. Do not wrap setup or pure factories in Effect.try, and do not Effect.catchDefect/catchCause them into a domain error. The boundary runner reports and sanitizes them.
  • Retry policy lives where the retry happens (a while guard naming tags); errors carry no retryable flag.

Services and resources

  • A service is a Context.Service class with a concrete shape (class Db extends Context.Service<Db, DbShape>()("Db") {}). Dependencies travel in R and are supplied by Layer at the composition root. Tags expose shapes, not fallible Effects that produce shapes.
  • No deps = liveDeps parameter bags or module singletons. Build clients, pools, and connections in a scoped layer with Effect.acquireRelease so they close on shutdown and interruption.
  • On serverless runtimes (Workers), request-scoped I/O never lives in a memoized layer.
  • Read config with Config inside the layer that needs it; missing required config is a startup defect.

Functional core

  • Pure calculation (scoring, state transitions, diffing, decoding) stays synchronous and outside Effect.gen. Do not wrap a pure decision in an Effect.
  • Inside programs read time and randomness through Clock and Random, never Date.now(), new Date(), Math.random(), or ambient crypto.randomUUID(). In durable workflows, read time through the workflow's journaled step before branching.
  • Brand entity IDs at ingress with Schema.brand (or Brand.nominal outside schemas). Use Data.Class for in-memory equality; keep wire and journal values plain JSON.

State machines

Effect v4 has no state-machine module. Follow eng-state-machine for the design; this is how its parts map to Effect.

  • decide is plain TypeScript with no Effect, Clock, or service. If the repo provides a machine kernel (see its repo facts), use that kernel's decide. Otherwise match on both dimensions so a missing (state, command) pair is a type error: an outer Match.exhaustive over the state union with an inner one over the Schema.TaggedUnion of commands, or one match over a union of pairs. Matching commands alone only proves every command has a handler.
  • Decode the stored status at the boundary with Schema.Literals([...states]), so an unknown value never reaches decide, unless the kernel's decide already rejects unknown states as data.
  • decide returns a rejection as data. The write turns it into the owning package's tagged error; do not make decide fail in the error channel.
  • The write is one Effect.fn inside the repo's transaction: lock or read, decide, guarded update, outbox row. Read time and ids from Clock and the id service and pass them to decide. A guarded update that misses fails with a conflict tag the caller retries (Effect.retry({ while: (e) => e._tag === "...Conflict", times })); a miss under a row lock is a defect.
  • An in-memory machine (session, connection, worker) serializes moves with SynchronizedRef.modifyEffect and publishes states with SubscriptionRef.changes. Multi-step processes that wait on time or events belong in the repo's workflow engine, not in an entity machine.

IO

  • Trace service boundaries with Effect.fn("operationName")(function* () {...}); add dynamic attributes with Effect.annotateCurrentSpan. Private helpers stay untraced.
  • Outbound HTTP uses HttpClient with FetchHttpClient.layer (the module path depends on the installed v4 build: effect/http or effect/unstable/http/*; follow existing imports). Scope the response. No raw fetch with AbortSignal.timeout, Promise.race timers, or hand-rolled in-flight promise sets.
  • Give external I/O one total deadline covering setup, retries, retry delays, and body consumption: Effect.timeout around the whole retried operation, and Effect.retry({ while: isTransient, times, schedule: Schedule.exponential(...).pipe(Schedule.jittered) }) inside it.
  • Concurrency is Effect.all/Effect.forEach with explicit { concurrency }, never Promise.all inside Effect.gen. Long-lived consumers use Stream, Queue, and Fiber/FiberSet, not ad hoc timers.
  • Scope child work to its request, document, or connection. Interruption must join bounded cleanup before release; lift fallible finalizers with Effect.tryPromise and Effect.orDie an unrecoverable release failure.

Testing

  • Provide test layers (Effect.provide(TestLayer), Effect.provideService) instead of stubbing globals or vi.mock(). Pure core functions get plain synchronous tests.
  • Time: TestClock from effect/testing; fork the program, then TestClock.adjust.
  • Assert the failure _tag or code and the resulting state, not merely that something failed.
  • For boundary or resource-lifetime changes, add one test proving cancellation or cleanup (release order, stalled cleanup, no late writes), not just the success path. Signal readiness from the operation under test, not a sleep.
  • Durable step ids and their journal shapes are a persisted contract: a rename or changed result shape under the same id breaks in-flight runs and replay. Give a changed step a new id.

Review checklist

  • rg -n 'Effect\.(runPromise|runSync|runFork)' --glob '!**/*.test.ts' <paths> finds only boundary runners.
  • rg -n 'catchDefect|Date\.now\(\)|Math\.random\(\)' <changed paths> finds nothing inside Effect programs.
  • Each function returns its own Effect with the narrow union of tagged errors it can raise.
  • A state real data can reach stays modeled: a nullable column decodes with Schema.NullOr, a count over a cap is a tagged failure. Not orDie, not an invented ?? 0 default. An aggregate over zero rows returning its defined empty value is fine.
  • The repo's Effect gate, type check, and focused tests pass (commands in AGENTS.md).

よくある質問

AIスキル「Effect」では何ができますか?

Apply Effect v4 conventions for services, layers, tagged errors, boundary runners, resources, retries, deadlines, HTTP, and tests. Use when writing or reviewing TypeScript that imports effect, adds a service or error class, chooses where to run a program, bounds external I/O, or tests Effect code.

TypingMindでEffectを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Effectはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにEffectをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/jpoehnelt/skills/tree/main/effectを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Effectを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Effectは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもEffectを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Effect」は無料ですか?

はい。jpoehneltがGitHubでMITライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇