From microsoft-365-agents-toolkit
Scaffolds, edits manifests, adds capabilities/plugins, deploys, and localizes declarative agents for M365 Copilot and Teams using ATK CLI.
npx claudepluginhub microsoft/work-iq --plugin microsoft-365-agents-toolkitThis skill uses the workspace's default tool permissions.
**Before doing ANYTHING, check the workspace files to fingerprint the project:**
references/api-plugins.mdreferences/authentication.mdreferences/best-practices.mdreferences/conversation-design.mdreferences/deployment.mdreferences/editing-workflow.mdreferences/examples.mdreferences/localization.mdreferences/mcp-plugin.mdreferences/scaffolding-workflow.mdreferences/schema.mdreferences/workspace-gates.mdSearches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Guides MCP server integration in Claude Code plugins via .mcp.json or plugin.json configs for stdio, SSE, HTTP types, enabling external services as tools.
Before doing ANYTHING, check the workspace files to fingerprint the project:
npx -y --package @microsoft/m365agentstoolkit-cli atk --version to confirm ATK CLI is installed. If not found → Stop. Tell the user to install ATK.m365agents.yml or teamsApp.yml at the project root.appPackage/declarativeAgent.json.package.json with express/react/next, src/index.js, app.py, etc.)Then follow the decision gate:
| Condition | Gate | Action |
|---|---|---|
Non-agent project files, no appPackage/ | Reject | Text-only response. No files, no commands. |
| No manifest, user wants to edit/deploy | Reject | Text-only response. Explain manifest is missing. |
| No manifest, user wants new project | Scaffold | → Scaffolding Workflow |
| Manifest exists with errors | Fix | Detect → Inform → Ask (see below). Do NOT deploy. |
| Valid agent project | Edit | → Editing Workflow |
Detailed gate rules, examples, and anti-patterns: Workspace Gates
These rules override ALL other instructions. If any of these apply, you MUST stop immediately.
NEVER create declarativeAgent.json yourself. If the manifest is missing and the user asked to edit/modify/deploy, respond with text only: explain the manifest is missing, suggest npx -y --package @microsoft/m365agentstoolkit-cli atk new or starting from scratch. Do NOT create the file, do NOT create appPackage/, do NOT "help" by scaffolding implicitly.
NEVER create files in a non-agent project. If the workspace is an Express/React/Django/etc. app without appPackage/, your response must be text-only. Do NOT create any files, do NOT run any commands.
NEVER deploy when errors exist. If the agent manifest has errors, STOP. Do NOT run npx -y --package @microsoft/m365agentstoolkit-cli atk provision — not "to test", not "to demonstrate the error", not "to see what happens". Report the errors and ask the user how to proceed.
When you encounter ANY problem (missing files, malformed JSON, validation errors, incompatible features), you MUST follow this sequence in order:
This protocol applies to:
declarativeAgent.json → Detect (file not found) → Inform ("no manifest found") → Ask ("would you like to create a new agent?")| Scenario | Workflow Reference |
|---|---|
| Creating a NEW project from scratch | Scaffolding Workflow |
Working with existing .json manifests | Editing Workflow |
| Adding an API plugin | API Plugins |
| Adding an MCP server | MCP Plugin |
| Adding OAuth to an MCP or API plugin | Authentication |
| Localizing an agent into multiple languages | Localization |
| Adding a new language to an already-localized agent | Localization |
| Writing agent instructions | Conversation Design |
Before running any ATK commands, check if the ATK CLI is available by running npx -y --package @microsoft/m365agentstoolkit-cli atk --version. If not found, STOP and tell the user — do NOT attempt to install it yourself.
All commands use the npx -y --package @microsoft/m365agentstoolkit-cli atk prefix (e.g., npx -y --package @microsoft/m365agentstoolkit-cli atk provision --env local).
After ANY change to files in appPackage/, you MUST deploy and show the test link before responding:
npx -y --package @microsoft/m365agentstoolkit-cli atk provision --env local --interactive false
Then read M365_TITLE_ID from env/.env.local and ALWAYS present the review UX:
✅ Agent deployed successfully!
🚀 Test Your Agent in M365 Copilot:
🔗 https://m365.cloud.microsoft/chat/?titleId={M365_TITLE_ID}
⛔ Never respond without this link. If you deployed, the test link MUST appear in your response. This is not optional — it is how the user tests their agent.
declarativeAgent.json or appPackage/ if they don't exist — this is a REJECT scenario, not a "help by creating" scenario<PREFIX>_MCP_AUTH_ID, TEAMS_APP_ID). Leave them empty (VAR_NAME=). Placeholders will be treated as real values and will NOT be overwritten by provisioning.Before adding ANY feature, read the version field in declarativeAgent.json and check the Schema feature matrix. If the feature isn't supported in that version, refuse and offer to upgrade.
Key version gates:
sensitivity_label, worker_agents, EmbeddedKnowledge → v1.6 onlyMeetings → v1.5+ScenarioModels, behavior_overrides, disclaimer → v1.4+Dataverse, TeamsMessages, Email, People → v1.3+npx -y --package @microsoft/m365agentstoolkit-cli atk add action for API Plugins — NEVER Create Plugin Files ManuallyYou are forbidden from manually creating ai-plugin.json, OpenAPI specs, adaptive cards, or editing the actions array. Use the CLI:
# ⛔ Always list ALL operations in a single call — NEVER run separate calls per operation
npx -y --package @microsoft/m365agentstoolkit-cli atk add action --api-plugin-type api-spec --openapi-spec-location URL --api-operation "GET /path,POST /path,PATCH /path/{id},DELETE /path/{id}" -i false
Run a single npx -y --package @microsoft/m365agentstoolkit-cli atk add action call per OpenAPI spec, listing all operations as a comma-separated list in --api-operation. Never run separate npx -y --package @microsoft/m365agentstoolkit-cli atk add action calls for different operations from the same spec — this creates multiple plugins instead of one. If npx -y --package @microsoft/m365agentstoolkit-cli atk add action fails, report the error; do NOT fall back to manual creation.
Exception: MCP servers are not supported by
npx -y --package @microsoft/m365agentstoolkit-cli atk add action. Use the MCP Plugin workflow instead.
When the user mentions an MCP server URL, follow the MCP Plugin workflow. You MUST discover tools via the MCP protocol handshake (initialize → notifications/initialized → tools/list) — NEVER fabricate tool names/descriptions. For authenticated MCP servers, follow the authentication guide to configure OAuth.
Adding a capability or plugin without updating instructions is incomplete. After ANY change:
Always update the app name and description to something meaningful. Never leave defaults like "My Agent".