agentleFS
wittyreferencewittyreference/twilio-claude-plugin/skills/twilio-cli/SKILL.md

twilio-cli

Skill2 starsChanged 8 months agoMITView on GitHub

Twilio development skill: twilio-cli

  • Reads credentials

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When to use the Twilio CLI vs MCP tools vs Console vs SDK.

    line 15
  2. Very specific:

    When TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN are set as environment variables, the CLI auto-creates a virtual [env] profile that takes …

    line 110
  3. Very specific:

    After first deploy, .twiliodeployinfo caches the service SID.

    line 143
  4. Very specific:

    [env] profile takes precedence: If TWILIO_ACCOUNT_SID is set in environment, the CLI uses it regardless of profiles:use.

    line 157
  5. Very specific:

    -o json for machine-readable output: Always use -o json when parsing CLI output programmatically.

    line 177

≈ “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: twilio-cli description: Twilio CLI decision guide. Use when choosing between CLI, MCP tools, Console, or SDK for a Twilio operation — profiles, deployment, serverless toolkit, and CLI-only operations.

<!-- verified: twilio CLI 6.2.4, Node 22.22.1, live profile/serverless testing 2026-03-25 -->

Twilio CLI Decision Guide

When to use the Twilio CLI vs MCP tools vs Console vs SDK. Covers CLI-only operations, profile management, serverless deployment, and the operational boundaries between tooling layers.

Evidence date: 2026-03-25. CLI version: 6.2.4. Node: v22.22.1. Account prefix: AC...

This skill is a decision guide, not a command reference. For command syntax, see references/twilio-cli.md. For the full MCP vs CLI vs Functions boundary framework, see references/tool-boundaries.md.

Scope

CAN (CLI-Only Operations — No MCP Equivalent)

  • Profile management: profiles:create, profiles:list, profiles:use, profiles:remove — credential storage and multi-account switching <!-- verified: twilio profiles:list showed 4 profiles -->
  • Serverless deployment: serverless:deploy — deploy functions and assets to Twilio infrastructure <!-- verified: twilio serverless:list showed 2 services -->
  • Local development server: serverless:start --ngrok — local function execution with tunnel
  • Deployment promotion: serverless:promote — promote builds between environments
  • Deployment rollback: serverless:activate — activate a previous build
  • Serverless logging: serverless:logs --tail — live tail of deployed function logs
  • Environment variable management: serverless:env:set, serverless:env:import — set vars on deployed services
  • Plugin management: plugins:install, plugins:update, plugins:uninstall
  • Phone number purchase (interactive): phone-numbers:buy:local, phone-numbers:buy:toll-free — search + buy in one flow
  • Phone number release: api:core:incoming-phone-numbers:remove

CANNOT

  • Cannot be called from MCP tools — MCP never invokes CLI. This is an architectural boundary, not a limitation. See references/tool-boundaries.md. <!-- verified: tool-boundaries.md §Golden Rules -->
  • Cannot handle nested JSON parameters — CLI parameter parsing breaks on complex nested JSON (e.g., Voice Intelligence Channel param). Use curl for these. <!-- verified: references/twilio-cli.md §Troubleshooting -->
  • profiles:create crashes on Node 25.x — readline incompatibility. Users must manually create ~/.twilio-cli/config.json. <!-- verified: memory, MCP onboarding invariants -->
  • --profile flag on serverless:* commands is unreliable — Serverless commands may ignore --profile and use the active profile. Always profiles:use first. <!-- verified: operational experience -->
  • No twilio api:sync:* item-level operations — CLI has service/document CRUD but no list-item or map-item commands. Use MCP or SDK. <!-- verified: twilio-cli.md §Sync -->
  • Presence-based boolean flags — --voice-enabled is correct, --voice-enabled=true is NOT. Flags are presence-based, not key=value. <!-- verified: twilio-cli.md §Phone Number Search Filters -->

Quick Decision

NeedUseWhy
Query calls, messages, recordingsMCP toolsStructured JSON, agent-accessible
Send test SMS or make test callMCP toolsRate-limited, validated
Deploy serverless functionsCLI serverless:deployCLI-only operation
Switch Twilio accountCLI profiles:useCLI-only operation
Purchase phone numberCLI phone-numbers:buy:*Interactive confirmation, financial
Configure webhook URLsMCP configure_webhookAutomated, scriptable
Check debugger errorsMCP get_debugger_logs or validate_*SID-first principle
Manage Sync dataMCP toolsFull CRUD, structured responses
Manage TaskRouterMCP tools (30 tools)Full coverage
Local function developmentCLI serverless:startCLI-only operation
Rollback deploymentCLI serverless:activateCLI-only operation
View deployed function logsCLI serverless:logs --tailCLI-only live tail
One-off manual inspectionCLI api:* commandsHuman debugging
Complex nested JSON paramscurl (REST API directly)CLI can't handle nested JSON

Decision Framework

MCP vs CLI vs Console

CriterionMCP ToolsCLIConsole
Who uses itClaude/agentsDevelopers in terminalHumans in browser
Output formatStructured JSONTabular/textVisual UI
AutomationFullScriptableManual only
Auth model.env / CLI profile / env varsCLI profilesBrowser session
Best forData queries, sends, CRUDDeployment, profiles, purchasePay Connectors, visual config
Risk modelTier 1-3 guardrailsHuman judgmentHuman judgment

CLI-Only vs MCP-Available

OperationCLIMCPNotes
Profile managementprofiles:*—CLI-only
Serverless deploy/promote/rollbackserverless:*—CLI-only
Local dev serverserverless:start—CLI-only
Plugin managementplugins:*—CLI-only
Send SMSapi:core:messages:createsend_smsPrefer MCP
Make callapi:core:calls:createmake_callPrefer MCP
List phone numbersphone-numbers:listlist_phone_numbersPrefer MCP
Search numbersapi:core:available-phone-numbers:*search_available_numbersPrefer MCP
Purchase numberphone-numbers:buy:* or api:core:incoming-phone-numbers:createpurchase_phone_numberMCP available but CLI recommended (interactive)
Configure webhooksphone-numbers:updateconfigure_webhookPrefer MCP
Debugger logsdebugger:logs:listget_debugger_logsPrefer MCP (SID-first)
Sync operationsLimited api:sync:*Full CRUD (21 tools)Prefer MCP
TaskRouter operationsapi:taskrouter:*Full CRUD (30 tools)Prefer MCP
Proxy operations—17 tools (source only, not loaded)REST API via curl
Verify operationsapi:verify:*start_verification, check_verificationPrefer MCP

Console-Only Operations (No CLI or MCP)

OperationWhy Console-Only
Pay Connectors configurationNo REST API exists
Trust Hub / A2P 10DLC registrationComplex multi-step wizard
Flex UI configurationVisual layout editor
Studio Flow visual editorDrag-and-drop flow builder

Profile Management

The [env] Profile

When TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN are set as environment variables, the CLI auto-creates a virtual [env] profile that takes precedence over stored profiles. This is the default in this project (.env file loaded by direnv).

Multi-Account Safety

Always verify the active profile before deploying. Multi-account setups are common and deploying to the wrong account is hard to detect.

# Check which account is active
twilio profiles:list

# Switch to the correct account
twilio profiles:use my-project

# Verify with an API call
twilio api:core:accounts:fetch

Profile Storage

Profiles are stored in ~/.twilio-cli/config.json. The MCP server's credential resolver reads this file as a fallback: process.env → .env → CLI profile.

Serverless Deployment

Key Files

FilePurposeGotcha
.twilioserverlessrcService name, folders, env pathMust exist for deploy
.twiliodeployinfoCached {accountSid:region → serviceSid}Stale cache causes 20404 on deploy
.envLocal environment variablesDeployed separately via serverless:env:import

The .twiliodeployinfo Trap

After first deploy, .twiliodeployinfo caches the service SID. If the service is deleted but the cache isn't cleared, subsequent deploys fail with error 20404. Fix: echo '{}' > .twiliodeployinfo.

Deploy vs Promote

MethodUse WhenWhat Happens
serverless:deployNew code changesBuilds + deploys to target environment
serverless:promotePromote existing buildCopies build from source to target env (no rebuild)
serverless:activateRollbackActivates a previous build SID

Gotchas

Profiles & Auth

  1. [env] profile takes precedence: If TWILIO_ACCOUNT_SID is set in environment, the CLI uses it regardless of profiles:use. Unset env vars to use stored profiles. [Evidence: profiles:list showed [env] as active]
  2. profiles:create crashes on Node 25.x: readline incompatibility. Workaround: manually create ~/.twilio-cli/config.json. [Evidence: memory, MCP onboarding invariants]
  3. Verify profile before every deploy: twilio profiles:list — the active account may not be what you expect, especially with [env] overriding stored profiles.

Deployment

  1. .twiliodeployinfo stale cache: Deleting a service without clearing this cache causes 20404 on next deploy. Fix: echo '{}' > .twiliodeployinfo. [Evidence: references/twilio-cli.md §Troubleshooting]
  2. --override-existing-project is destructive: Overwrites the entire service. All functions and assets are replaced, not merged. Previous URLs may break if functions were renamed or removed.
  3. punycode deprecation warning on Node 22+: Cosmetic warning [DEP0040] on every CLI command. Harmless but noisy. [Evidence: serverless:list output]
  4. --production flag affects domain name: serverless:deploy --production changes the URL format. Without it, URLs include the environment name as a subdomain.

Command Syntax

  1. Boolean flags are presence-based: --voice-enabled (correct), NOT --voice-enabled=true (wrong). This applies to all boolean flags on search/buy commands. [Evidence: twilio-cli.md §Phone Number Search Filters]
  2. -o json for machine-readable output: Always use -o json when parsing CLI output programmatically. Default columnar output is for human readability only.
  3. CLI can't handle nested JSON: Operations requiring complex nested JSON parameters (like Voice Intelligence transcript creation with Channel) must use curl with the REST API directly. [Evidence: twilio-cli.md §Voice Intelligence]

MCP vs CLI Confusion

  1. Never use twilio api:* when MCP tool exists: The CLAUDE.md MCP-first rule. CLI api:* commands are for human debugging only. MCP tools provide structured JSON, rate limiting, and agent accessibility. [Evidence: CLAUDE.md §MCP Server & Tool Discovery]
  2. CLI is only for profiles:*, serverless:*, plugins:*: These three command families have no MCP equivalent. Everything else has an MCP tool and should use it.

SID Reference (CLI Output)

PrefixResourceCLI Command
ZSServerless Serviceserverless:list
ZEServerless Environmentserverless:list environments
ZBServerless Buildserverless:list builds
ZHServerless Functionserverless:list functions
NODebugger Alertdebugger:logs:list

Related Resources

  • CLI command reference (references/twilio-cli.md) — Full command syntax, flags, examples (1012 lines)
  • Tool boundaries (references/tool-boundaries.md) — MCP vs CLI vs Functions decision framework, risk tiers, anti-patterns
  • Phone numbers skill (skills/phone-numbers/SKILL.md) — Number search, purchase, webhook configuration
  • CLAUDE.md (/CLAUDE.md) — MCP-first rule, deployment verification
  • Operational gotchas (references/operational-gotchas.md) — Cross-cutting deployment and testing issues

Reference Files

TopicFileWhen to read
CLI-only command syntaxreferences/command-reference.mdNeed exact CLI syntax for profiles, deploy, promote, rollback, plugins
Full CLI reference (1000+ lines)references/twilio-cli.mdNeed CLI syntax for API commands (messages, calls, conferences, recordings)
Assertion auditreferences/assertion-audit.mdAdversarial audit of every factual claim

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.