hermes - 💡(How to fix) Fix [Bug]: `_create_skill` / `_edit_skill` allow frontmatter `name` to diverge from directory name

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

skill_manage(action="create", name="foo", content="---\nname: bar\n...") silently creates a skill whose directory is foo/ but whose skills_list display name is bar. The write path never validates that frontmatter name matches the name parameter.

Error Message

Explicit rejection over silent auto-overwrite — the error message lets the agent self-correct.

Root Cause

  • _validate_frontmatter() (skill_manager_tool.py:240) only checks that a name field exists — no cross-check against the directory name
  • _create_skill() (skill_manager_tool.py:403) writes content verbatim
  • _edit_skill() (skill_manager_tool.py:446) same
  • _patch_skill() (skill_manager_tool.py:537) calls _validate_frontmatter without cross-check
  • Hub installs are unaffected (both names derive from the same SKILL.md)

Fix Action

Fix / Workaround

Same divergence can be introduced via edit or patch.

Those issues patch read-path symptoms (skill_view can't resolve frontmatter name, bundled skill misclassified, etc.). This is the write-path root cause_create_skill and _edit_skill allow inconsistent data to enter the system. Fixing read paths is necessary but insufficient: as long as the write path permits divergence, every new read-path consumer must independently handle the dual-namespace problem.

  • _validate_frontmatter() (skill_manager_tool.py:240) only checks that a name field exists — no cross-check against the directory name
  • _create_skill() (skill_manager_tool.py:403) writes content verbatim
  • _edit_skill() (skill_manager_tool.py:446) same
  • _patch_skill() (skill_manager_tool.py:537) calls _validate_frontmatter without cross-check
  • Hub installs are unaffected (both names derive from the same SKILL.md)

Code Example

skill_manage(
    action="create",
    name="local-paper-summarizer",
    content="---\nname: local-paper-summary\ndescription: ...\n---\n\nSteps..."
)

---

def _validate_frontmatter(content: str, expected_name: str = None) -> Optional[str]:
    ...
    if expected_name and str(parsed["name"]) != expected_name:
        return (
            f"Frontmatter name '{parsed['name']}' does not match skill name "
            f"'{expected_name}'. The frontmatter name must match the 'name' parameter."
        )
RAW_BUFFERClick to expand / collapse

Summary

skill_manage(action="create", name="foo", content="---\nname: bar\n...") silently creates a skill whose directory is foo/ but whose skills_list display name is bar. The write path never validates that frontmatter name matches the name parameter.

Reproduction

skill_manage(
    action="create",
    name="local-paper-summarizer",
    content="---\nname: local-paper-summary\ndescription: ...\n---\n\nSteps..."
)
  • skills_list() shows local-paper-summary (frontmatter name, skills_tool.py:585)
  • skill_view("local-paper-summary")not found (directory-name lookup, skills_tool.py:969)
  • skill_manage(action="edit", name="local-paper-summarizer")found (directory-name lookup, skill_manager_tool.py:289)

Same divergence can be introduced via edit or patch.

Why this is different from #17914 / #18872 / #5433 / #7669

Those issues patch read-path symptoms (skill_view can't resolve frontmatter name, bundled skill misclassified, etc.). This is the write-path root cause_create_skill and _edit_skill allow inconsistent data to enter the system. Fixing read paths is necessary but insufficient: as long as the write path permits divergence, every new read-path consumer must independently handle the dual-namespace problem.

Root cause

  • _validate_frontmatter() (skill_manager_tool.py:240) only checks that a name field exists — no cross-check against the directory name
  • _create_skill() (skill_manager_tool.py:403) writes content verbatim
  • _edit_skill() (skill_manager_tool.py:446) same
  • _patch_skill() (skill_manager_tool.py:537) calls _validate_frontmatter without cross-check
  • Hub installs are unaffected (both names derive from the same SKILL.md)

Proposed fix

Add expected_name to _validate_frontmatter and wire it through _create_skill, _edit_skill, and _patch_skill:

def _validate_frontmatter(content: str, expected_name: str = None) -> Optional[str]:
    ...
    if expected_name and str(parsed["name"]) != expected_name:
        return (
            f"Frontmatter name '{parsed['name']}' does not match skill name "
            f"'{expected_name}'. The frontmatter name must match the 'name' parameter."
        )

Explicit rejection over silent auto-overwrite — the error message lets the agent self-correct.

Missing test coverage

tests/tools/test_skill_manager_tool.py:137 only covers "frontmatter name missing". Should add:

  • create with frontmatter namename param → fail
  • edit changing frontmatter name away from directory name → fail
  • patch altering name: to diverge from directory name → fail
  • create with frontmatter name == name param → succeed

Related

  • #17914 / #18872 — read-path: skill_view vs skills_list name mismatch
  • #5433 — read-path: bundled manifest vs frontmatter name causes misclassification
  • #7669 — read-path: _get_skill_type() vs _scan_skill_names() name mismatch

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING