本文へスキップ
Skillpedia
APIとサーバー(バックエンド)19k · #10491

iii-architecture-patterns

できること

iiiの構成要素を組み合わせて、ステップごとのワークフロー、リアクティブなバックエンド、イベント駆動型システムなど、より大きなバックエンド設計を作る方法を示します。単一の関数より大きなシステムを設計する開発者向けです。

使う場面

  • ✓複数のステップからなる処理を、再試行と各ステップの追跡付きで実行したいとき。
  • ✓データの変化に合わせてビューやキャッシュを同期させたいとき。
  • ✓複数のAIエージェントが互いに作業を引き渡す必要があるとき。

スキルのリンク

https://github.com/iii-hq/iii/blob/main/skills/iii-architecture-patterns/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/iii-hq/iii/blob/main/skills/iii-architecture-patterns/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“注文処理のための耐久性のあるワークフローを設計してください。失敗した処理用にデッドレターキューも付けてください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

このスキルは、要件に合ったパターンを選びます。再試行のための耐久性ワークフローや、別の関数の結果に反応するオブザーバーなどです。その後、関数、トリガー、キュー、状態を使って設計を組み立てます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Architecture Patterns

Use this skill when the task is larger than one function or trigger. Pick the pattern from the requirement, then implement it with Function, Trigger, Worker, observers, state, queues, streams, and pub/sub.

Pattern Map

Requirement Pattern iii shape
Sequential work with retries, DLQ, step tracking Durable workflow Functions chained through named queues, progress in state
Keep views, metrics, cache, or clients in sync Reactive backend State triggers plus stream/pubsub side effects
React to another function's calls, results, or failures without changing it Observer side effect iii.observe({ function_id, on, filters }, target) (iii-observe)
Specialized AI agents hand work to each other Agentic backend One function per agent, queue handoffs, shared state
Commands publish events and projections update independently Event-driven CQRS Command functions, event log in state, subscribe triggers
Pure, traceable composition Effect pipeline Small functions composed synchronously with trigger()
Webhook/cron automation chains Low-code automation Trigger, transform, action nodes chained by enqueue

Durable Workflow

Use named queues when steps need different retry, FIFO, or concurrency policy.

TypeScript

import { registerWorker, TriggerAction } from "iii-sdk";

const iii = registerWorker("ws://localhost:49134", { workerName: "order-workflow" });

async function track(orderId: string, step: string, status: string) {
  await iii.trigger({
    function_id: "state::update",
    payload: { scope: "orders", key: orderId, ops: [{ type: "merge", path: ["steps"], value: { [step]: status } }] },
  });
}

iii.registerFunction("orders::validate", async (order) => {
  await track(order.id, "validate", "done");
  return iii.trigger({
    function_id: "orders::charge",
    payload: order,
    action: TriggerAction.Enqueue({ queue: "order-payment" }),
  });
});

iii.registerFunction("orders::charge", async (order) => {
  await track(order.id, "payment", "done");
  return iii.trigger({
    function_id: "orders::ship",
    payload: order,
    action: TriggerAction.Enqueue({ queue: "order-ship" }),
  });
});

Python

from iii import register_worker

iii = register_worker("ws://localhost:49134")

def track(order_id, step, status):
    iii.trigger({
        "function_id": "state::update",
        "payload": {
            "scope": "orders",
            "key": order_id,
            "ops": [{"type": "merge", "path": ["steps"], "value": {step: status}}],
        },
    })

def validate(order):
    track(order["id"], "validate", "done")
    return iii.trigger({
        "function_id": "orders::charge",
        "payload": order,
        "action": {"type": "enqueue", "queue": "order-payment"},
    })

iii.register_function("orders::validate", validate)

Rust

use iii_sdk::TriggerAction;
use iii_sdk::protocol::TriggerRequest;
use serde_json::json;

async fn enqueue_charge(iii: iii_sdk::IIIClient, order: serde_json::Value) -> Result<serde_json::Value, iii_sdk::Error> {
    iii.trigger(TriggerRequest {
        function_id: "state::update".into(),
        payload: json!({
            "scope": "orders",
            "key": order["id"],
            "ops": [{ "type": "merge", "path": ["steps"], "value": { "validate": "done" } }]
        }),
        action: None,
        timeout_ms: None,
    }).await?;

    iii.trigger(TriggerRequest {
        function_id: "orders::charge".into(),
        payload: order,
        action: Some(TriggerAction::Enqueue { queue: "order-payment".into() }),
        timeout_ms: None,
    }).await
}

Reactive Backend

Use state triggers when the requirement says "after create/update, do this", "avoid polling", or "push live updates".

iii.registerFunction("todos::on-change", async (event) => {
  await iii.trigger({
    function_id: "stream::send",
    payload: { stream_name: "todos-live", group_id: "default", data: event.new_value },
    action: TriggerAction.Void(),
  });
});

iii.registerTrigger({
  type: "state",
  function_id: "todos::on-change",
  config: { scope: "todos" },
});

Observer Side Effects

Use an observer when "after X runs (or fails), also do Y" and X should not know about Y: audit logs, alerts, projections, cache invalidation. Every function is observable since 0.25, and an observer failure never affects the observed cal

よくある質問

ここでのデッドレターキューとは何ですか?

再試行後も失敗した処理を保持するキューで、後から調べられるようにするものです。

既存の関数を変更しますか?

オブザーバーなど一部のパターンは、関数を変更せずに別の関数の呼び出しに反応します。

どのパターンが対象ですか?

耐久性ワークフロー、リアクティブなバックエンド、オブザーバー、エージェントのパイプライン、イベント駆動型設計、エフェクトパイプライン、自動化チェーンです。

詳細

作者による元の説明

Use when composing iii primitives into backend architectures: durable workflows, reactive backends, observer side effects, agentic pipelines, event-driven CQRS, effect pipelines, and trigger-transform-action automation.

repo: iii-hq/iii

人気

GitHubのスター
19k
ランキング
#10491
ライセンス
—
更新日
2026/11/2

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル