agentleFS
wittyreferencewittyreference/twilio-claude-plugin/skills/getting-started/SKILL.md

getting-started

Skill2 starsChanged 8 months agoMITView on GitHub

Set up a new Twilio serverless project from scratch. Use when starting a new project, scaffolding directory structure, or configuring deployment.

  • Reads credentials
  • Installs packages

22 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 22 edited versions we read keep these.

  • 1

    Distinctive

    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:

    Before deploying, check you're targeting the right account:

    line 111
  2. Very specific:

    Add recordings: Use <Start><Recording> in TwiML (see voice skill)

    line 146
  3. Very specific:

    Add IVR: Use <Gather> for speech/DTMF input (see voice skill)

    line 147
  4. Very specific:

    Add AI agent: Use <Connect><ConversationRelay> (see conversation-relay skill)

    line 148
  5. Very specific:

    Add routing: Use TaskRouter for skills-based routing (see taskrouter skill)

    line 149

“Common” is measured: kept by at least 6 in 10 of the 22 edited versions of this file we could read. “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

Getting Started with Twilio Serverless

Guide for scaffolding a new Twilio serverless project from an empty directory to first deploy.

Prerequisites

  • Node.js 18+
  • Twilio account with Account SID and Auth Token
  • Twilio CLI: npm install -g twilio-cli
  • Serverless plugin: twilio plugins:install @twilio-labs/plugin-serverless

Project Setup

1. Initialize

mkdir my-twilio-project && cd my-twilio-project
npm init -y
npm install twilio @twilio-labs/serverless-runtime-types

2. Create Directory Structure

my-twilio-project/
├── functions/          # Serverless functions (auto-routed as endpoints)
│   └── hello.js        # → /hello endpoint
├── assets/             # Static files (HTML, audio, images)
├── .env                # Environment variables (never commit)
├── .twiliodeployinfo   # Deploy state (auto-generated, gitignore)
└── package.json

3. Create .env

# Required for deployment (twilio-run reads these WITHOUT the TWILIO_ prefix)
ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
AUTH_TOKEN=your-auth-token

# Also set prefixed versions for your function code
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your-auth-token
TWILIO_PHONE_NUMBER=+1xxxxxxxxxx

Important: twilio-run (the serverless runtime) reads ACCOUNT_SID and AUTH_TOKEN without the TWILIO_ prefix. If you only have TWILIO_ACCOUNT_SID, deployment fails with "Missing Credentials". Add both versions.

4. Create First Function

// functions/hello.js
// ABOUTME: Simple hello world endpoint for testing deployment
// ABOUTME: Returns JSON greeting — verifies serverless runtime is working

exports.handler = function (context, event, callback) {
  const twiml = new Twilio.twiml.VoiceResponse();
  twiml.say({ voice: 'Google.en-US-Neural2-F' }, 'Hello from Twilio!');
  callback(null, twiml);
};

5. Add Scripts to package.json

{
  "scripts": {
    "start": "twilio serverless:start --live",
    "start:ngrok": "twilio serverless:start --ngrok --live --detailed-logs",
    "deploy:dev": "twilio serverless:deploy --runtime node22",
    "deploy:prod": "twilio serverless:deploy --production --runtime node22"
  }
}

6. Create .gitignore

node_modules/
.env
.twiliodeployinfo

Local Development

# Start local server (port 3000)
npm start

# Start with ngrok tunnel (required for webhooks)
npm run start:ngrok

The local server auto-reloads on file changes with --live.

First Deploy

npm run deploy:dev

This creates a service on your-project-XXXX-dev.twil.io. The output shows your function URLs.

Verify CLI Profile

Before deploying, check you're targeting the right account:

twilio profiles:list

The active profile (marked with *) determines which account gets the deployment.

Function Access Levels

SuffixAccessUse Case
*.jsPublicWebhooks, TwiML endpoints
*.protected.jsProtectedCallbacks (requires valid Twilio signature)
*.private.jsPrivateHelpers (only callable from other functions)

Environment Variables in Functions

Access .env values via context:

exports.handler = function (context, event, callback) {
  const phoneNumber = context.TWILIO_PHONE_NUMBER;
  const client = context.getTwilioClient();
  // ...
};

context.getTwilioClient() returns an authenticated Twilio REST client using the account credentials.

Common Next Steps

After first deploy:

  1. Configure webhooks: Point your Twilio phone number's voice/SMS URL to your deployed function
  2. Add recordings: Use <Start><Recording> in TwiML (see voice skill)
  3. Add IVR: Use <Gather> for speech/DTMF input (see voice skill)
  4. Add AI agent: Use <Connect><ConversationRelay> (see conversation-relay skill)
  5. Add routing: Use TaskRouter for skills-based routing (see taskrouter skill)

Troubleshooting

ProblemCauseFix
"Missing Credentials" on deploy.env has TWILIO_ACCOUNT_SID but not ACCOUNT_SIDAdd unprefixed ACCOUNT_SID and AUTH_TOKEN
Deploy goes to wrong accountCLI profile mismatchRun twilio profiles:list, switch with twilio profiles:use <name>
Function returns 403.protected.js requires Twilio signatureUse .js for public endpoints or call from Twilio
.twiliodeployinfo conflictsDeploying to different serviceDelete .twiliodeployinfo and redeploy
Env vars reset after deployserverless:deploy doesn't preserve runtime env varsRe-set with twilio serverless:env:set after deploy

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.