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.
Security Assessment
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 filesInstall spectrum
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
photon-hq/skills