Skip to content

check: 'name:' is required on every entity, but commands are named by file #165

Description

@imarios

Problem

checkName in src/core/frontmatter.ts warns missing required field 'name'
for any entity whose frontmatter omits name:. It applies the same rule to
skills, agents, and commands.

Claude Code slash commands are named by filename, not frontmatter — a
commands/deploy.md with only description: is completely valid and is how
most commands in the wild are written. skilltree's own scaffolder agrees that
the name is path-derived: entityNameFromPath() in src/core/entity-type.ts
falls back to the filename stem precisely because "commands and many agents are
named by file, not by frontmatter".

So check warns about a correct file, and --strict exits 1 on it.

Relationship to #159 / #160

Same class of bug: the linter being stricter than the runtime it lints for.
Those two were hard errors on unknown keys and are fixed in #162; this one is a
warning, so it only bites under --strict — which is why it wasn't reported
alongside them. It's the remaining instance of the pattern.

Why it's now easy to fix

#162 threads the resolved entityType into validateFrontmatter. Before that
change the validator had no way to know it was looking at a command. Now it
does, and checkName is the one check that should consume it but doesn't:

// src/core/frontmatter.ts — validateFrontmatter
...checkName(fm, context.entityName),   // <- entityType is in scope, unused here

Proposed fix

Make name: optional for type: command — either skip the missing-field
warning entirely, or keep validating it only when present (so a name: that
disagrees with the filename is still reported, which is the genuinely useful
half of this check).

Worth deciding the same question for agents, where name: is conventional but
also path-derivable.

Found while working on #159/#160.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions