$npx -y skills add microsoft/skills-for-copilot-studio --skill validateValidate Copilot Studio agent YAML files using the LSP binary's full diagnostics (YAML structure, Power Fx, schema, cross-file references). Use when the user asks to check, validate, or verify YAML files.
| 1 | # Validate Agent YAML |
| 2 | |
| 3 | Validate Copilot Studio agent YAML files using the LanguageServerHost binary's full diagnostics — the same validation engine used by the VS Code Copilot Studio extension. |
| 4 | |
| 5 | ## Instructions |
| 6 | |
| 7 | 1. **Locate the agent workspace.** Find the directory containing `.mcs/conn.json`. If a specific file was requested, use the workspace that contains it. |
| 8 | |
| 9 | 2. **Run LSP-based validation**: |
| 10 | ```bash |
| 11 | node ${CLAUDE_SKILL_DIR}/../../scripts/manage-agent.bundle.js validate \ |
| 12 | --workspace "<path-to-agent-folder>" \ |
| 13 | --tenant-id "<tenantId>" \ |
| 14 | --environment-id "<envId>" \ |
| 15 | --environment-url "<envUrl>" \ |
| 16 | --agent-mgmt-url "<mgmtUrl>" |
| 17 | ``` |
| 18 | This validates all `.mcs.yml` files in the workspace using the LSP binary's full diagnostics: YAML structure, Power Fx expressions, schema validation, cross-file references, and environment-specific checks. |
| 19 | |
| 20 | Connection details come from `.mcs/conn.json` — read it to get tenant-id, environment-id, environment-url, and agent-mgmt-url. |
| 21 | |
| 22 | 3. **Parse the JSON output**: |
| 23 | - `valid: true` → all files pass (may still have warnings) |
| 24 | - `valid: false` + `summary.errors > 0` → report errors as FAIL items |
| 25 | - `summary.warnings > 0` → report as WARN items |
| 26 | - Each file with diagnostics is listed with severity, message, code, and line range |
| 27 | |
| 28 | 4. **If the user asked about a specific file**, filter the output to show only that file's diagnostics. |
| 29 | |
| 30 | 5. **For additional context on specific errors**, use schema lookup: |
| 31 | ```bash |
| 32 | node ${CLAUDE_SKILL_DIR}/../../scripts/schema-lookup.bundle.js resolve <kind> |
| 33 | ``` |
| 34 | |
| 35 | 6. **Report findings**: |
| 36 | |
| 37 | ``` |
| 38 | Validation Results for: <agent-name> |
| 39 | |
| 40 | [PASS] <filename> — no issues |
| 41 | [FAIL] <filename> — <error message> (line X) |
| 42 | [WARN] <filename> — <warning message> (line X) |
| 43 | |
| 44 | Summary: X files checked, Y errors, Z warnings |
| 45 | ``` |