Token导航 LogoToken导航

Agent Skill · 运维和基础设施

gleam-actor-model(闪光演员模型)

gleam-actor-model 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

gleam-actor-model 是运维和基础设施类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证为 MIT,第三方扫描有未通过项,按安装量在运维和基础设施类的 2,449 个 Skill 里排第 181。

总安装 11,771周安装 560GitHub Stars 142下载 6,443核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:gleam-actor-model(闪光演员模型)
来源仓库:https://github.com/thebushidocollective/han
仓库路径:skills/gleam-actor-model
安装命令:
npx skills add https://github.com/thebushidocollective/han --skill 'Gleam Actor Model'
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/thebushidocollective/han --skill 'Gleam Actor Model'

这个 Skill 是做什么的

运维和基础设施类 Skill 处理部署、监控、日志和云资源,多数需要较高的执行权限。

gleam-actor-model 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态、代码变更或协作事项进行整理。通过 npx skills add 命令从指定 GitHub 仓库安装并使用。

安装前需确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。建议结合来源仓库和原始 README 核验具体用法和功能细节。

来源仓库内路径:skills/gleam-actor-model

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/thebushidocollective/han --skill 'Gleam Actor…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

gleam-actor-model 怎么安装?

在终端执行 npx skills add https://github.com/thebushidocollective/han --skill 'Gleam Actor Model'。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

gleam-actor-model 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

gleam-actor-model 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add https://github.com/thebushidocollective/han --skill 'Gleam Actor Model';npx skills add thebushidocollective/han --skill "gleam-actor-model" 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

gleam-actor-model 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

gleam-actor-model 用的人多吗?

公开数据是累计安装 11,771 次,近一周安装 560 次,下载 6,443 次,GitHub 142 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

gleam-actor-model 安全吗?

第三方扫描有未通过项,风险较高。除非你确认过源码,否则不建议直接安装到常用环境。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理运维和基础设施类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要厂商级技术支持和 SLA 的生产系统。

运维和基础设施类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
brainstorming

头脑风暴 · Codex、Claude

3,148,776173,131操作浏览器MIT通过
copywriting

文案写作 · Codex、Claude

1,996,72425,583需要联网MIT通过
openclaw-secure-linux-cloud

OpenClaw secure linux cloud 命令行 · Codex、Claude

1,853,08840接触敏感数据未明确未通过
xget

xget 命令行 · Codex、Claude

1,799,28040执行命令未明确未通过
requesting-code-review

代码审查请求 · Codex、Claude

1,590,144173,103权限未标注MIT通过
gleam-actor-model

闪光演员模型 · 本页

11,771142执行命令MIT未通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Gleam Actor Model

Introduction

Gleam leverages the Erlang VM's actor model, enabling lightweight concurrent processes that communicate through message passing. This model provides inherent fault tolerance, isolation, and scalability, making it ideal for building distributed systems.

The actor model in Gleam uses OTP (Open Telecom Platform) patterns including GenServers for stateful processes, supervisors for fault recovery, and message passing for inter-process communication. Each process has its own heap and communicates asynchronously, eliminating shared memory concerns.

This skill covers process creation and message passing, GenServer pattern for stateful actors, supervisors and fault tolerance, process linking and monitoring, selective receive, and patterns for building robust concurrent applications.

Process Basics and Message Passing

Processes are lightweight, isolated units of execution that communicate via message passing.

import gleam/erlang/process
import gleam/io

// Basic process creation
pub fn simple_process() {
  process.spawn(fn() {
    io.println("Hello from process!")
  })
}

// Process with message passing
pub type Message {
  Ping
  Pong
  Stop
}

pub fn echo_process() {
  let subject = process.new_subject()

  process.spawn(fn() {
    loop(subject)
  })

  subject
}

fn loop(subject: process.Subject(Message)) {
  case process.receive(subject, 1000) {
    Ok(Ping) -> {
      io.println("Received Ping")
      loop(subject)
    }
    Ok(Pong) -> {
      io.println("Received Pong")
      loop(subject)
    }
    Ok(Stop) -> {
      io.println("Stopping")
      Nil
    }
    Error(_) -> {
      io.println("Timeout")
      loop(subject)
    }
  }
}

// Sending messages
pub fn send_messages(subject: process.Subject(Message)) {
  process.send(subject, Ping)
  process.send(subject, Pong)
  process.send(subject, Stop)
}

// Request-response pattern
pub type Request {
  GetValue(reply_to: process.Subject(Int))
  SetValue(value: Int, reply_to: process.Subject(Nil))
}

pub fn state_process(initial: Int) {
  let subject = process.new_subject()

  process.spawn(fn() {
    state_loop(subject, initial)
  })

  subject
}

fn state_loop(subject: process.Subject(Request), state: Int) {
  case process.receive(subject, 5000) {
    Ok(GetValue(reply_to)) -> {
      process.send(reply_to, state)
      state_loop(subject, state)
    }
    Ok(SetValue(value, reply_to)) -> {
      process.send(reply_to, Nil)
      state_loop(subject, value)
    }
    Error(_) -> state_loop(subject, state)
  }
}

// Calling the state process
pub fn use_state_process() {
  let proc = state_process(0)
  let reply_subject = process.new_subject()

  // Set value
  process.send(proc, SetValue(42, reply_subject))
  let _ack = process.receive(reply_subject, 1000)

  // Get value
  process.send(proc, GetValue(reply_subject))
  case process.receive(reply_subject, 1000) {
    Ok(value) -> io.debug(value)
    Error(_) -> io.println("Timeout")
  }
}

// Process with multiple message types
pub type ServerMessage {
  Request(id: Int, reply_to: process.Subject(String))
  Broadcast(message: String)
  Shutdown
}

pub fn multi_message_process() {
  let subject = process.new_subject()

  process.spawn(fn() {
    multi_loop(subject, [])
  })

  subject
}

fn multi_loop(
  subject: process.Subject(ServerMessage),
  clients: List(process.Subject(String)),
) {
  case process.receive(subject, 1000) {
    Ok(Request(id, reply_to)) -> {
      let response = "Response for " <> int.to_string(id)
      process.send(reply_to, response)
      multi_loop(subject, [reply_to, ..clients])
    }
    Ok(Broadcast(message)) -> {
      list.each(clients, fn(client) {
        process.send(client, message)
      })
      multi_loop(subject, clients)
    }
    Ok(Shutdown) -> Nil
    Error(_) -> multi_loop(subject, clients)
  }
}

// Process pools
pub fn worker_pool(size: Int) -> List(process.Subject(Message)) {
  list.range(1, size)
  |> list.map(fn(_) { echo_process() })
}

pub fn distribute_work(pool: List(process.Subject(Message)),
                       work: List(Message)) {
  list.zip(work, list.cycle(pool))
  |> list.each(fn(pair) {
    let #(message, worker) = pair
    process.send(worker, message)
  })
}

Lightweight processes with message passing enable concurrent applications without shared memory complexity.

GenServer Pattern

GenServer provides a standard pattern for stateful processes with synchronous and asynchronous operations.

import gleam/otp/actor
import gleam/erlang/process

// State type
pub type Counter {
  Counter(value: Int)
}

// Message types
pub type CounterMessage {
  Increment
  Decrement
  GetValue(reply_to: process.Subject(Int))
  Reset(reply_to: process.Subject(Nil))
}

// GenServer implementation
pub fn start_counter() -> Result(process.Subject(CounterMessage),
                                 actor.StartError) {
  actor.start(Counter(value: 0), handle_message)
}

fn handle_message(
  message: CounterMessage,
  state: Counter,
) -> actor.Next(CounterMessage, Counter) {
  case message {
    Increment -> {
      actor.continue(Counter(value: state.value + 1))
    }
    Decrement -> {
      actor.continue(Counter(value: state.value - 1))
    }
    GetValue(reply_to) -> {
      process.send(reply_to, state.value)
      actor.continue(state)
    }
    Reset(reply_to) -> {
      process.send(reply_to, Nil)
      actor.continue(Counter(value: 0))
    }
  }
}

// Using the GenServer
pub fn use_counter() {
  case start_counter() {
    Ok(counter) -> {
      // Increment
      process.send(counter, Increment)
      process.send(counter, Increment)

      // Get value
      let reply = process.new_subject()
      process.send(counter, GetValue(reply))
      case process.receive(reply, 1000) {
        Ok(value) -> io.debug(value)  // 2
        Error(_) -> io.println("Timeout")
      }
    }
    Error(_) -> io.println("Failed to start counter")
  }
}

// GenServer with complex state
pub type CacheState {
  CacheState(items: Dict(String, String), max_size: Int)
}

pub type CacheMessage {
  Get(key: String, reply_to: process.Subject(Option(String)))
  Put(key: String, value: String, reply_to: process.Subject(Bool))
  Delete(key: String, reply_to: process.Subject(Bool))
  Size(reply_to: process.Subject(Int))
}

pub fn start_cache(max_size: Int) -> Result(process.Subject(CacheMessage),
                                            actor.StartError) {
  actor.start(
    CacheState(items: dict.new(), max_size: max_size),
    handle_cache_message,
  )
}

fn handle_cache_message(
  message: CacheMessage,
  state: CacheState,
) -> actor.Next(CacheMessage, CacheState) {
  case message {
    Get(key, reply_to) -> {
      let value = dict.get(state.items, key)
      process.send(reply_to, value)
      actor.continue(state)
    }
    Put(key, value, reply_to) -> {
      let current_size = dict.size(state.items)
      case current_size < state.max_size {
        True -> {
          let new_items = dict.insert(state.items, key, value)
          process.send(reply_to, True)
          actor.continue(CacheState(..state, items: new_items))
        }
        False -> {
          process.send(reply_to, False)
          actor.continue(state)
        }
      }
    }
    Delete(key, reply_to) -> {
      let new_items = dict.delete(state.items, key)
      process.send(reply_to, True)
      actor.continue(CacheState(..state, items: new_items))
    }
    Size(reply_to) -> {
      process.send(reply_to, dict.size(state.items))
      actor.continue(state)
    }
  }
}

// GenServer with initialization
pub type ConnectionState {
  ConnectionState(url: String, connected: Bool)
}

pub type ConnectionMessage {
  Connect(reply_to: process.Subject(Result(Nil, String)))
  Disconnect
  Status(reply_to: process.Subject(Bool))
}

pub fn start_connection(url: String) ->
  Result(process.Subject(ConnectionMessage), actor.StartError) {
  actor.start_spec(actor.Spec(
    init: fn() {
      // Initialization logic
      let state = ConnectionState(url: url, connected: False)
      actor.Ready(state, process.new_selector())
    },
    init_timeout: 5000,
    loop: handle_connection_message,
  ))
}

fn handle_connection_message(
  message: ConnectionMessage,
  state: ConnectionState,
) -> actor.Next(ConnectionMessage, ConnectionState) {
  case message {
    Connect(reply_to) -> {
      case state.connected {
        True -> {
          process.send(reply_to, Error("Already connected"))
          actor.continue(state)
        }
        False -> {
          // Simulate connection
          process.send(reply_to, Ok(Nil))
          actor.continue(ConnectionState(..state, connected: True))
        }
      }
    }
    Disconnect -> {
      actor.continue(ConnectionState(..state, connected: False))
    }
    Status(reply_to) -> {
      process.send(reply_to, state.connected)
      actor.continue(state)
    }
  }
}

// GenServer with timeout
pub type TimedMessage {
  Heartbeat
  Data(String)
  Timeout
}

pub fn timed_actor() -> Result(process.Subject(TimedMessage), actor.StartError) {
  actor.start(0, fn(message, state) {
    case message {
      Heartbeat -> {
        io.println("Heartbeat received")
        actor.continue(state)
      }
      Data(str) -> {
        io.println("Data: " <> str)
        actor.continue(state)
      }
      Timeout -> {
        io.println("Timeout occurred")
        actor.Stop(process.Normal)
      }
    }
  })
}

GenServer pattern provides structure for stateful concurrent processes with standard message handling.

Supervisors and Fault Tolerance

Supervisors monitor child processes and restart them on failure, enabling fault-tolerant systems.

import gleam/otp/supervisor
import gleam/erlang/process

// Simple worker
pub fn worker() -> Result(process.Subject(Message), actor.StartError) {
  actor.start(0, fn(message, state) {
    case message {
      Ping -> {
        io.println("Worker alive")
        actor.continue(state)
      }
      Stop -> actor.Stop(process.Normal)
      _ -> actor.continue(state)
    }
  })
}

// Supervisor specification
pub fn start_supervisor() ->
  Result(process.Subject(supervisor.Message), supervisor.StartError) {
  supervisor.start(fn(children) {
    children
    |> supervisor.add(supervisor.worker(fn(_) { worker() }))
    |> supervisor.add(supervisor.worker(fn(_) { worker() }))
  })
}

// Supervisor with named workers
pub type WorkerName {
  CounterWorker
  CacheWorker
  DatabaseWorker
}

pub fn start_named_supervisor() ->
  Result(process.Subject(supervisor.Message), supervisor.StartError) {
  supervisor.start(fn(children) {
    children
    |> supervisor.add(supervisor.worker_spec(
      start: fn(_) { start_counter() },
      restart: supervisor.RestartForever,
    ))
    |> supervisor.add(supervisor.worker_spec(
      start: fn(_) { start_cache(100) },
      restart: supervisor.RestartForever,
    ))
  })
}

// Supervisor tree
pub fn start_application() ->
  Result(process.Subject(supervisor.Message), supervisor.StartError) {
  supervisor.start(fn(children) {
    children
    // Workers
    |> supervisor.add(supervisor.worker(fn(_) { start_counter() }))
    |> supervisor.add(supervisor.worker(fn(_) { start_cache(100) }))
    // Child supervisor
    |> supervisor.add(supervisor.supervisor(fn(children) {
      children
      |> supervisor.add(supervisor.worker(fn(_) { worker() }))
      |> supervisor.add(supervisor.worker(fn(_) { worker() }))
    }))
  })
}

// Custom restart strategy
pub fn start_custom_supervisor() ->
  Result(process.Subject(supervisor.Message), supervisor.StartError) {
  supervisor.start_spec(supervisor.Spec(
    argument: Nil,
    max_frequency: 5,
    frequency_period: 60,
    init: fn(children) {
      children
      |> supervisor.add(supervisor.worker_spec(
        start: fn(_) { worker() },
        restart: supervisor.RestartTransient,  // Only restart if abnormal exit
      ))
    },
  ))
}

// One-for-one vs one-for-all
pub fn one_for_one_supervisor() {
  // Each child restarts independently
  supervisor.start(fn(children) {
    children
    |> supervisor.add(supervisor.worker(fn(_) { worker() }))
    |> supervisor.add(supervisor.worker(fn(_) { worker() }))
  })
}

// Dynamic supervisor (adding children at runtime)
pub type DynamicMessage {
  AddWorker(reply_to: process.Subject(Result(process.Pid, String)))
  RemoveWorker(pid: process.Pid)
}

Supervisors provide automatic fault recovery and system resilience through process monitoring and restarts.

Process Linking and Monitoring

Links and monitors enable processes to react to failures in related processes.

import gleam/erlang/process

// Process linking
pub fn linked_processes() {
  let parent = process.self()

  let child = process.spawn_link(fn() {
    io.println("Child process started")
    process.sleep(1000)
    io.println("Child process exiting")
  })

  // Parent is linked to child - will receive exit signal
  io.println("Parent waiting...")
  process.sleep(2000)
}

// Process monitoring
pub fn monitored_process() {
  let monitored = process.spawn(fn() {
    io.println("Monitored process started")
    process.sleep(1000)
  })

  let monitor = process.monitor_process(monitored)

  // Wait for down message
  let selector = process.new_selector()
    |> process.selecting_process_down(monitor, fn(down) { down })

  case process.select(selector, 2000) {
    Ok(down) -> io.println("Process exited")
    Error(_) -> io.println("Still running")
  }
}

// Trap exits for supervision
pub fn trap_exits() {
  process.trap_exits(True)

  let child = process.spawn_link(fn() {
    io.println("Child starting")
    panic as "Simulated error"
  })

  let selector = process.new_selector()
    |> process.selecting_trapped_exits(fn(exit) { exit })

  case process.select(selector, 2000) {
    Ok(exit) -> {
      io.println("Caught exit from child")
      // Can restart child here
    }
    Error(_) -> io.println("No exit received")
  }
}

// Monitor multiple processes
pub fn monitor_pool(workers: List(process.Pid)) {
  let monitors = list.map(workers, process.monitor_process)

  // Handle any worker failure
  let selector = list.fold(monitors, process.new_selector(), fn(sel, mon) {
    process.selecting_process_down(sel, mon, fn(down) { down })
  })

  case process.select(selector, 10000) {
    Ok(down) -> {
      io.println("Worker failed")
      // Restart logic here
    }
    Error(_) -> io.println("All workers healthy")
  }
}

Links and monitors enable building fault-tolerant systems with proper failure handling.

Best Practices

  1. Use GenServer for stateful processes to leverage OTP patterns and standard behaviors
  2. Wrap GenServers in supervisor trees to enable automatic recovery from failures
  3. Keep process state minimal to reduce memory usage and simplify state management
  4. Use message types with reply_to fields for synchronous request-response patterns
  5. Set appropriate timeouts on receive operations to prevent indefinite blocking
  6. Monitor external processes rather than linking when you don't want to crash together
  7. Use descriptive message types with custom types rather than generic tuples
  8. Handle all message types in loops to prevent unexpected message accumulation
  9. Design for failure by assuming processes will crash and using supervisors
  10. Keep process hierarchies simple with clear parent-child relationships

Common Pitfalls

  1. Not handling timeout cases in receive operations causes process to hang indefinitely
  2. Forgetting to reply in request-response patterns causes client timeout
  3. Creating too many processes without reason adds overhead without benefits
  4. Not using supervisors loses fault tolerance benefits of the actor model
  5. Blocking in message handlers prevents processing other messages causing deadlock
  6. Accumulating unconsumed messages in mailbox causes memory leaks
  7. Linking processes incorrectly causes unintended crash propagation
  8. Not setting init_timeout on actors causes startup delays to crash system
  9. Using shared mutable state defeats isolation benefits of actor model
  10. Ignoring exit signals when trapping exits prevents proper cleanup

When to Use This Skill

Apply actors for concurrent operations requiring isolated state and message-based communication.

Use GenServers when implementing stateful services like caches, connections, or workers.

Leverage supervisors for any process that should automatically restart on failure.

Apply process monitoring when one process needs to react to another's termination.

Use process pools for distributing work across multiple concurrent workers.

Build supervisor trees for structuring complex applications with multiple components.

Resources

平台分布

Claude Code

26.2%
按下载量换算1,688

Codex

22.66%
按下载量换算1,460

OpenCode

16.95%
按下载量换算1,092

Antigravity

11.53%
按下载量换算743

windsurf

8.6%
按下载量换算554

Gemini CLI

3.34%
按下载量换算215

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/thebushidocollective/han --skill 'Gleam Actor Model';npx skills add thebushidocollective/han --skill "gleam-actor-model" 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。

继续浏览同类 Skills