require-valid-agent-hooks
Require Copilot custom-agent hooks to use type: command and define at least one command property.
Rule catalog ID: R014
Targeted pattern scopeâ
.github/agents/**/*.agent.md
What this rule reportsâ
- hook entries whose
typeis missing or notcommand - hook entries that do not define any of
command,windows,linux, orosx
Why this rule existsâ
Agent-scoped hooks in VS Code use the same structure as hook configuration files. The hook documentation states that each hook entry must have type: "command" and at least one command property. This rule catches incomplete agent-scoped hook entries before they silently fail or miscommunicate behavior.
â Incorrectâ
---
description: Format files after editing
hooks:
PostToolUse:
- type: command
cwd: scripts
---
Format edited files after tool usage.
â Correctâ
---
description: Format files after editing
hooks:
PostToolUse:
- type: command
command: ./scripts/format.sh
---
Format edited files after tool usage.