Skip to content

fix(setup): patch SKILL.md name: field when --prefix is used#630

Open
HMAKT99 wants to merge 1 commit intogarrytan:mainfrom
HMAKT99:arun/fix-prefix-skill-name
Open

fix(setup): patch SKILL.md name: field when --prefix is used#630
HMAKT99 wants to merge 1 commit intogarrytan:mainfrom
HMAKT99:arun/fix-prefix-skill-name

Conversation

@HMAKT99
Copy link
Copy Markdown
Contributor

@HMAKT99 HMAKT99 commented Mar 29, 2026

Summary

  • when --prefix creates gstack-qa, patch the name: field in SKILL.md to match
  • create a real directory (not symlink) with patched SKILL.md + symlinked subdirs
  • unprefixed skills still use plain symlinks (unchanged)

Problem

./setup --prefix creates symlinks correctly:

~/.claude/skills/gstack-qa -> gstack/qa/

But the name: field inside qa/SKILL.md still says name: qa. Claude Code uses the frontmatter name: for skill registration, not the directory name.

Result: gstack-upgrade works (its SKILL.md says name: gstack-upgrade). Every other prefixed skill doesn't register because name: qa doesn't match the gstack-qa directory.

Fix

When link_name != skill_name (prefix applied):

  1. Create a real directory instead of a symlink
  2. Symlink subdirs (templates/, references/) back to the original so relative paths resolve
  3. Write SKILL.md with sed "s/^name: $skill_name$/name: $link_name/" so the name: field matches

When link_name == skill_name (no prefix): plain symlink, unchanged.

+17/-1 in setup.

Verification

# Before fix:
head -2 ~/.claude/skills/gstack-qa/SKILL.md
  name: qa                    ← wrong

# After fix:
head -2 ~/.claude/skills/gstack-qa/SKILL.md
  name: gstack-qa             ← correct

# Subdirs still accessible through symlinks:
cat ~/.claude/skills/gstack-qa/templates/qa-report-template.md   ← works

Fixes #620.

./setup --prefix creates symlinks (gstack-qa -> gstack/qa/) but
the name: field inside SKILL.md still says "qa". Claude Code uses
the name: field from frontmatter for skill registration, not the
directory name. Result: prefixed skills don't register correctly.

Fix: when prefix changes the link name, create a real directory
instead of a symlink. Write a patched SKILL.md with the prefixed
name: field, and symlink all other contents (templates/, references/)
back to the original skill dir so relative paths still resolve.

Unprefixed skills (link_name == skill_name) still use plain symlinks.

Fixes garrytan#620.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/setup --prefix bug

1 participant