sms-best-practices/SKILL.md
General SMS best-practices guide for Rewrite-based systems. Use when the agent needs to define SMS architecture, contacts and segments strategy, deliverability, templates, retries, observability, webhook handling, or rollout guardrails before or alongside implementation.
npx skillsauth add rewritetoday/skills sms-best-practicesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when the user wants guidance, standards, or a checklist for building SMS flows with Rewrite.
If the task is implementation-heavy, pair this skill with:
send-sms/ for outbound send code, contacts, segments, and delivery lifecycle workrewrite-inbound/ for Rewrite webhook intake and event processingagent-sms-inbox/ for application-owned SMS agentshttps://api.rewritetoday.com/v1/contacts and /segments+55 numbers unless the project has international sending enabledto or contactcontact resolves by contact ID or exact contact nameto also ensures a Rewrite contact exists for that phone numbertemplateId plus variablesIdempotency-Keymessage.delivered exists in the public contract but is currently WIP+55 E.164 destination numbers.tags to encode stable business context like flow, campaign, or use_case./messages./messages or /messages/batch.content as the default fallback on templates.i18n, not in the message-create body.429 and transient 5xx.400 INVALID_JSON_BODY.401 INVALID_OR_MISSING_API_KEY as a configuration issue.403 PROJECT_SUBSCRIPTION_REQUIRED and PROJECT_BILLING_PAYMENT_REQUIRED as operational or billing blocks.X-RateLimit-Retry-After; the current platform returns it in milliseconds.429 or 5xx responses.X-RateLimit-Retry-After (ms) from the response.Idempotency-Key.2xx; stop after 3 failed attempts.svix-id, svix-timestamp, svix-signature.2xx once the event is durably accepted by your system.import { Webhook } from "svix";
export function verifyWebhook(rawBody: string, headers: Record<string, string>) {
const wh = new Webhook(process.env.REWRITE_WEBHOOK_SECRET!);
return wh.verify(rawBody, {
"svix-id": headers["svix-id"],
"svix-timestamp": headers["svix-timestamp"],
"svix-signature": headers["svix-signature"],
});
}
Persist or emit at minimum:
@rewritetoday/rest plus @rewritetoday/types or @rewritetoday/zodPOST /messages/batch only for bounded chunks/segments/:id/send public routemessage.batch as a summary event, not a replacement for per-message trackingmessage.batch event is emittedWhen using this skill, produce recommendations grouped by: content and deliverability risks, reliability and retry policy, webhook and event-processing safety, observability gaps, and rollout or scaling risks. Prefer concrete guardrails and tradeoffs over generic SMS advice.
tools
Production SMS delivery workflow for Rewrite. Use when the agent needs to send transactional or campaign SMS, manage Rewrite contacts or segments, implement batching, enforce idempotency, use templates and scheduling, and integrate the official Rewrite SDKs, REST client, CLI, or ecosystem packages.
development
Rewrite webhook ingestion workflow for your application. Use when the agent needs to configure Rewrite webhooks, verify signatures, parse and normalize event payloads, handle retries and dedupe, inspect delivery logs, and route delivery or OTP events safely.
development
Secure SMS agent workflow for building a text message chatbot, messaging agent, or SMS bot on Rewrite. Covers LLM-driven replies over application-owned inbound conversations with prompt-injection defense, action policy gates, risk-level escalation, and outbound send controls.
tools
Rewrite platform router for API, SDK, CLI, contacts, segments, webhooks, templates, and AI workflows. Use when the agent needs to send SMS, manage Rewrite contacts or segments, handle Rewrite webhook events, work with official Rewrite SDKs/packages, or build application-owned agent flows on top of Rewrite.