agentleFS
wittyreferencewittyreference/twilio-claude-plugin/skills/env-doctor/SKILL.md

env-doctor

Skill2 starsChanged 8 months agoMITView on GitHub

Twilio development skill: env-doctor

  • Reads credentials

4 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

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run the diagnostic script:

    line 21

“Common” is measured: kept by at least 6 in 10 of the 3 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

name: env-doctor description: Diagnose shell and .env credential conflicts. Use when hitting 401 errors, auth failures after switching Twilio accounts, or mysterious environment variable issues.

Environment Doctor

Diagnose shell vs .env conflicts that cause mysterious Twilio auth failures. Run this when:

  • A new user clones the repo and gets 401 errors
  • API calls fail after switching between Twilio accounts or projects
  • Regional routing errors appear unexpectedly
  • MCP tools return auth failures but CLI works (or vice versa)

Usage

Run the diagnostic script:

./scripts/env-doctor.sh

What It Checks

CheckWhat It Detects
1. Project .envMissing .env file
2. Credential conflictsTWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, TWILIO_PHONE_NUMBER mismatch between shell env and .env file
3. Regional routingOrphaned TWILIO_REGION/TWILIO_EDGE in shell that silently redirect all API calls to regional endpoints
4. API key authTWILIO_API_KEY/TWILIO_API_SECRET mismatch between shell and .env
5. Environment isolationWhether direnv is installed and .envrc is allowed

Common Scenarios

New user gets 401 after cloning

They have TWILIO_ACCOUNT_SID from a previous project in their shell. The .env has different credentials. Shell wins → wrong account → 401.

Fix: unset TWILIO_ACCOUNT_SID TWILIO_AUTH_TOKEN or install direnv.

Regional 401 errors

User previously set TWILIO_REGION=au1 for regional testing. They commented it out in .env but the shell still has it. All API calls silently route to AU1 endpoints where US1 credentials fail.

Fix: unset TWILIO_REGION TWILIO_EDGE — commenting out .env lines doesn't unset shell vars.

MCP tools fail but CLI works

The MCP server inherits env at launch. If shell had stale vars when Claude Code started, MCP uses those. CLI reads .env fresh each invocation.

Fix: Restart Claude Code entirely after fixing env vars.

Integration

  • Runs automatically before npm start (via prestart hook in package.json)
  • Referenced in CLAUDE.md Documentation Protocol section
  • Also available via /preflight (Check 2.8)

Exit Codes

  • 0 — Clean (or warnings only)
  • 1 — Conflicts detected that will cause auth failures

$ARGUMENTS

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.