Validate and fix YAML frontmatter in Claude Code agent and command files
Validates and fixes YAML frontmatter in Claude Code agent and command files. Use this when creating or updating agents/commands to ensure proper formatting and schema compliance.
/plugin marketplace add nitromike502/meckert-claude-code-marketplace/plugin install cc-validator@local-marketplace<path> [--type agents|commands|all]You are executing the /cc-validator:validate-frontmatter command. Follow this workflow precisely.
$ARGUMENTS (parse the path and optional --type flag)all (if --type not specified)${CLAUDE_PLUGIN_ROOT}/scripts/${CLAUDE_PLUGIN_ROOT}/schemas/frontmatter-schema.mdpath and --type (default: all)${CLAUDE_PLUGIN_ROOT}/scripts/find-claude-files.sh <path> --type <type>
IMPORTANT: Use the script pipeline to extract frontmatter efficiently. Do NOT read full files.
Read the schema file for validation rules:
${CLAUDE_PLUGIN_ROOT}/schemas/frontmatter-schema.md
Extract frontmatter from all discovered files using the script pipeline:
${CLAUDE_PLUGIN_ROOT}/scripts/find-claude-files.sh <path> --type <type> | \
${CLAUDE_PLUGIN_ROOT}/scripts/extract-frontmatter.sh --stdin --lines 30
Parse the output and validate each file's frontmatter against schema rules:
For Agents (agents/*.md):
name exists and matches ^[a-z0-9-]{1,64}$description existsdescription uses single quotes if contains \n or special charstools is comma-separated string (not YAML array)model (if present) is one of: sonnet, opus, haiku, inheritpermissionMode (if present) is valid valuecolor (if present) is valid valueFor Commands (commands/*.md):
name (if present) matches filename (warning only)color propertypermissionMode propertyskills propertydescription uses single quotes if contains \n or special charsallowed-tools is comma-separated string (not YAML array)disable-model-invocation (if present) is booleanCategorize issues:
Display validation results in a clear, readable format. Use your best judgment for formatting that renders well in the terminal.
IMPORTANT: Always list ALL properties found in the frontmatter with their values and validation status. Never summarize as "All properties valid" - always show each property individually.
Report structure:
---
AGENTS
/path/to/agents/file1.md
- ✅ name: "my-agent" - Valid
- ✅ description: "Agent description here" - Valid
- ⚠️ WARNING tools: Uses YAML array format - should be comma-separated string
- ✅ model: "sonnet" - Valid
/path/to/agents/file2.md
- ✅ name: "other-agent" - Valid
- ✅ description: "Another agent" - Valid
- ✅ tools: "Read, Write, Glob" - Valid
---
COMMANDS
/path/to/commands/file1.md
- ⚠️ WARNING name: "my-cmd" - Commands typically don't use name property (derived from filename)
- ⚠️ WARNING color: "green" - Commands don't support color property (this is for agents)
- ✅ description: "Command description" - Valid
- ✅ argument-hint: "[file path]" - Valid
/path/to/commands/file2.md
- ✅ description: "Another command" - Valid
- ✅ allowed-tools: "Bash, Read" - Valid
---
SUMMARY
X files validated
- N files passed
- N files with warnings
- N files with errors
Report rules:
After displaying the report, if there are any warnings or errors:
Ask user using AskUserQuestion:
If user selects "Verify schema first":
subagent_type: claude-code-guide to verify the current frontmatter schema for Claude Code agents and commandsIf user selects "Report only", end the command here with the report summary.
If user wants to proceed and there are fixable issues:
For each file with issues, show proposed changes:
### [filename.md]
**Issue**: <description>
**Current:**
```yaml
<current frontmatter>
Proposed:
<fixed frontmatter>
Present ALL proposed changes before any modifications
Ask user using AskUserQuestion:
If user wants to review, discuss and adjust specific fixes as requested
After presenting all proposed fixes:
---