twilio-invariants
Skill2 starsChanged 8 months agoMITView on GitHub
Twilio development invariants and rules
- Reads credentials
In this repository66 other files it gives its agents.
- adversarial-reviewSkill
- agent-connectSkill
- agent-teams-guideSkill
- agent-testingSkill
- android-sdkSkill
- brainstormSkill
- branded-callingSkill
- callbacksSkill
- compliance-regulatorySkill
- conferenceSkill
- context-engineeringSkill
- context-hubSkill
- conversational-intelligenceSkill
- conversation-relay-referenceSkill
- conversation-relaySkill
- conversationrelaySkill
- conversations-v2Skill
- customer-memorySkill
- deepgramSkill
- deep-validationSkill
- elastic-sip-trunkingSkill
- env-doctorSkill
- event-streamsSkill
- getting-startedSkill
- hooks-referenceSkill
- iamSkill
- ios-sdkSkill
- ivr-crawlerSkill
- ivr-migratorSkill
- lookupSkill
- media-streamsSkill
- memory-systemsSkill
- messaging-services-referenceSkill
- messaging-servicesSkill
- messagingSkill
- multi-agent-patternsSkill
- operational-gotchasSkill
- paymentsSkill
- paySkill
- phone-numbersSkill
- proxySkill
- real-time-transcriptionSkill
- recordingsSkill
- segmentSkill
- sendgrid-emailSkill
- sip-byocSkill
- sipSkill
- sync-referenceSkill
- syncSkill
- taskrouter-referenceSkill
- taskrouterSkill
- tdd-workflowSkill
- tool-boundariesSkill
- twilio-cliSkill
- verify-referenceSkill
- verifySkill
- video-patternsSkill
- videoSkill
- voice-insightsSkill
- voice-referenceSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
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
- Very specific: line 32
Handler signature: All Twilio Functions export handler(context, event, callback).
≈ “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.
Files
paths:
- "functions/**"
- "tests/**"
Serverless Function Invariants
Rules that have each caused real debugging time loss. See domain CLAUDE.md files for full context.
<architectural_invariants>
Twilio.Response.setBody()requires strings — Passing objects causesBuffer.from(object)TypeError. AlwaysJSON.stringify()+ Content-Type header.console.error()→ 82005 alerts,console.warn()→ 82004 — Useconsole.log()for ALL logging in Twilio Functions, including error conditions and catch blocks. Never useconsole.error()orconsole.warn()— they trigger debugger alerts that pollute monitoring and mask real issues. SeeCLAUDE.md(Logging Rules) for canonical policy.- Env vars can reset on deploy —
twilio serverless:deploydoesn't preserve runtime env vars. Always verify after deployment. - TwiML: one document controls a call at a time — Updating a participant's TwiML exits their current state (conference, queue). Exception:
<Start><Stream>,<Start><Recording>,<Start><Siprec>fork background processes. <Start><Recording>syntax is.recording(), not.record()—twiml.start().recording({...})is correct.- Empty
voiceUrlon a Twilio number = silent instant call failure — Calling a number withvoiceUrl: ""producesstatus: failed, duration: 0with ZERO diagnostics. Always verify destination webhooks vialist_phone_numbersbefore debugging call routing. - dotenv default mode doesn't override shell vars — All project dotenv calls use
{ override: true }so.envalways wins. New dotenv usage must includeoverride: true. <Pay>silently ignored on outbound API call legs —<Pay>in inline TwiML onmake_callproduces zero errors, zero callbacks. Must run from a phone number's voice URL webhook.- Conference DTMF is per-call, not cross-participant —
<Play digits>on one conference participant generates in-band audio. Cannot inject DTMF across conference participants. - Conference has no parent/child relationships — Each participant is an independent call. One disconnecting doesn't affect others (unless
endConferenceOnExit=true). Contrast with<Dial>-created calls where parent/child are coupled. <Pause>as first TwiML verb = no-answer — Webhook must produce audio (<Say>) before<Pause>to properly answer the call.- Video rooms require API Key auth — AccessToken for Video uses API Key + Secret, not Auth Token. Functions must have TWILIO_API_KEY and TWILIO_API_SECRET env vars.
- Never expose
accountSidorauthTokenin function responses — REST API credentials in browser JS or TwiML responses enable full account takeover. Use API Keys (SK...) for client-side auth. Server-side only:context.ACCOUNT_SID,context.AUTH_TOKEN. <Start><Transcription>callbacks are form-encoded — Transcription status callbacks arrive asapplication/x-www-form-urlencoded, NOT JSON. Parse fields fromeventdirectly (event.TranscriptionText,event.TranscriptionSid). Do notJSON.parse().- Handler signature: All Twilio Functions export
handler(context, event, callback).contextprovides env vars viacontext.VARIABLE_NAMEand a pre-authenticated client viacontext.getTwilioClient().eventcontains request parameters.callback(error, response)returns the response. </architectural_invariants>
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
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.

