Skip to content

feat(sync): target_naming: prefixed so same-named skills from different tracked repos both stay usable #497

Closed

Description

@cescox

Hi! Thanks for skillshare. I track ~17 repos in one source and sync them to Claude Code, opencode, Gemini CLI, pi and hermes.

Problem. Two tracked repos that ship a skill with the same name: (in my source: prototype, from both emilkowalski/skills and mattpocock/skills) cannot both reach a tool:

  • flat keeps the folders apart, but every tool I tested lists skills by the SKILL.md name:. opencode 2.0.20 silently keeps one of the two.
  • standard excludes both (1 name collision(s) excluded), so neither arrives.

A second reason: a prefix tells the agent and the human where a skill comes from. Claude Code shows plugin skills as plugin:skill; nothing gives the other tools an equivalent.

Proposal. An opt-in third value, default unchanged:

targets:
  universal:
    skills:
      mode: copy
      target_naming: prefixed
  • For a skill inside a tracked repo, the target folder and the name: in the copy become <repo>-<name>, e.g. mattpocock-skills-prototype. The source is never touched, so git pull stays clean.
  • <repo> is the tracked repo dir without _, normalised to the spec charset; --name at install already gives a shorter prefix (--name mp → mp-prototype). No double prefix: _bmad + bmad-ux stays bmad-ux.
  • Skills outside tracked repos keep their name. Results go through skillpkg.ValidateName, so they always meet the spec; remaining collisions behave as in standard.
  • Copy mode only, the same rule extension follows, since the name is rewritten in the copy.

Happy to turn this into a proposals/ PR and to test a build against my setup.

How it fits existing features
Feature Effect
include / exclude, .skillignore, metadata.targets Unchanged: they match the source flat name.
projects:, project mode Work as-is: both accept target_naming.
Copy-mode manifest Unchanged: keys are target names, values the source checksum.
Switching an existing target to prefixed Needs the legacy-name migration (LegacyFlatNames, selectActiveTargetNameForSync, target_naming_migration.go) generalised beyond flat↔standard.
Targets sharing one folder sameSkillsSettings (internal/config/path_overlap.go) ignores target_naming today, so two targets sharing a folder with different naming would rewrite each other.
../sibling/ references in skill bodies Break as they already do under flat in copy mode. Optionally rewrite ../<sibling>/ for same-repo siblings in the copy.
Sketch and test cases (only to pin down the semantics)

A third branch in ResolveTargetSkillsForTarget, reusing the standard-mode collision handling:

// prefixedTargetName returns "<repo>-<name>" for skills inside a tracked repo,
// and the plain name otherwise. It never prefixes twice.
func prefixedTargetName(skill DiscoveredSkill, skillName string) string {
	if !skill.IsInRepo {
		return skillName
	}
	repo := normalizeSpecName(strings.TrimPrefix(filepath.Base(skill.RepoRelPath), "_"))
	if repo == "" || skillName == repo || strings.HasPrefix(skillName, repo+"-") {
		return skillName
	}
	return repo + "-" + skillName
}

Then skillpkg.ValidateName(target, target) instead of checking against the source dir, and in SyncTargetCopyWithSkillsOptions, after copyDirectoryWithIgnore, a line-based rewrite of name: in the copied SKILL.md (like ToggleFrontmatterFlag, so formatting survives).

Source name: Target
_emil-design/skills/prototype prototype emil-design-prototype
_mattpocock-skills/skills/engineering/prototype prototype mattpocock-skills-prototype
_bmad/skills/bmad-ux bmad-ux bmad-ux
my-skill (not tracked) my-skill my-skill
repo + name over 64 chars — skipped with a warning

Activity

  1. self-assigned this
    on Oct 8, 2026
  2. added
    feature
    on Oct 8, 2026
  3. runkids commented on Oct 8, 2026

    @runkids
    Owner

    Thanks for the detailed write-up. I checked it against the current code and against how other tools handle this, and I'd like to take prefixed.

    Your analysis holds. standard does drop both colliders (internal/sync/target_naming.go: every candidate whose name is in the collision set is skipped, and there is an integration test that asserts it). flat only warns. The symbols you named exist and do what you describe, and install --name mp does produce _mp, so the short-prefix story works.

    Two small corrections to the sketch:

    • normalizeSpecName doesn't exist yet; it needs to be written (lowercase, map anything outside [a-z0-9] to -, collapse --, trim -).
    • ToggleFrontmatterFlag only adds or removes a boolean flag, so rewriting name: needs a new string setter. The line-based approach is still the right model.

    Why prefixed and not the smaller alternative. I looked at how the tools resolve duplicate names. opencode, Goose and Amp keep one silently; pi and Gemini CLI keep the first and warn; Hermes errors on an ambiguous name. Only plugins get a namespace (plugin:skill), and that is composed at runtime, never written into name:, since the Agent Skills spec only allows a-z0-9- and requires name to match the directory. So <repo>-<name>, applied to both the folder and name:, is the spec-valid way to do this. Prefixing only the colliders would make a skill's name depend on what else is installed, so it can change the day another repo adds a same-named skill. A fixed rule is easier to reason about, and it also covers your provenance point.

    Planned scope:

    • target_naming: prefixed, opt-in, copy mode only (validation error otherwise, the same way extension behaves). This isn't a cut: a merge-mode symlink points at the source, so there is no copy whose name: could be rewritten.
    • The source skill is validated as in standard (name must match its folder), then the prefixed result is validated with skillpkg.ValidateName. Over-length names are skipped with a warning; collisions that remain after prefixing behave as in standard.
    • Switching between any two namings (flat, standard, prefixed) renames existing entries in place instead of leaving orphans. Today the migration only knows the flat name as the old name, so it needs generalising.
    • To make that reliable, the copy manifest (.skillshare-manifest.json) records which naming produced each entry. A switch then knows the old name exactly, and an entry whose naming changed is re-copied so its name: matches, even when the source is unchanged. Manifests written before this fall back to checking the flat, standard and prefixed names in turn.
    • ../sibling/ references are not rewritten, the same as flat in copy mode today. Rewriting markdown bodies is easy to get wrong, so I'd rather wait for a concrete case.

    Separately: you're right that sameSkillsSettings ignores target_naming. It also ignores mode. I reproduced it: two targets sharing one folder, one flat and one standard, only get the generic "targets share skill folders" hint, not the "each sync undoes the other" warning. They do fight, though: the flat target links frontend__dev, the standard target migrates it to dev, and the next sync prunes and links again. It's a bug independent of this feature, so I opened #498 and will fix it first.

    No need for a proposals/ PR; this issue covers it. I'll ping you here when it ships.

    One thing to be aware of for Claude Code: the prefixed name becomes the slash command, e.g. /mattpocock-skills-prototype, so --name is worth using when you want something shorter.

  4. cescox commented on Oct 8, 2026

    @cescox
    Author

    Thanks so much! Recording the naming in the manifest is more reliable than my "manifest unchanged".

    One thing to confirm: the no-double-prefix rule from the sketch stays (_bmad + bmad-ux → bmad-ux), and skills outside tracked repos keep their plain name?

    My universal target (~/.agents/skills) will move from merge + flat to copy + prefixed, so it'll exercise the flat → prefixed migration. Happy to test a build against it before release.

  5. reopened this on Oct 9, 2026
  6. runkids commented on Oct 10, 2026

    @runkids
    Owner

    Shipped in v0.25.4. To confirm both points:

    • No double prefix: yes. A name that already starts with the repo name is not prefixed again, so _bmad + bmad-ux stays bmad-ux.
    • Skills outside tracked repos: yes, they keep their plain (standard) name. The source is never changed; only the copy's folder and name: get the prefix.

    For your universal target, the switch is:

    skillshare upgrade
    skillshare target universal --mode copy --target-naming prefixed
    skillshare sync

    --mode and --target-naming are applied together in one command. Switching naming renames managed entries in place and re-copies them so name: matches. If a local skill already holds a new name, that skill stays under its old entry and skillshare diff reports it as Local only, skill kept under old name.

    Since you offered: running it against your real merge + flat setup would be the best check of the flat → prefixed migration. Please let me know how it goes.

  7. cescox commented on Oct 10, 2026

    @cescox
    Author

    Thanks so much, and for #498 too!

    I tried it on 0.25.4 against my real universal target (merge + flat → copy + prefixed, 46 skills: 40 from 6 tracked repos, 6 local). The migration went through cleanly: every entry was renamed in place with a matching name:, no double prefixes (last30days, playwright-cli), local skills kept their names, and my include/exclude patterns written for the old flat names still matched. gemini skills list shows the new names.

    One thing I hit: skillshare target universal --mode copy --target-naming prefixed rewrote config.yaml and dropped its comments. The values it wrote were right, but I keep a generated block between # BEGIN … / # END … comment markers, so losing them quietly broke a check of mine. I restored the file from git and set the two keys by hand. Would you consider keeping comments when the config is written? Happy to open a separate issue for it.

  8. runkids commented on Oct 11, 2026

    @runkids
    Owner

    Thanks for testing on your real target; that migration is the one I could not reproduce myself, so this confirms it.

    Dropped comments in config.yaml: confirmed, and it affects every command that writes the config, not just target. I'll fix it. Please open a separate issue for it; I'll link it from here and close this one.

  9. runkids commented on Oct 11, 2026

    @runkids
    Owner

    Tracking the comment loss in #525. Closing this one; prefixed shipped in v0.25.4.

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

Metadata

Metadata

Assignees

Labels

feature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions