Back to Skills

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.

14stars2forksUpdated 8/17/2026

Security Assessment

Safe(95/100)
Security Score95/100

About spectrum

This skill helps an agent build or review messaging agents with Photon's Spectrum SDK (`spectrum-ts`, targeting version 12.2.0). Spectrum is a unified messaging SDK: you write handler logic once against a single `app.messages` stream and deliver it through iMessage, WhatsApp Business, a Terminal TUI, or a custom provider. The skill solves the problem of writing provider-correct messaging code by enforcing a "contract gate" — identify the provider and load its topic file before writing provider-specific code, because a universal method existing does not guarantee every provider implements it.

The skill is organized as a set of focused topic files, each consulted per question: getting-started (installation, the `Spectrum()` app instance, multi-platform setup, core primitives), messages (the `Message` shape and narrowing on content type), content builders (text, markdown, attachment, voice, contact, richlink, app, poll, group, custom), spaces and users, reactions and threaded replies, capability semantics (native support vs fallback, warn-and-skip, accepted no-op, thrown errors), platform narrowing, per-provider guides (iMessage cloud/local, Terminal, WhatsApp Business 1:1-only), custom events and lifecycle, and authoring custom platforms with `definePlatform`. A substantial best-practices file documents the production architecture Photon uses internally — a debounce pipeline, in-flight cancellation, carry-forward of drained messages, idempotent retries with stable client GUIDs, per-resource memory, and job-failure audit logging — illustrated with mermaid diagrams.

It targets TypeScript developers building conversational or notification agents that live natively inside instant-messaging apps, and reviewers checking such code for provider-contract correctness. The content is reference and architecture guidance; it contains no destructive operations, credential exfiltration, or remote code execution.

FAQ

Which providers does Spectrum support?

iMessage (separate cloud/local providers with shared/dedicated cloud line models), WhatsApp Business Cloud API (1:1 only), a Terminal TUI provider, and custom providers authored with `definePlatform`.

What is the 'contract gate' and why does it matter?

Before writing provider-specific code you must identify the provider and load its topic file. A method existing in the universal API does not prove every provider implements it, so you should read `capability-semantics.md` whenever support affects correctness (native support vs fallback, warn-and-skip, accepted no-op, or thrown error).

What version does the skill target?

`spectrum-ts` 12.2.0; every import, method, content shape, platform ID, fallback, and thrown error in a complete sample must belong to that version and the selected provider contract. Its code samples are TypeScript.

Does it cover production architecture, not just API usage?

Yes. The best-practices file details the patterns Photon uses in production: a five-stage debounced job pipeline, in-flight cancellation, carry-forward tables, idempotent retries with stable client GUIDs, resume cursors, per-resource memory, and a job-failure audit log.

Can I add my own messaging platform?

Yes, via `definePlatform`, documented in `custom-platforms.md` with a full field reference; per-provider event streams and lifecycle (e.g. `app.typing`, `app.stop()`, signal handling) are covered in the custom-events-and-lifecycle topic.

All Files

14 files
best-practices.md11.7 KB
View
content.md4.3 KB
View
getting-started.md4.3 KB
View
providers/imessage.md6.9 KB
View
capability-semantics.md2.1 KB
View
custom-platforms.md7.3 KB
View
platform-narrowing.md1.7 KB
View
providers/whatsapp-business.md1.0 KB
View
spaces-and-users.md3.7 KB
View
custom-events-and-lifecycle.md1.4 KB
View
messages.md4.4 KB
View
providers/terminal.md1.9 KB
View
SKILL.md3.3 KB
View
reactions-and-replies.md1.2 KB
View

Install spectrum

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill