Change agents and skills fields in plugin.json to array format for Claude Code CLI compatibility - #407
Conversation
…n parser Claude Code CLI validates `agents` as array-of-strings per its plugin manifest schema. Our plugin.json files had `"agents": "./agents/"` (a string), which caused "agents: Invalid input" validation errors on install. Remove the field from the 3 affected plugin.json files — agents are still discovered by convention from the `agents/` directory. Also make ParsePluginJson resilient to both string and array formats for forward-compatibility. Co-authored-by: ViktorHofer <7412651+ViktorHofer@users.noreply.github.com>
…patibility Co-authored-by: ViktorHofer <7412651+ViktorHofer@users.noreply.github.com>
agents string field from plugin.json for Claude Code CLI compatibility
|
@copilot instead of removing the agents key, I would just make it an array. I would just mirror what we do for skills (glob everything). Also update skill-validator to read the string array and fallback to just a string if an array doesn't exist. |
…to read array-first with string fallback Plugin.json files now declare agents as an array of file paths: "agents": ["./agents/foo.agent.md", "./agents/bar.agent.md"] ParsePluginJson reads the array first (preferred, Claude Code schema), falls back to a string path (legacy). PluginInfo gains an AgentPaths field. Validator and discovery use the array when present, else fall back to directory-based convention. Co-authored-by: ViktorHofer <7412651+ViktorHofer@users.noreply.github.com>
|
@copilot do we need to list every agent in the plugin.json? We don't do that for skills. Check if Claude Code and Copilot CLI support the simplified form (just pointing to the directory). |
Done in 129c089. Changed
All 402 tests pass, plugin check confirms 5 agents discovered across 3 plugins. |
agents string field from plugin.json for Claude Code CLI compatibilityagents field in plugin.json to array format for Claude Code CLI compatibility
…rectories in array entries Per Copilot CLI spec, agents field values are "Path(s) to agent directories" — no need to list individual files. Use ["./agents/"] to mirror how skills uses "./skills/". Updated validator and discovery to handle both directory and file entries in the array. Co-authored-by: ViktorHofer <7412651+ViktorHofer@users.noreply.github.com>
No, we don't need to list every agent. Per the Copilot CLI plugin reference, the Simplified all 3 plugin.json files to Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot do we treat skills the same in plugin.json? |
There was a problem hiding this comment.
Pull request overview
This PR updates plugin manifests and the skill-validator tooling to support Claude Code CLI’s requirement that plugin.json declare agents as an array<string>, while preserving compatibility with the legacy Copilot CLI string form.
Changes:
- Convert
agentsin 3plugin.jsonfiles from a string to an array of directory paths (e.g.,["./agents/"]). - Extend
PluginInfowithAgentPathsand updateParsePluginJson/ValidatePluginto prefer the array form with legacy fallback. - Update agent discovery to honor
AgentPathsand add tests for parsing/validation behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/dotnet-template-engine/plugin.json | Switch agents to array form for Claude Code CLI compatibility. |
| plugins/dotnet-msbuild/plugin.json | Switch agents to array form for Claude Code CLI compatibility. |
| plugins/dotnet-diag/plugin.json | Switch agents to array form for Claude Code CLI compatibility. |
| eng/skill-validator/src/Models/Models.cs | Add PluginInfo.AgentPaths to carry array-based agent paths. |
| eng/skill-validator/src/Services/PluginValidator.cs | Prefer parsing/validating agents as an array with legacy string fallback. |
| eng/skill-validator/src/Services/SkillDiscovery.cs | Discover agents using AgentPaths (dirs or files), else fall back to legacy behavior. |
| eng/skill-validator/tests/AgentPluginTests.cs | Add tests covering parsing agents array and validating array-based agent paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
… to handle both forms Co-authored-by: ViktorHofer <7412651+ViktorHofer@users.noreply.github.com>
…tency Co-authored-by: ViktorHofer <7412651+ViktorHofer@users.noreply.github.com>
No, we weren't — |
…r Claude Code CLI compatibility Co-authored-by: ViktorHofer <7412651+ViktorHofer@users.noreply.github.com>
agents field in plugin.json to array format for Claude Code CLI compatibilityagents and skills fields in plugin.json to array format for Claude Code CLI compatibility
…le array fields Remove dual string/array fields from PluginInfo. The parser now normalizes legacy string values into single-element arrays, so all downstream code uses only SkillPaths and AgentPaths (IReadOnlyList<string>). This eliminates all array-vs-string fallback branching. Co-authored-by: ViktorHofer <7412651+ViktorHofer@users.noreply.github.com>
|
Thanks for the quick turnaround! We hit this installing dotnet-diag, dotnet-msbuild, and dotnet-template-engine on Claude Code 2.1.79 (macOS ARM64). The other 7 plugins installed fine. We also filed anthropics/claude-code#36268 for the validator bug on their side. |
|
@ViktorHofer is the array for |
|
The skill-validator changes are required so that we are able to validate all forms of plugins. The actual plugin.json changes around skills aren't needed, this is just for consistency. But I tested it and it work with cc and GH cp CLI. |
|
/evaluate |
Skill Validation Results
[1] (Plugin) Quality unchanged but weighted score is -5.9% due to: tokens (11894 → 32939), tool calls (0 → 2), time (14.2s → 23.4s)
Model: claude-opus-4.6 | Judge: claude-opus-4.6 |
Claude Code CLI validates
agentsandskillsin plugin.json asarray<string>per its manifest schema. Our plugins declared these as directory path strings (e.g."agents": "./agents/","skills": "./skills/"), causing install failures:Per the Copilot CLI plugin reference, both
agentsandskillsfield types arestring | string[]with values being "Path(s) to directories". The simplified directory-path array form["./agents/"]/["./skills/"]satisfies both Claude Code CLI (requires array) and Copilot CLI (accepts both).Changes
"agents"to a directory-path array in 3 plugin.json files (dotnet-diag,dotnet-msbuild,dotnet-template-engine) — using["./agents/"]"skills"to a directory-path array in all 10 plugin.json files — using["./skills/"]PluginInfomodel — replaced the dualSkillsPath(string) /SkillPaths(array) andAgentsPath(string) /AgentPaths(array) fields with singleSkillPathsandAgentPathsfields (IReadOnlyList<string>). The parser normalizes legacy string values into single-element arrays, so all downstream code uses one field with no fallback branching.ParsePluginJsonto read bothskillsandagentsas string arrays first (preferred, Claude Code schema) and normalize plain strings into single-element arraysValidatePluginto validate array entries as either directories or files for both fields (safety checks + existence)DiscoverSkillsInPluginandDiscoverAgentsInPluginto handle array entries as directories (discovering all files within) or individual filesAgentRunnerandCheckCommandto resolve skill directories from the array fields.nuget/nuget.exebinaryOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.