A Claude Code plugin that brings Twilio CPaaS expertise to any project. Provides specialized agents, commands, and skills for building voice, messaging, and real-time communication applications with Twilio.
The plugin requires these tools to be installed:
| Requirement | Version | Purpose |
|---|---|---|
| Twilio Account | — | Sign up free — need Account SID + Auth Token |
| Node.js | 20+ | Runtime for Twilio Functions |
| npm | (bundled with Node) | Package management |
| jq | Latest | JSON processing (required by safety hooks) |
| Twilio CLI | Latest | Deploy, manage numbers, debug |
| Serverless Plugin | Latest | twilio serverless:start and serverless:deploy |
| Claude Code | Latest | AI development environment |
Quick install: Run the dependency installer to check and install everything:
# Clone the plugin first, then run the installer
git clone https://github.com/wittyreference/twilio-claude-plugin.git
./twilio-claude-plugin/scripts/install-deps.shThe script is idempotent — it skips anything already installed and never upgrades existing tools.
Install directly from GitHub:
claude plugin add github:wittyreference/twilio-claude-pluginOr clone and install locally:
git clone https://github.com/wittyreference/twilio-claude-plugin.git
claude plugin add ./twilio-claude-plugin# 1. Install the plugin
claude plugin add github:wittyreference/twilio-claude-plugin
# 2. Create .env in your project root
cat > .env << 'EOF'
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_PHONE_NUMBER=+1234567890
EOF
# 3. Start Claude Code and verify setup
claude
# Then run: /preflightOnce verified, try prompts like:
- "Send a test SMS to +15551234567"
- "Build a voice IVR that routes callers to sales or support"
- "Add phone verification to the signup flow using Twilio Verify"
Run /help-twilio to discover all available skills and capabilities.
Some commands require specific Claude Code permissions:
| Command | Required Permission | Why |
|---|---|---|
/twilio-docs |
WebSearch, WebFetch |
Searches live Twilio documentation |
/twilio-logs |
Bash |
Runs twilio debugger:logs:list CLI command |
If you encounter "auto-denied in dontAsk mode" errors, grant permissions via:
/permissionsOr add to your ~/.claude/settings.json:
{
"permissions": {
"allow": ["WebSearch", "WebFetch", "Bash"]
}
}The plugin includes an MCP server that gives Claude direct access to 310 Twilio API tools — messaging, voice, conferences, recordings, TaskRouter, Sync, payments, phone numbers, Studio flows, and more. Tools are automatically available when the plugin is enabled and environment variables are set.
Capabilities include:
- Send SMS/MMS, manage messaging services, content templates
- Make and manage calls, conferences, recordings, media streams
- TaskRouter: create tasks, list workers, check queue statistics
- Sync: create/read/update documents, lists, maps
- Phone numbers: search, purchase, configure webhooks
- Verify: send and check OTP codes
- Studio: trigger flows, inspect executions
- Voice Intelligence: transcriptions, operator analysis
- And many more (video rooms, proxy, SIP trunking, regulatory bundles, etc.)
Example prompts:
- "Send a test SMS to +15551234567"
- "List my TaskRouter workers"
- "Check queue statistics for my support queue"
- "Search for available phone numbers in area code 415"
The MCP server requires TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, and TWILIO_PHONE_NUMBER at minimum. See Environment Variables for the full list.
These commands can be run directly in your Claude Code session:
| Command | Description | Permissions |
|---|---|---|
/deploy [env] |
Deploy to Twilio Serverless with pre/post validation | Bash |
/test [scope] |
Run tests with coverage requirements | Bash |
/twilio-docs [topic] |
Search Twilio documentation | WebSearch |
/twilio-logs |
Fetch and analyze Twilio debugger logs | Bash |
/preflight |
Verify CLI profile, env vars, and auth before starting work | Bash |
/commit [scope] |
Stage and commit with pre-commit validation | Bash |
/push |
Push to remote with test verification | Bash |
/context [action] |
Context optimization — summarize, load, or analyze | — |
/validate [type] [SID] |
Deep validation of Twilio resources beyond HTTP 200 | — |
/wrap-up [scope] |
End-of-session review — capture learnings, update docs | — |
/learn [action] |
Interactive learning exercises on autonomous work (generation effect) | — |
/check-updates |
Check for newer plugin versions on GitHub | — |
Claude automatically selects these specialized agents based on your task:
| Agent | Specialty |
|---|---|
| Architect | System design, pattern selection, architecture decisions |
| Spec | Technical specification writing |
| Test-Gen | TDD Red Phase - writes failing tests first |
| Dev | TDD Green Phase - implements code to pass tests |
| Review | Code review with approval authority |
| Docs | Technical documentation updates |
| Orchestrate | Coordinates multi-agent development workflows |
The plugin loads domain knowledge automatically when relevant:
Twilio APIs:
voice- TwiML Voice verbs, webhooks, call handlingmessaging- SMS/MMS handling, status callbacksverify- OTP verification, 2FA flowssync- Real-time state with Documents, Lists, Mapstaskrouter- Skills-based routing to workersconversation-relay- ConversationRelay for real-time voice AI with WebSocketmessaging-services- Sender pools, A2P 10DLC compliancepay- PCI-compliant payments with<Pay>verbproxy- Number masking and anonymous communicationphone-numbers- Phone number management and configurationsip-byoc- SIP trunking and Bring Your Own Carrierpayments- Payment processing patterns and flowscompliance-regulatory- Regulatory bundles and compliance
Reference:
twilio-cli- Comprehensive CLI command referencetwilio-invariants- Proven gotchas that cause silent failures (credential formats, protocol fields, deployment traps)voice-use-case-map- Definitive product mapping for 10 voice use cases (notifications through AI transcription)deep-validation- Validation patterns beyond HTTP 200 (status polling, debugger checks, Voice Insights)tdd-workflow- TDD Red/Green/Refactor patterns for Twilio projectsbrainstorm- Ideation template for Twilio app concepts with validation mappingtool-boundaries- Golden Rules and Risk Tiers for MCP vs CLI vs Functions decisionsoperational-gotchas- Hard-won debugging insights across testing, deployment, voice routing, auth, and MCPworkflows- Development pipeline patterns (new-feature, bug-fix, refactor, security-audit)
Context Engineering:
context-engineering- Unified context management: compression ratios, budgets, loading strategiesmemory-systems- State tracking across sessionsmulti-agent-patterns- Orchestration patterns
Additional:
agent-testing- Agent-to-agent testing patterns for ConversationRelaygetting-started- Quick-start guide for new Twilio projectscontext-hub- External API reference loaderenv-doctor- Environment conflict detection and resolutionvideo- Video rooms, recordings, and compositionsvideo-patterns- Video application patterns and best practices
Automated guardrails that run during development:
| Hook | Trigger | Purpose |
|---|---|---|
pre-write-validate.sh |
Before Write/Edit | Blocks hardcoded credentials, magic test numbers in non-test files, non-evergreen naming |
pre-bash-validate.sh |
Before Bash | Blocks --no-verify, validates deploys, coverage warnings |
post-write.sh |
After Write/Edit | Auto-lints JavaScript files |
post-bash.sh |
After Bash | Deployment notifications |
subagent-log.sh |
After Subagent | Logs workflow activity |
session-checklist.sh |
On Stop | Warns about uncommitted changes and unpushed commits |
session-start.sh |
On session start | Environment checks, stale session detection |
subagent-log.sh |
After Subagent | Logs subagent workflow activity |
notify-ready.sh |
On Stop | Desktop notification when done |
⚠️ Known Limitation: Due to a Claude Code bug, plugin hooks may not execute automatically. To enable hooks, copy the configuration to your user settings:
Manual Hook Installation
First, find your plugin cache path:
# The version directory changes with each plugin update
ls ~/.claude/plugins/cache/twilio-claude-plugin/twilio-claude-plugin/Then add to ~/.claude/settings.json (replace VERSION with the version from above):
{
"hooks": {
"PreToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "~/.claude/plugins/cache/twilio-claude-plugin/twilio-claude-plugin/VERSION/hooks/pre-write-validate.sh"
}
]
},
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "~/.claude/plugins/cache/twilio-claude-plugin/twilio-claude-plugin/VERSION/hooks/pre-bash-validate.sh"
}
]
}
]
}
}After adding, restart Claude Code with Shift+Cmd+R (macOS) or Shift+Ctrl+R (Linux).
This plugin enforces Test-Driven Development:
- Red Phase (
test-gen): Write failing tests first - Green Phase (
dev): Implement minimal code to pass - Refactor: Improve while keeping tests green
The dev agent verifies failing tests exist before implementing.
your-project/
├── functions/ # Twilio serverless functions
│ ├── voice/ # Voice call handlers
│ ├── messaging/ # SMS/MMS handlers
│ └── helpers/ # Private shared utilities
├── assets/ # Static assets
├── __tests__/ # Test files
│ ├── unit/
│ ├── integration/
│ └── e2e/
├── .env # Environment variables (never commit!)
└── package.json
Your project should define these in .env:
Required (for MCP tools and CLI operations):
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_PHONE_NUMBER=+1234567890Optional (for specific features):
# API keys (for CLI operations)
TWILIO_API_KEY=SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_API_SECRET=your_api_secret
# MCP tool features
TWILIO_VERIFY_SERVICE_SID=VAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # Verify OTP tools
TWILIO_SYNC_SERVICE_SID=ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # Sync Documents/Lists/Maps
TWILIO_TASKROUTER_WORKSPACE_SID=WSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # TaskRouter tools
TWILIO_MESSAGING_SERVICE_SID=MGxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # Messaging Services tools
TEST_PHONE_NUMBER=+1234567890 # Recipient for test messages/callsThe MCP server resolves credentials in this order (highest priority first):
- Shell environment — Variables from
.zshrc,.bashrc, orexportstatements - direnv —
.envrcfile ifdirenvis configured .envfile — Loaded by the MCP server at startup- Twilio CLI profile — From
twilio login(CLI commands only, not MCP tools)
If you already have
TWILIO_*env vars in your shell (from.zshrc, another project, or Twilio CLI), they will silently override your.envvalues and cause auth failures. The Twilio SDK also auto-readsTWILIO_REGIONandTWILIO_EDGE, which can silently route API calls to the wrong region.
Diagnose conflicts:
# Run the environment doctor (included with this plugin)
./scripts/env-doctor.shPrevent conflicts with direnv:
The plugin ships an .envrc template that unsets all inherited Twilio vars before loading your .env:
# Copy the template to your project root
cp scripts/envrc.template .envrc
# Install direnv and allow
brew install direnv
echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc
direnv allowFor guided provisioning of Twilio resources (phone numbers, Verify service, Sync service, TaskRouter workspace, Messaging Service):
node scripts/setup.jsThe script walks you through each resource, creates what's needed, and updates your .env automatically.
Build a voice IVR:
I need a voice IVR that greets callers and routes them to sales or support
Add SMS verification:
Add phone verification to the signup flow using Twilio Verify
Debug webhook issues:
/twilio-logs
Deploy to production:
/deploy prod
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests:
npm test - Submit a pull request
MIT