Skip to content

agent-name-filename-mismatch

Agent name must match filename

Error

Rule Details

This rule checks that the name field in agent frontmatter exactly matches the filename (without the .md extension). For example, an agent at .claude/agents/code-reviewer.md must have name: code-reviewer in its frontmatter. This consistency ensures agents are discoverable and prevents confusion when the filename and configuration disagree about the agent identity.

Incorrect

Agent name does not match filename (file at .claude/agents/code-reviewer.md)

yaml
---
name: review-agent
description: Reviews code for quality
---

Correct

Agent name matches filename (file at .claude/agents/code-reviewer.md)

yaml
---
name: code-reviewer
description: Reviews code for quality
---

How To Fix

Either rename the file to match the agent name, or update the name field in frontmatter to match the filename (without the .md extension).

Options

This rule does not have any configuration options.

Resources

Version

Available since: v0.2.0