Declarative Agent Developer
MicrosoftOfficialPublished by Microsoft
- Skill
- Tool integration
- Software development
- MIT
- Low risk
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The declarative-agent-developer skill provides a structured workflow for managing the lifecycle of M365 Copilot and Teams declarative agents. It utilizes the M365 Agent Toolkit (ATK) CLI to handle project scaffolding, manifest management, API plugin integration, and deployment. The skill enforces strict workspace validation, requiring specific project structures before allowing modifications, and provides standardized protocols for error handling, localization, and authentication configuration.
What it does
- Scaffolds new declarative agent projects using the ATK CLI.
- Manages and validates declarativeAgent.json manifests.
- Integrates API plugins and MCP servers into existing agent projects.
- Configures OAuth authentication for secure plugin communication.
- Handles localization of agent manifests and language files.
- Deploys agents to local environments for testing and validation.
When to use it
- When creating a new declarative agent project for M365 Copilot or Teams.
- When adding new capabilities, API plugins, or MCP servers to an existing agent.
- When updating agent instructions or conversation starters.
- When localizing an agent for multiple languages.
- When troubleshooting or fixing errors in an agent manifest.
Advantages
- Ensures consistent project structure through mandatory workspace checks.
- Automates complex tasks like API plugin registration and OAuth setup.
- Provides a clear, step-by-step protocol for error detection and resolution.
- Facilitates standardized deployment and testing workflows.
- Maintains schema compatibility by checking version requirements before feature implementation.
Usage examples
- “Create a new declarative agent project.”
- The agent will initialize a new project structure, including the necessary manifest files, provided the workspace is empty and valid for agent development.
- “Add an API plugin to my agent using this OpenAPI spec URL.”
- The agent will use the ATK CLI to integrate the specified API, map the requested operations, and prompt for necessary metadata updates.
- “Localize my agent into French.”
- The agent will generate the required tokenized manifests and language files to support French localization.
- “Deploy my agent to the local environment.”
- The agent will run the provisioning command and provide the M365 test link for the deployed agent.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/microsoft/declarative-agent-developer/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip declarative-agent-developer.zip -d .agents/skills
Documentation by Microsoft
M365 Agent Developer
Telemetry Tagging
Before running any atk CLI commands, set the session environment variable so all CLI invocations are tagged as skill-initiated:
export ATK_CLI_SKILL=trueRun this once at the start of the session. All subsequent atk commands in the same terminal will inherit it.
⛔ Workspace Check — MANDATORY FIRST STEP
Before doing ANYTHING, check the workspace files to fingerprint the project:
Run
npx -y --package @microsoft/m365agentstoolkit-cli atk --versionto confirm ATK CLI is installed. If not found → Stop. Tell the user to install ATK.Check for
m365agents.ymlorteamsApp.ymlat the project root.Check for
appPackage/declarativeAgent.json.Check for non-agent indicators (
package.jsonwith 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 project, user reports behavior issues | Review | → Instruction Review — run the full 5-phase review workflow |
| Valid agent project | Edit | → Editing Workflow |
Detailed gate rules, examples, and anti-patterns: Workspace Gates
🚫 HARD REJECTION RULES — No Exceptions
These rules override ALL other instructions. If any of these apply, you MUST stop immediately.
NEVER create
declarativeAgent.jsonyourself. If the manifest is missing and the user asked to edit/modify/deploy, respond with text only: explain the manifest is missing, suggestnpx -y --package @microsoft/m365agentstoolkit-cli atk newor starting from scratch. Do NOT create the file, do NOT createappPackage/, 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.
🔍 Detect → Inform → Ask (Error-Handling Protocol)
When you encounter ANY problem (missing files, malformed JSON, validation errors, incompatible features), you MUST follow this sequence in order:
Detect — Identify the specific problem. For JSON issues, attempt to parse the file and report syntax errors. For missing fields, check the manifest against the Schema.
Inform — Tell the user BEFORE taking any action. Describe exactly what is wrong ("declarativeAgent.json has malformed JSON: missing comma on line 12, unclosed array on line 18").
Ask — Wait for the user's response before making changes. Do NOT silently fix, auto-correct, or work around the problem.
This protocol applies to:
Missing
declarativeAgent.json→ Detect (file not found) → Inform ("no manifest found") → Ask ("would you like to create a new agent?")Malformed JSON → Detect (parse errors) → Inform (list specific syntax issues) → Ask ("should I fix these syntax errors?")
Validation errors → Detect (parse and check manifest) → Inform (list all errors) → Ask ("how would you like to fix these?")
Version incompatibility → Detect (feature requires newer version) → Inform ("this feature requires v1.6, your agent is v1.4") → Ask ("should I upgrade?")
Phase Routing
| 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 |
| Reviewing or improving existing agent instructions | Instruction Review |
| User reports agent gives generic/wrong answers | Instruction Review |
| Localizing an agent into multiple languages | Localization |
| Adding a new language to an already-localized agent | Localization |
| Writing agent instructions | Conversation Design |
ATK CLI Setup
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).
Critical Rules
1. Deploy After EVERY Edit
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 falseThen 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.
If the manifest has errors → STOP. Fix errors. Do NOT deploy.
Exception: user explicitly asks you not to deploy
2. Never Invent Content or Create Missing Files
Do NOT invent placeholder names, descriptions, or instructions
Do NOT create
declarativeAgent.jsonorappPackage/if they don't exist — this is a REJECT scenario, not a "help by creating" scenarioIf required fields are missing, report the gaps, and ASK the user
If JSON is malformed, follow Detect → Inform → Ask: parse the file first, tell the user what's broken, then ask before fixing. Use surgical edits (not rewrites)
⛔ NEVER set placeholder values for environment variables that are populated by automation (e.g.,
<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.
3. Schema Version Compatibility
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+
4. Use npx -y --package @microsoft/m365agentstoolkit-cli atk add action for API Plugins — NEVER Create Plugin Files Manually
You 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 falseRun 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.
5. MCP Server Integration
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.
6. Always Update Instructions & Starters After Changes
Adding a capability or plugin without updating instructions is incomplete. After ANY change:
Update instructions to describe the new/changed functionality — every data source should have clear intent coverage (WHEN and WHY to use it) per the Instruction Review quality bar. Built-in capabilities don't need exact names; actions/plugins should be named.
Do NOT list tool names, descriptions, or parameters in instructions — these are already in the plugin metadata (
ai-plugin.json, MCP manifests, capability config). Instructions should contain decision logic only: WHEN to use each tool, chaining rules, and failure handling.Stay within the 8,000-character instruction limit — if close to the limit, cut tool descriptions first
Add at least 1 conversation starter per added capability/plugin
Remove starters that reference removed capabilities
Run the Diagnostic Checklist against the updated instructions to verify quality
7. App Name Requirement
Always update the app name and description to something meaningful. Never leave defaults like "My Agent".
References
Shared
Authentication — OAuth discovery, credentials, oauth/register lifecycle, OAuthPluginVault
Best Practices — Security, performance, testing, compliance
Conversation Design — Authoring instructions and conversation starters from scratch
Instruction Review — Auditing, diagnosing, and improving existing instructions; anti-pattern detection; before/after rewrites
Deployment — ATK CLI workflows, environments, CI/CD
Localization — Multi-language support, tokenized manifests, language files
Workspace Gates — Detailed gate rules, examples, anti-patterns
Scaffolding
Scaffolding Workflow — Step-by-step scaffolding instructions, naming rules, error handling
JSON Development
Editing Workflow — Step-by-step JSON development instructions
Schema — Official JSON schema for agent manifests
API Plugins — OpenAPI integration for JSON agents
MCP Plugin — MCP server integration with RemoteMCPServer, OAuth, response semantics, logo handling
Examples — JSON manifest examples
Files
- ATTRIBUTION.mdAdded by AutoGineer922 B
- LICENSELicence file added by AutoGineer1.1 KiB
- SKILL.md12.6 KiB
- references/api-plugins.md36.2 KiB
- references/authentication.md9.0 KiB
- references/best-practices.md3.5 KiB
- references/conversation-design.md15.6 KiB
- references/deployment.md12.7 KiB
- references/editing-workflow.md15.1 KiB
- references/examples.md11.2 KiB
- references/instruction-review.md45.0 KiB
- references/localization.md18.4 KiB
- references/mcp-plugin.md38.3 KiB
- references/scaffolding-workflow.md8.4 KiB
- references/schema.md3.5 KiB
- references/workspace-gates.md9.2 KiB
references/workspace-gates.md
Workspace Detection & Gate Rules
This document contains detailed rules for workspace detection, gate scenarios, and error handling behavior.
🚨 CRITICAL — Read Before Anything Else
The #1 eval failure pattern is creating files that should not exist. These rules are HARD BLOCKS:
If
declarativeAgent.jsondoes NOT exist and the user asked to edit/modify/add/deploy → REJECT. Respond with text only. Do NOT create the file. Do NOT createappPackage/. Do NOT look at other directories for examples to copy.If
declarativeAgent.jsonhas malformed JSON → DETECT first, then INFORM, then ASK. You must parse the file and report errors to the user BEFORE making any edits. Never edit a broken file without first telling the user it's broken.If validation finds errors → NEVER run
npx -y --package @microsoft/m365agentstoolkit-cli atk provision. There are zero exceptions. Report errors and ask the user.
The "Detect → Inform → Ask" protocol is mandatory for ALL error states:
Detect: Identify the problem (missing file, parse error, validation error)
Inform: Tell the user what you found BEFORE taking action
Ask: Wait for instructions before modifying anything
Gate Definitions
Gate 1: Wrong Project Type — STOP
The workspace contains a non-agent project (Express, React, Django, plain Node.js, Python, Go, etc.) with NO appPackage/ folder and NO m365agents.yml.
Your entire response must be text-only. No edits, no commands, no files.
Example rejection:
This workspace contains an Express.js application (I can see package.json with
express as a dependency, src/index.js, etc.) but it is NOT an M365 declarative
agent project — there is no `appPackage/` folder and no `m365agents.yml`.
I cannot create agent files inside an existing non-agent project. To create a
declarative agent:
1. Navigate to a separate, empty directory
2. Ask me to create a new agent from scratchGate 2: No Manifest, User Wants to Edit/Deploy — STOP
No appPackage/declarativeAgent.json exists but user implies an existing agent ("add X to this agent", "deploy this", "update instructions").
Your entire response must be text-only. No edits, no commands, no files.
Anti-patterns that WILL cause eval failure:
❌ Creating
declarativeAgent.jsonfrom scratch to "help" the user❌ Creating the
appPackage/directory❌ Looking at other directories/fixtures for examples and copying them
❌ Running
npx -y --package @microsoft/m365agentstoolkit-cli atk newwhen the user asked to edit (editing ≠ scaffolding)❌ Running ANY
npx -y --package @microsoft/m365agentstoolkit-cli atkcommand — the project is not an agent project
Example rejection:
This workspace does not appear to be an M365 declarative agent project —
I could not find `appPackage/declarativeAgent.json`.
To get started with a new agent, please:
1. Navigate to an empty directory
2. Ask me to create a new agent from scratch
I cannot add capabilities or plugins to a project that doesn't have an agent manifest.Gate 3: No Manifest, User Wants New Project — Scaffold
User explicitly says "create a new agent", "scaffold", "start from scratch". The workspace should be empty — if it has a different project, go to Gate 1 instead.
→ Proceed to Scaffolding Workflow
Gate 4: Manifest Exists with Errors — Fix First
declarativeAgent.json exists but has validation errors.
Rules:
Parse and check
declarativeAgent.jsonagainst the expected schemaReport ALL errors to the user with specific details
ASK the user before making changes
Do NOT run
npx -y --package @microsoft/m365agentstoolkit-cli atk provision— fix errors first, no exceptionsDo NOT silently rewrite the entire file — surgical fixes only
Do NOT invent placeholder values for missing required fields
Special case — mostly empty manifest (has $schema and version but no name, description, or instructions): This is Gate 4. Report missing fields, ASK the user. Do NOT invent values.
Malformed JSON handling — STRICT ORDER (do NOT skip steps or reorder):
DETECT: Read the file and attempt to parse it. Identify all syntax errors.
INFORM: Tell the user the file has malformed JSON BEFORE making any edits. List every syntax issue you found (missing commas, unclosed brackets, trailing commas, etc.) with line numbers.
ASK: Ask the user if you should fix the syntax errors. Wait for their response.
FIX (only after user confirms): Fix with surgical edits (not a rewrite — if you're changing >20% of lines, stop and reconsider)
VALIDATE: Check the manifest against the schema after fixing
DO NOT DEPLOY: Even after fixing, do NOT run
npx -y --package @microsoft/m365agentstoolkit-cli atk provisionuntil the user's original request is also addressed and validation passes cleanly
⛔ Malformed JSON anti-patterns that WILL cause eval failure:
❌ Reading the file and immediately editing it without telling the user it's broken
❌ Fixing JSON errors as part of a larger edit (fix syntax → inform → ask, THEN handle the user's request separately)
❌ Running
npx -y --package @microsoft/m365agentstoolkit-cli atk provisionafter fixing syntax errors❌ Validating AFTER editing instead of detecting errors BEFORE editing
❌ Mentioning malformed JSON only in a summary at the end instead of upfront
Gate 5: Valid Project, User Reports Behavior Issues — Review
declarativeAgent.json exists and is valid, but the user reports that the agent "doesn't work well", "gives generic answers", "doesn't use the right tool", "ignores capabilities", or shows behavior changes after a model update.
Trigger phrases: "review instructions", "improve instructions", "my agent doesn't work", "agent gives generic answers", "agent doesn't follow the process", "agent changed after update"
→ Proceed to Instruction Review — run the full 5-phase review workflow (Inventory → Comprehension Check → Diagnose → Report → Rewrite).
Rules:
Follow the Detect → Inform → Ask protocol — diagnose first, present findings, wait for approval before rewriting
Do NOT skip directly to editing the instructions — run the diagnostic checklist first
Do NOT deploy until the review is complete and the user has approved changes
Gate 6: Valid Agent Project — Edit
→ Proceed to Editing Workflow
STOP Scenarios Quick Reference
| Scenario | What you see | What you MUST do | What you MUST NOT do |
|---|---|---|---|
| Express/React/Node app | package.json + src/index.js but NO appPackage/ | Text-only: tell user this is NOT an agent project | ❌ Create appPackage/ ❌ Run npx -y --package @microsoft/m365agentstoolkit-cli atk new ❌ Create ANY files |
| No manifest, edit request | No declarativeAgent.json, user says "add capability" | Text-only: explain manifest is missing | ❌ Create files ❌ Scaffold ❌ "Help" by creating missing files |
| Manifest missing fields | declarativeAgent.json missing name/description/instructions | List ALL missing fields, ASK user | ❌ Invent placeholders ❌ Auto-fill ❌ Run npx -y --package @microsoft/m365agentstoolkit-cli atk provision |
| Manifest has errors | Manifest has structural/schema errors | Report ALL errors, suggest fixes, ask user | ❌ Silently fix ❌ Deploy ❌ Auto-correct |
| Valid project, behavior issues | Valid manifest, user says "agent doesn't work well" | Run Instruction Review workflow (5 phases) | ❌ Jump to editing without diagnosis ❌ Deploy without review ❌ Rewrite without user approval |
Anti-Patterns (Gate 4)
These will cause eval failure:
File creation violations:
❌ Creating
declarativeAgent.jsonwhen it doesn't exist (this is Gate 2, not Gate 4)❌ Scaffolding a new project to "fix" an incomplete manifest
❌ Creating
appPackage/directory in a non-agent project
Content invention violations:
❌ Inventing placeholder values (generic names, boilerplate instructions)
❌ Auto-completing missing fields without asking
Malformed JSON violations:
❌ Editing a malformed file without first telling the user it's broken
❌ Combining syntax fixes with other edits in one step (fix syntax first, THEN handle the request)
❌ Validating JSON only AFTER editing — you must detect errors BEFORE editing
❌ Mentioning "the file had malformed JSON" only in a final summary
Deployment violations:
❌ Running
npx -y --package @microsoft/m365agentstoolkit-cli atk provisionwhen validation found errors — not even "to test"❌ Running
npx -y --package @microsoft/m365agentstoolkit-cli atk provision"to see what happens"❌ Auto-correcting errors and deploying without asking
❌ Deploying "for educational purposes" to show error output
"EVEN IF..." — No exceptions to the deploy block:
EVEN IF deploying would "demonstrate the error" — just report errors
EVEN IF the user says "deploy this" — if you know there are errors, explain why you can't
EVEN IF you fixed errors yourself — verify the JSON is valid before deploying
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs an MCP server, Needs Node.js
Security
What our scanner noticed· Low risk
- Phrasing that asks for actions without confirmation
- Instructions that use the network
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Microsoft
- Publisher
- Microsoft (Official)
- Source
- microsoft/skills · .github/plugins/microsoft-365-agents-toolkit/skills/declarative-agent-developer · commit 0696600
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Microsoft or Microsoft.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download declarative-agent-developer.zip