Skein Language
What is Skein?
Section titled “What is Skein?”Skein is a programming language that compiles to BEAM bytecode and runs on the Erlang VM (OTP). It is co-optimized for two audiences: humans who read and review code, and LLM agents who generate and modify code.
The language sits at the intersection of three ideas:
- The BEAM/OTP runtime provides battle-tested concurrency, fault tolerance, and distribution — exactly what long-running agent processes need.
- An integrated platform model with trace-driven development and the “service as the unit of work” philosophy.
- Agent-writability as a first-class design constraint — a language whose entire spec fits in an LLM context window, with maximally regular syntax and a type system that doubles as a contract language for tool calling.
Current Status
Section titled “Current Status”The full compilation pipeline is operational. You can write .skein files, compile them to BEAM bytecode, and run them — including making real LLM calls to Claude with full tracing.
What works today:
- A compact construct set — modules, functions, types, enums, agents, tools, supervisors, handlers (HTTP/queue/schedule), tests (plus
scenarioandgoldentrace tests), pattern matching, pipes, capabilities - Full type system — type checking, type inference (field access resolves types), JSON schema derivation, constraint annotations
- Capability enforcement — compile-time and runtime checking for both modules and agents across all subsystems (HTTP, store, memory, LLM, tools)
- Production LLM backend — Anthropic integration with
llm.chat,llm.json, andllm.stream, with token-level usage tracking - Rich traces — every effect call produces structured trace spans with timing, outcome, and token usage
- Agent state machines —
gen_statem-based agents with compile-time phase transition verification - CLI tooling —
skein new,compile,build,test,run, andtrace, plusagents(AGENTS.md scaffolding),mcp(MCP server for coding agents),lsp,completions,version, andhelp - Editor support — VS Code extension with syntax highlighting, snippets, and full LSP (diagnostics, hover, go-to-definition, completions)
An extensive suite of unit, integration, and property-based tests passes clean across all four apps (compiler, runtime, CLI, LSP).
Quick Example
Section titled “Quick Example”module Hello { fn greet(name: String) -> String { "Hello, ${name}!" }
fn add(a: Int, b: Int) -> Int { a + b }
fn classify(n: Int) -> String { match n > 0 { true -> "positive" false -> "non-positive" } }}Compile and run — no Erlang or Elixir install required:
skein compile hello.skein# → Compiled: Skein.User.HelloScaffold a full project with tests, build everything, and start a server:
skein new my-servicecd my-serviceskein buildskein testskein runLLM Demo — Real Claude Calls with Traces
Section titled “LLM Demo — Real Claude Calls with Traces”Skein modules can declare LLM capabilities and make type-checked, traced calls to Claude:
module Demo { capability model("anthropic", "claude-opus-4-8")
fn greet(name: String) -> String { llm.chat("claude-opus-4-8", "You are friendly.", "Say hello to ${name} in one sentence.")! }
fn classify(text: String) -> String { llm.chat("claude-opus-4-8", "Answer with one word.", "Classify this as positive or negative: ${text}")! }}skein compile demo.skein# ...exercise the module (e.g. via skein test or a running service), then:skein trace --last 2 --kind llmTraces (2): [llm] chat (1244ms) [llm] chat (387ms)Every LLM call is capability-gated (the module must declare capability model(...)), type-checked, and automatically traced with token usage.