Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

sms-test-author

БесплатноБез исполняемых скриптовНе проверен

Use for any question or task about testing SMS sending, including one Twilio sender and runs that must not text real phones: Twilio magic numbers and test…

testlandот testland★ 18 звёзд на GitHub

Об этом скилле

sms-test-author

Overview

Twilio is the dominant SMS provider for B2B SaaS; this skill targets Twilio test patterns. The principles transfer to other providers (Vonage, MessageBird, Plivo) with provider-specific sandbox patterns.

The core challenge: SMS sends cost money + actually deliver to real phones. Test patterns avoid both via:

  1. Test Credentials - separate accountSid + authToken for testing; calls succeed/fail per the test pattern but never actually deliver
  2. Magic Numbers - special phone numbers in the +15005550000 - +15005550009 range with documented behavior

When to use

  • The repo sends SMS via Twilio (transactional: 2FA codes, order status, alerts).
  • Tests need to verify SMS-send code paths without real cost or delivery.
  • The team wants regression coverage on segment-counting (long messages → multiple SMS).
  • Compliance review requires evidence of opt-out (STOP) handling.

Step 1 - Twilio Test Credentials setup

Per twilio.com/docs/iam/test-credentials, every Twilio account has two credential pairs:

Credential Purpose
Live (AccountSID, AuthToken) Real sends; cost money; deliver to real phones
Test (AccountSID, AuthToken) Test sends; never deliver; respond per Magic-Number pattern

In CI, set the SDK to use Test Credentials:

from twilio.rest import Client

client = Client(
    os.environ["TWILIO_TEST_ACCOUNT_SID"],
    os.environ["TWILIO_TEST_AUTH_TOKEN"],
)

Step 2 - Magic Numbers reference

Per twilio.com/docs/iam/test-credentials#magic-phone-numbers, the canonical test numbers (current, verify against live docs):

Number Behavior
+15005550006 Valid recipient; SMS send succeeds
+15005550001 Invalid number; returns 400
+15005550002 Cannot route to number; returns 400
+15005550003 International restriction (when sending from US-only number); returns 400
+15005550004 Number is blacklisted; returns 400
+15005550009 Sender number cannot send SMS; returns 400

For sender numbers, similar magic numbers exist (e.g., +15005550000 is "not owned by your account").

Step 3 - Test the happy path

def test_send_2fa_code_to_valid_number():
    client = twilio_test_client()
    message = client.messages.create(
        from_="+15005550006",   # valid sender
        to="+15005550006",       # valid recipient
        body="Your code is: 123456",
    )
    assert message.sid is not None
    assert message.status in ["queued", "sent"]

Note: Test Credentials don't support messaging_service_sid sends - use direct from_ numbers only in test mode.

Step 4 - Test invalid recipients

def test_invalid_number_raises():
    client = twilio_test_client()
    with pytest.raises(twilio.base.exceptions.TwilioRestException) as exc:
        client.messages.create(
            from_="+15005550006",
            to="+15005550001",       # invalid
            body="test",
        )
    assert exc.value.status == 400

Step 5 - Segment-counting tests

SMS messages over 160 characters split into multiple segments. Encoding affects the per-segment limit:

Encoding Per-segment chars Per-segment with concatenation header
GSM-7 160 153
UCS-2 (Unicode) 70 67

Including a single emoji or non-GSM character forces UCS-2, quartering the per-segment capacity.

def test_message_segments_correctly():
    # 160-char ASCII message → 1 segment
    msg = "x" * 160
    assert calculate_segments(msg) == 1

    # 161-char ASCII → 2 segments (first segment now 153)
    msg = "x" * 161
    assert calculate_segments(msg) == 2

    # ASCII + 1 emoji → UCS-2; 70-char limit
    msg = "x" * 70 + "🎉"
    assert calculate_segments(msg) == 2   # one emoji forces multi-segment

For calculate_segments, libraries exist per language (e.g., split-sms for Node, smssegment for Python). Validate against Twilio's actual segment count via the API after a send (Twilio returns num_segments on the message resource).

Step 6 - Rate-limit testing

Twilio enforces per-account + per-sender rate limits. Tests shouldn't hit them in normal use, but for resilience:

def test_rate_limit_handling(client):
    # Configure app for low-rate scenario
    sender = mock_rate_limited_response()
    response = my_app.send_sms(to="+15005550006", body="test")
    # Verify retry-with-backoff or graceful queue:
    assert response.status == "queued_for_retry"

Mock the Twilio response (HTTP 429) at the SDK boundary to test without hitting actual rate limits.

Step 7 - Opt-out keyword handling

US carriers (and CTIA guidelines) require handling of these inbound keywords:

Keyword Required action
STOP, STOPALL, UNSUBSCRIBE, CANCEL, END, QUIT Stop sending; reply confirmation
HELP, INFO Reply with help text + opt-out instructions
START, YES, UNSTOP Resume sending after a previous STOP
Полный SKILL.md на GitHub

Установить sms-test-author в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

.tessl-plugin/plugin.json

FAQ

Что делает скилл sms-test-author?

Use for any question or task about testing SMS sending, including one Twilio sender and runs that must not text real phones: Twilio magic numbers and test credentials, GSM-7 vs UCS-2 segment counts (emoji messages that cost more), rate limits, STOP and HELP opt-out keywords, and sender ID vs short code vs 10DLC differences.

Как установить скилл sms-test-author?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл sms-test-author запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить sms-test-author с