spectrum
Build or review messaging agents with Photon Spectrum (`spectrum-ts`). Use for Spectrum setup, messages and content, spaces and users, provider capabilities, iMessage/WhatsApp/Terminal integrations, custom platforms, lifecycle, or production message-processing architecture.
- License 许可
- MIT
- 所属仓库
- caezium/skills
- 最近更新
- 2026-08-24
- Stars
- ★ 3
- Forks
- 0
01 前言 Front Matter
- name
- spectrum
- license
- MIT
- metadata
- { "author": "photon-hq", "version": "2.1.0" }
- description
- Build or review messaging agents with Photon Spectrum (`spectrum-ts`). Use for Spectrum setup, messages and content, spaces and users, provider capabilities, iMessage/WhatsApp/Terminal integrations, custom platforms, lifecycle, or production message-processing architecture.
02 资源文件 13
- 参考文档best-practices.md11.7 KB
- 参考文档capability-semantics.md2.1 KB
- 参考文档content.md4.3 KB
- 参考文档custom-events-and-lifecycle.md1.4 KB
- 参考文档custom-platforms.md7.4 KB
- 参考文档getting-started.md4.3 KB
- 参考文档messages.md4.4 KB
- 参考文档platform-narrowing.md1.7 KB
- 参考文档providers/imessage.md6.9 KB
- 参考文档providers/terminal.md1.9 KB
- 参考文档providers/whatsapp-business.md1.0 KB
- 参考文档reactions-and-replies.md1.2 KB
- 参考文档spaces-and-users.md3.7 KB
03 SKILL.md 正文
Spectrum
Spectrum is Photon's unified messaging SDK. Write handler logic against one app.messages stream and deliver it through iMessage, WhatsApp Business, Terminal, or a custom provider. This skill targets spectrum-ts 12.2.0; its code samples are TypeScript.
Contract gate
Identify the provider and load its topic file before writing provider-specific code. A sample is complete only when every import, method, content shape, platform ID, fallback, and thrown error belongs to spectrum-ts 12.2.0 and the selected provider contract. The universal method existing does not prove that every provider implements it; read capability-semantics.md whenever support affects correctness.
How this skill is organized
Each topic lives in its own file in this directory. Read the file relevant to the user's question.
| File | When to consult |
|---|---|
getting-started.md |
Installation, the Spectrum() app instance, multi-platform setup, the four core primitives. |
messages.md |
Receiving messages, the Message shape, narrowing on content.type, filtering own messages. |
content.md |
Content builders for outgoing messages: text, markdown, attachment, voice, contact, richlink, app, poll, group, custom. |
spaces-and-users.md |
The Space interface, typing indicators, responding, creating DMs and groups. |
reactions-and-replies.md |
message.react(...), threaded message.reply(...), when to use which. |
capability-semantics.md |
Native support vs fallback, warn-and-skip, accepted no-op, and thrown errors. |
platform-narrowing.md |
Recovering platform-specific types from generic Spectrum primitives. |
providers/imessage.md |
iMessage — separate cloud/local providers, shared/dedicated cloud line model, per-phone routing, message effects, tapbacks. |
providers/terminal.md |
Terminal TUI provider — chat sidebar, reactions, replies, attachments, slash commands. |
providers/whatsapp-business.md |
WhatsApp Business Cloud API. 1:1 only. |
custom-events-and-lifecycle.md |
Per-provider event streams (app.typing, etc.), app.stop(), signal handling. |
custom-platforms.md |
Authoring your own provider with definePlatform — full field reference. |
best-practices.md |
Production architecture patterns Photon uses internally — debounce pipeline, in-flight cancellation, carry-forward, idempotent retries, per-resource memory, job-failure audit log. |
See also
04 同仓库更多 Skills
writing-for-agents
Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.
wrangler
Cloudflare Workers CLI for deploying, developing, and managing Workers, KV, R2, D1, Vectorize, Hyperdrive, Workers AI, Containers, Queues, Workflows, Pipelines, and Secrets Store. Load before running wrangler commands to ensure correct syntax and best practices. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.
workers-best-practices
Reviews and authors Cloudflare Workers code against production best practices. Load when writing new Workers, reviewing Worker code, configuring wrangler.jsonc, or checking for common Workers anti-patterns (streaming, floating promises, global state, secrets, bindings, observability). Biases towards retrieval from Cloudflare docs over pre-trained knowledge.
wizard
Generate an interactive bash wizard that walks a human through steps only they can perform. Use when provisioning infrastructure, setting up credentials or CI secrets, walking an unfamiliar third-party dashboard, or running a one-off migration or cutover. Don't invoke this for steps the agent can perform itself.
why
Use for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds. Discovers available evidence sources, searches each relevant category, and returns a cited read on decisions and tradeoffs. Use how for runtime behavior.
week-prep
Generate a briefing with calendar, tasks, and attention flags. Use for "week prep", "briefing", or "what's on this week".