agentleFS
wittyreferencewittyreference/twilio-claude-plugin/skills/phone-numbers/SKILL.md

phone-numbers

Skill2 starsChanged 8 months agoMITView on GitHub

Twilio development skill: phone-numbers

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Search, purchase, configure, and release phone numbers.

    line 15
  2. Distinctive:

    Search available numbers by country, area code, pattern, and capabilities

    line 23
  3. Distinctive:

    Search with vanity letter patterns (e.g., "TEST" maps to digits)

    line 30
  4. Distinctive:

    Update friendlyName on owned numbers (max 64 chars)

    line 32
  5. Distinctive:

    Invalid webhook URL returns specific error 21402: Not a generic 400 — the error code 21402 specifically identifies "VoiceUrl is not valid".

    line 163
  6. Very specific:

    Purchased numbers start as in-use immediately: No provisioning delay — status: "in-use" on the create response.

    line 173

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

name: phone-numbers description: Twilio phone number management guide. Use when searching, purchasing, configuring webhooks, releasing numbers, or debugging number-related issues.

<!-- verified: twilio.com/docs/phone-numbers/api/incomingphonenumber-resource, twilio.com/docs/phone-numbers/api/availablephonenumber-resource, twilio.com/docs/phone-numbers/api/availablephonenumberlocal-resource + live testing 2026-03-25 -->

Twilio Phone Numbers

Search, purchase, configure, and release phone numbers. Covers number types, search filters, webhook configuration, capabilities, address requirements, and the purchase/release lifecycle.

Evidence date: 2026-03-25. Account prefix: AC...

Scope

CAN

  • Search available numbers by country, area code, pattern, and capabilities
  • Purchase local and toll-free numbers via API
  • Configure voice/SMS webhook URLs, fallback URLs, and status callbacks
  • Set voiceApplicationSid or smsApplicationSid to route to TwiML Apps
  • Filter owned numbers by phone number or friendlyName
  • Geographic proximity search (nearNumber, nearLatLong, distance) — US/Canada only
  • Filter by address requirements (exclude numbers needing address verification)
  • Search with vanity letter patterns (e.g., "TEST" maps to digits)
  • Release (delete) numbers, returning them to the pool
  • Update friendlyName on owned numbers (max 64 chars)
  • Lookup carrier/line-type via mcp__twilio__lookup_phone_number
  • Clear webhook URLs by setting to empty string

CANNOT

<!-- verified: all CANNOT items live-tested 2026-03-25 unless noted -->
  • No mobile number type in the US — availablePhoneNumbers('US').mobile.list() returns 404. US numbers are classified as local or toll-free only. Mobile is available in other countries (e.g., GB). <!-- verified: 20404 on US/Mobile.json -->
  • Cannot use both voiceApplicationSid and voiceUrl — Setting voiceApplicationSid causes voiceUrl to be ignored. Setting one auto-clears the other. Same applies to smsApplicationSid vs smsUrl. <!-- verified: twilio.com/docs/phone-numbers/api/incomingphonenumber-resource -->
  • Cannot use voiceApplicationSid and trunkSid simultaneously — Setting one auto-deletes the other. <!-- verified: twilio.com/docs/phone-numbers/api/incomingphonenumber-resource -->
  • contains pattern requires minimum 2 characters — Single-character patterns (e.g., "5") return 400 "Invalid Pattern Provided". Wildcards * mid-pattern also fail — the pattern is matched as a substring, not a glob. <!-- verified: "5" → 400; "206*55*" → 400; "55" → OK -->
  • Geographic search is US/Canada only — nearNumber, nearLatLong, inPostalCode, inRegion, inRateCenter, inLata parameters are ignored or error for non-US/CA countries. <!-- verified: twilio.com/docs/phone-numbers/api/availablephonenumberlocal-resource -->
  • areaCode filter is US/Canada only — Does not apply to international numbers. <!-- verified: twilio.com/docs docs -->
  • No undo for release — Once released, the number goes back to the pool. Another customer may purchase it immediately. There is no grace period or reclaim mechanism.
  • Address required for many international numbers — addressRequirements can be none, any, local, or foreign. UK local numbers require a local address (addressRequirements: "local"). Purchase will fail without the required address/bundle. <!-- verified: GB search returned addressRequirements="local" -->
  • Purchasing not exposed as a serverless function — Intentionally excluded from `` due to cost implications. Use MCP tools, CLI, or Console instead. <!-- verified: CLAUDE.md -->

Quick Decision

NeedUseWhy
Find available numbersmcp__twilio__search_available_numbersFilters by country, area code, capabilities
List owned numbersmcp__twilio__list_phone_numbersShows SIDs, capabilities, webhook URLs
Set webhook URLsmcp__twilio__configure_webhookUpdates voice/SMS URLs by PN SID
Buy a numbermcp__twilio__purchase_phone_numberRequires E.164 number from search
Release a numbermcp__twilio__release_phone_numberIrreversible — number returns to pool
Check carrier/typemcp__twilio__lookup_phone_numberCarrier name, line type (mobile/landline/voip)
Buy via CLItwilio api:core:incoming-phone-numbers:create --phone-number "+1..."Alternative to MCP for purchase

Decision Frameworks

Number Type Selection

TypeAvailable InUse CaseCost Tier
LocalMost countriesGeographic presence, local caller IDStandard
Toll-FreeUS, CA, GB, AU + othersCustomer support, inbound-heavyHigher monthly
MobileNon-US countries (GB, DE, etc.)SMS-heavy, internationalVaries by country

Search Strategy

GoalApproachParameters
Specific area codeSearch local with areaCodeareaCode: 206 (US/CA only)
Vanity numberSearch with letter patterncontains: 'TEST' (maps to 8378)
Near existing numberGeographic proximitynearNumber: '+15551234567', distance: 10
SMS-capable onlyCapability filtersmsEnabled: true
No address hassleExclude address-requiredexcludeAllAddressRequired: true
InternationalSpecify country codecountryCode: 'GB', check addressRequirements

Webhook Configuration

SettingWhen to Use
voiceUrlDirect TwiML webhook for incoming calls
voiceApplicationSidRoute to a TwiML App (overrides voiceUrl)
smsUrlDirect webhook for incoming SMS
smsApplicationSidRoute SMS to a TwiML App (overrides smsUrl)
statusCallbackReceive call status events (initiated, ringing, answered, completed)
voiceFallbackUrlBackup URL if voiceUrl fails
trunkSidRoute to SIP trunk (mutually exclusive with voiceApplicationSid)

Integration Patterns

Search and Purchase Flow

// Step 1: Search for available numbers
const available = await client.availablePhoneNumbers('US')
  .local.list({ areaCode: 206, smsEnabled: true, voiceEnabled: true, limit: 5 });

// Step 2: Purchase the first match
const purchased = await client.incomingPhoneNumbers.create({
  phoneNumber: available[0].phoneNumber,
  friendlyName: 'My App Line',
  voiceUrl: 'https://myapp.com/voice',
  smsUrl: 'https://myapp.com/sms'
});
// purchased.sid = 'PN...'
// purchased.status = 'in-use'

Configure Webhooks on Existing Number

const updated = await client.incomingPhoneNumbers(phoneNumberSid).update({
  voiceUrl: 'https://myapp.com/voice',
  smsUrl: 'https://myapp.com/sms',
  statusCallback: 'https://myapp.com/status'
});

Clear Webhook URLs

// Set to empty string to clear
await client.incomingPhoneNumbers(phoneNumberSid).update({
  voiceUrl: '',
  smsUrl: ''
});

Filter Owned Numbers

// By phone number (exact match, E.164)
const byNumber = await client.incomingPhoneNumbers.list({
  phoneNumber: '+15551234567'
});

// By friendly name
const byName = await client.incomingPhoneNumbers.list({
  friendlyName: 'My App Line'
});

Gotchas

Search

  1. Capabilities keys have inconsistent casing: Available numbers return MMS and SMS (uppercase) while owned numbers return mms and sms (lowercase). voice and fax are lowercase in both. Normalize case before comparing. [Evidence: available caps keys MMS/SMS/fax/voice vs owned fax/mms/sms/voice]
  2. contains pattern does not support wildcards: Despite docs mentioning * metacharacter, mid-pattern wildcards like 206*55* return 400 "Invalid Pattern Provided". Only simple substrings work (e.g., "55", "TEST"). Minimum 2 characters. [Evidence: "20655" → 400; "55" → OK; "5" → 400]
  3. US has no mobile number type: availablePhoneNumbers('US').mobile.list() returns 404. US numbers are local or toll-free only. Use smsEnabled: true to find SMS-capable local numbers instead. [Evidence: 20404 on US/Mobile.json]
  4. International numbers may require address verification: UK local numbers require addressRequirements: "local". Purchase fails without the required regulatory bundle and address. Check addressRequirements in search results before attempting purchase. [Evidence: GB search returned addressRequirements="local"]

Configuration

  1. Invalid webhook URL returns specific error 21402: Not a generic 400 — the error code 21402 specifically identifies "VoiceUrl is not valid". Useful for distinguishing URL validation errors from other configuration issues. [Evidence: "not-a-url" → error 21402]
  2. voiceApplicationSid and voiceUrl are mutually exclusive: Setting voiceApplicationSid causes Twilio to ignore voiceUrl. Setting voiceUrl after voiceApplicationSid clears the application. Same for SMS counterparts. [Evidence: Twilio docs confirm; voiceApplicationSid validation tested — non-existent AP SID returns 400]
  3. voiceApplicationSid and trunkSid are mutually exclusive: Setting one auto-deletes the other. A number can route to a TwiML App OR a SIP trunk, not both. [Evidence: Twilio docs]

Lifecycle

  1. Release is irreversible and immediate: remove() returns true and the number is gone. Fetch after release returns 404. No grace period, no undo. Another customer can purchase it within seconds. [Evidence: PNa869b36b released, immediate 404 on fetch]
  2. Purchased numbers start as in-use immediately: No provisioning delay — status: "in-use" on the create response. Webhooks are active from the moment of purchase if configured. [Evidence: PNa869b36b status=in-use on create]
  3. SID format is PN-prefixed: Phone number SIDs start with PN followed by 32 hex characters. Do not confuse with phone numbers in E.164 format. List and filter endpoints accept both SIDs and phone numbers as identifiers. [Evidence: PNfd5828a6... format confirmed]

Pricing

  1. Toll-free numbers have higher monthly fees than local: Toll-free numbers typically cost more per month. Search results do not include pricing — check Console or Pricing API for current rates before purchasing. [Evidence: Twilio pricing docs]

Error Code Reference

CodeMeaningTrigger
400Invalid Pattern Providedcontains pattern too short or uses unsupported wildcards
20404Resource not foundNon-existent PN SID, or US/Mobile search
21402VoiceUrl is not validInvalid URL format in webhook configuration
21452Phone number not availableNumber already purchased or no longer in pool

Reference Files

TopicFileWhen to read
Assertion auditreferences/assertion-audit.mdVerifying claim provenance, reviewing evidence chain

Related Resources

  • Domain docs: CLAUDE.md (function inventory, search params, manage actions)
  • Codebase functions: search-numbers.protected.js, manage-number.protected.js
  • MCP tools: mcp__twilio__search_available_numbers, mcp__twilio__list_phone_numbers, mcp__twilio__configure_webhook, mcp__twilio__purchase_phone_number, mcp__twilio__release_phone_number, mcp__twilio__lookup_phone_number
  • Related skills: /skills/lookup/SKILL.md (phone number intelligence — line type, carrier, fraud detection, identity match), /skills/proxy/SKILL.md (number pools for masking), /skills/verify/SKILL.md (phone verification), /skills/compliance-regulatory.md (regulatory bundles, address requirements), /skills/branded-calling/SKILL.md (branded caller ID, SHAKEN/STIR, Voice Integrity, CNAM)
  • Twilio docs: IncomingPhoneNumber API, AvailablePhoneNumber API, Pricing

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.