agentleFS
gtappsgtapps/msteams-channel/skills/configure/SKILL.md

configure

Skill3 starsChanged 4 days agoMITView on GitHub

Set up the Microsoft Teams channel — save Entra credentials and review access policy. Use when the user pastes a Teams app id or secret, asks to configure Teams, asks "how do I set this up" or "who can reach me," or wants to check channel status.

  • Reads credentials

45 other projects use a version of this, 14 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use calendar, setup and 2 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • jacobraskSkill

    calendar

    Interact with Apple Calendar via AppleScript. Use when the user asks to check calendar, view events, create events, manage schedule, find free time, or list calendars. Triggers include "my calendar", "my schedule", "calendar events", "create event", "add to calendar", "what's on my calendar", "free time", "available slots", "upcoming events", "today's events". Requires macOS with Calendar.app.

    Also in 3 projects that use this

  • VercelSkill

    setup

    Set up Vercel CLI and project configuration. Use when the user says "set up Vercel", "configure Vercel", "link to Vercel", or "vercel init".

    Also in 7 projects that use this

  • AnthropicSkill

    status

    Case status summary by audience — client-facing (plain language), internal (for the professor), or court-ready (formal caption format per local rules). Same facts, different framing and depth. Use when a student needs to update the client, brief the professor, or prepare a court status report.

    Also in 3 projects that use this

  • Microsoft AzureSkill

    build

    Build the TypeSpec Rust emitter from source. Run this after cloning the repo, after pulling changes, or when TypeScript source files have been modified.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 45 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run this first and use the output as <STATE_DIR> for every path below:

    line 22
  2. Distinctive:

    Read both state files and give a complete picture:

    line 51
  3. Very specific:

    Read the existing .env if present.

    line 98
  4. Very specific:

    Never pass a credential as a command argument: argv is world-readable in /proc on Linux.

    line 107
  5. Very specific:

    Delete the MSTEAMS_* lines (or the file, if that is all it holds).

    line 112
  6. Very specific:

    Never write credentials anywhere but .env, and never echo a secret back to the user — not even to confirm it was received.

    line 163

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

/msteams:configure — Teams Channel Setup

Writes Entra credentials to <STATE_DIR>/.env and orients the user on access policy. The server reads .env once at boot and access.json on every inbound message.

Resolve the state dir

Run this first and use the output as <STATE_DIR> for every path below:

echo "${MSTEAMS_STATE_DIR:-$HOME/.claude/channels/msteams}"

This is the same rule server.ts uses, so the skill and the listener agree whenever they see the same environment. Report the resolved path in your status output — if it is not what the operator expects, that is the bug, and everything else you say will be about the wrong directory.

Never mkdir while reporting status. A missing directory is a status to report, not a state to fix; creating one here would shadow the operator's real state dir. Only the credential-saving path below creates anything.

Unlike a Discord bot token, Teams needs a provisioning chain: an Entra app, a service principal, an Azure Bot, a tunnel, and a Teams app manifest. The full walkthrough with exact commands is SETUP.md in this plugin's repo. Send the user there for provisioning; this skill handles credentials, status, and the few steps that are easy to get wrong.

Arguments passed: $ARGUMENTS


Dispatch on arguments

No args — status and guidance

Read both state files and give a complete picture:

  1. State dir — report the resolved <STATE_DIR> on its own line, so a relocation that only reached half the system is visible rather than inferred.
  2. Credentials — check <STATE_DIR>/.env for MSTEAMS_APP_ID, MSTEAMS_APP_PASSWORD, MSTEAMS_TENANT_ID. Show set/not-set per key; never echo the secret, and mask the app id beyond its first segment. All three are required — the listener does not start without them, though MCP still serves so this skill stays reachable.
  3. Access — read <STATE_DIR>/access.json (missing = defaults: dmPolicy: "pairing", empty allowlist). Show the DM policy and what it means in one line, allowed senders, pending pairings with codes, and opted-in conversations.
  4. What next — one concrete step for where they actually are. Missing credentials sends them to SETUP.md; credentials present but nobody allowed means they should DM the bot in Teams and approve the code it returns with /msteams:access pair <code>; everything set means they are ready.

Push toward lockdown — always. The goal for every setup is allowlist with a defined list. pairing is not a policy to stay on; it is a temporary way to capture AAD object ids you do not know yet. Once the ids are in, pairing has done its job.

Drive that conversation: read the allowlist, tell the user who is in it, ask whether that is everyone who should reach them. If yes and the policy is still pairing, offer to run /msteams:access policy allowlist — proactively, don't wait to be asked. If people are missing, have them message the bot and approve each one. If the allowlist is empty and they have not paired themselves, that is the first step. Never frame pairing as the correct long-term choice.

Teams already limits reach to your tenant, but a tenant is not an allowlist — every colleague is inside it.

Saving credentials

Accept them one at a time or together. Recognize what you were handed:

  • an app id / client id / tenant id — a GUID
  • an app password / client secret — the value Azure shows once at creation, never the "secret ID" beside it, which is not a credential

Then:

  1. mkdir -p "<STATE_DIR>"
  2. Read the existing .env if present; update or add only the keys you were given and preserve the rest. No quotes around values.
  3. chmod 600 "<STATE_DIR>/.env" — these credentials let anyone post as the bot.
  4. Confirm what was saved — naming <STATE_DIR>, never the secret — then show the no-args status.

The server reads .env at boot. A credential change needs a session restart to take effect; say so after saving.

Never pass a credential as a command argument: argv is world-readable in /proc on Linux. Write the file with the Write tool.

clear — remove credentials

Delete the MSTEAMS_* lines (or the file, if that is all it holds).


The step everyone misses

az ad sp create --id <app-id> is mandatory. az ad app create registers the application but does not create the enterprise application (service principal), so the tenant refuses to issue it a token.

Raise this whenever a user reports that inbound works but replies fail, and whenever you walk someone through a manual registration. The failure is maximally delayed and misleading: everything provisions, the channel registers, inbound messages arrive and pass the gate, Claude composes a reply — and only the send fails, with:

AADSTS7000229: The client application <app-id> is missing service principal in the tenant <tenant-id>

@microsoft/teams.cli does this as a side effect of its own provisioning, so only manual registrations hit it — which is exactly the path SETUP.md documents.


Implementation notes

  • The state dir may not exist if the server has never run. Missing file = not configured, not an error.
  • If <STATE_DIR> is not where the operator expects, MSTEAMS_STATE_DIR is not reaching this shell. Anything written here then lands where the listener never looks: credentials appear unset to the server, and /msteams:access changes take effect nowhere. Declaring the variable in .claude/settings.local.json reaches the MCP server but may not reach skills — export MSTEAMS_STATE_DIR=… in the shell that launches claude reaches both. The listener's own answer is authoritative and is in ~/.claude/debug/<session-id>.txt: msteams channel: ready (state dir …).
  • access.json is re-read on every inbound message, so policy changes via /msteams:access take effect immediately — no restart. Credentials are the opposite. Be precise about which is which when telling the user what to do.
  • Enabling the channel in Claude Code is a separate two-part step from provisioning: an allowedChannelPlugins entry in the managed-settings file (/etc/claude-code/managed-settings.json on Linux and WSL, /Library/Application Support/ClaudeCode/managed-settings.json on macOS; root-written; that list replaces the default, so every channel already in use must be re-listed) plus launching with --channels plugin:msteams@msteams-channel. If the user says the bot is running but nothing reaches the session, that is where to look — TROUBLESHOOTING.md has the diagnosis, which starts at the Channel notifications skipped: line in ~/.claude/debug/<session-id>.txt.
  • Never write credentials anywhere but .env, and never echo a secret back to the user — not even to confirm it was received.

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.