跳到正文
cccskills
免费在 GitHub 公开

iii-architecture-patterns

Design iii backends by combining functions, queues, and shared state. Choose patterns for workflows with retries, live updates, cooperating AI agents, and event-driven processing, with examples showing how the pieces connect.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

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

查看安装方法

适用场景

  • Designing order workflows with retries and step tracking
  • Updating screens or caches when stored data changes
  • Passing tasks between specialized AI agents
  • Separating commands from query-oriented data updates

包含的文件(1)

  • SKILL.md6.6 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

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, state, queues, streams, and pub/sub.

Pattern Map

RequirementPatterniii shape
Sequential work with retries, DLQ, step trackingDurable workflowFunctions chained through named queues, progress in state
Keep views, metrics, cache, or clients in syncReactive backendState triggers plus stream/pubsub side effects
Specialized AI agents hand work to each otherAgentic backendOne function per agent, queue handoffs, shared state
Commands publish events and projections update independentlyEvent-driven CQRSCommand functions, event log in state, subscribe triggers
Pure, traceable compositionEffect pipelineSmall functions composed synchronously with trigger()
Webhook/cron automation chainsLow-code automationTrigger, 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" },
});

Agentic Backend

Model each agent as a function with one responsibility. Store shared context in state and hand off work through named queues.

iii.registerFunction("agents::researcher", async (task) => {
  await iii.trigger({
    function_id: "state::set",
    payload: { scope: "research", key: task.id, value: { findings: [] } },
  });
  return iii.trigger({
    function_id: "agents::critic",
    payload: task,
    action: TriggerAction.Enqueue({ queue: "agent-tasks" }),
  });
});

Event-Driven CQRS

Commands validate and publish domain events. Projections subscribe independently and write query-optimized state.

iii.registerFunction("cmd::add-inventory-item", async (input) => {
  const event = { type: "inventory.item-added", itemId: input.itemId, quantity: input.quantity };
  await iii.trigger({
    function_id: "state::set",
    payload: { scope: "inventory-events", key: `${Date.now()}-${input.itemId}`, value: event },
  });
  await iii.trigger({ function_id: "publish", payload: { topic: event.type, data: event } });
  return { accepted: true };
});

iii.registerTrigger({
  type: "subscribe",
  function_id: "proj::inventory-list",
  config: { topic: "inventory.item-added" },
});

Selection Rules

  • Use sync composition for short effect pipelines where the caller needs the final result.
  • Use enqueue for unreliable, slow, or must-complete steps.
  • Use pub/sub for independent fan-out where each subscriber can tolerate event-style delivery.
  • Use state triggers for derived views and side effects that should run automatically after writes.
  • Use cron triggers for scheduled maintenance and periodic starts.
  • Keep each function small enough to test independently.

When to Use

  • Use this skill for complete backend patterns: workflows, agentic systems, reactive apps, CQRS, effect pipelines, and automation chains.
  • Use this when the request describes product behavior rather than a single SDK API call.

Boundaries

  • For exact trigger config, function registration syntax, custom triggers, channels, and HTTP-invoked functions, use iii-core-primitives.
  • For engine ports, adapters, engine-owned workers, and RBAC (rbac-proxy), use iii-engine-config; queue retry and FIFO policy live with the queue worker's docs.
  • For package-specific SDK syntax, use iii-sdk-reference.
  • Worker-backed capability details live with the worker docs, not as top-level iii skills.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Manage shared iii configuration with JSON Schema, a definition of allowed value structures. Covers validated settings, automatic change notifications, YAML edits, temporary overrides, and default initialization that preserves existing values.

中文简介正在准备中。当前显示英语简介。

  • Sharing validated settings between workers
  • Reacting to manual YAML configuration edits
  • Initializing defaults while preserving existing values
iii-hq/iii1.9万2026年10月18日 更新

iii

免费

Helps extend an iii system by checking live functions, searching the public worker registry, and writing a worker when needed. Covers TypeScript SDK calls, event triggers, error handling, and worker operation through Compose.

中文简介正在准备中。当前显示英语简介。

  • Finding and calling functions already available in iii
  • Searching for and adding a published worker
  • Building a custom worker with the TypeScript SDK
iii-hq/iii1.9万2026年10月18日 更新

Guides development of iii functions, event triggers, and workers, the processes that execute functions. Helps choose result-returning calls, one-way calls, or queued work, inspect live registrations, and connect existing HTTP services.

中文简介正在准备中。当前显示英语简介。

  • Running a function on an HTTP request or schedule
  • Choosing between direct calls and queued work
  • Inspecting registered workers and functions
iii-hq/iii1.9万2026年10月18日 更新

Helps configure an iii engine for Compose management or direct supervision by tools such as systemd. Covers configuration file structure, ports, storage, and role-based access control through rbac-proxy, including requirements for public connections.

中文简介正在准备中。当前显示英语简介。

  • Configuring an engine managed by Compose
  • Configuring an engine supervised by systemd or Kubernetes
  • Setting authentication and access rules for public connections
iii-hq/iii1.9万2026年10月18日 更新

Diagnose iii invocation failures using error codes across Node, Python, Rust, and browser workers. Distinguish permission denials, timeouts, and handler failures, then choose appropriate exception handling and decide whether retrying is suitable.

中文简介正在准备中。当前显示英语简介。

  • Diagnosing failed function calls by error code
  • Deciding whether a timed-out operation should be retried
  • Handling permission denials without blind retries
iii-hq/iii1.9万2026年10月18日 更新

Set up a new iii backend from engine installation to a working HTTP endpoint. Guides project creation, SDK installation, a first worker in TypeScript, Python, or Rust, and adding existing workers.

中文简介正在准备中。当前显示英语简介。

  • Installing iii and creating a new project
  • Installing an SDK for the chosen language
  • Writing and testing a first HTTP worker
iii-hq/iii1.9万2026年10月18日 更新

查看 iii-hq 的全部技能

报告此技能的问题