Skip to content

fix: patch SKILL.md name: field when --prefix is used#686

Open
garagon wants to merge 1 commit intogarrytan:mainfrom
garagon:fix/setup-prefix-skill-name
Open

fix: patch SKILL.md name: field when --prefix is used#686
garagon wants to merge 1 commit intogarrytan:mainfrom
garagon:fix/setup-prefix-skill-name

Conversation

@garagon
Copy link
Copy Markdown

@garagon garagon commented Mar 30, 2026

Summary

./setup --prefix creates symlinks (gstack-qa → gstack/qa) but doesn't update the name: frontmatter field inside each SKILL.md. Claude Code uses name: for skill registration — so the skill registers as /qa instead of /gstack-qa, making the prefix mode non-functional.

After creating each symlink, setup now patches the name: field to match the linked name. Same fix applied to bin/gstack-relink for prefix changes after initial setup.

Root cause

link_claude_skill_dirs() reads name: from SKILL.md (line 279) and computes the correct link_name with prefix (line 282-288), but only uses it for the symlink target — the SKILL.md name: field stays unchanged. Claude Code ignores the symlink name and reads name: from frontmatter.

What changed

  • setup: after ln -snf, patches name: in SKILL.md when link_name != skill_name
  • bin/gstack-relink: same patch logic for prefix changes after setup

Uses portable sed (tmpfile + mv) — works on both macOS and Linux. No-op for unprefixed mode and already-prefixed skills (gstack-upgrade).

Verified

# Before (qa/SKILL.md):
name: qa          ← Claude registers as /qa

# After setup --prefix:
name: gstack-qa   ← Claude registers as /gstack-qa

Test plan

  • sed patch correctly rewrites name: qaname: gstack-qa
  • Already-prefixed skills (gstack-upgrade) are unaffected (link_name == skill_name)
  • Unprefixed mode (--no-prefix) does not trigger the patch
  • Switching prefix modes via gstack-relink patches in both directions

Fixes #620

`./setup --prefix` creates symlinks like `gstack-qa -> gstack/qa`, but
the SKILL.md inside still says `name: qa`. Claude Code uses the `name:`
frontmatter field for skill registration, not the symlink name — so the
skill registers as `/qa` instead of `/gstack-qa`.

After creating each symlink, patch the `name:` field in SKILL.md to match
the linked name. Uses portable sed (tmpfile + mv) for macOS/Linux compat.
The patch only applies when `link_name != skill_name`, so unprefixed mode
and already-prefixed skills (gstack-upgrade) are unaffected.

Same fix applied to `bin/gstack-relink` for prefix changes after setup.

Fixes garrytan#620
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