Skip to content

Feature: opt-in .skillfollow to let discovery descend into declared first-level symlinks in the source #274

Closed

Description

@hhdebb

Problem

I keep a shared team skills repo under my normal projects directory (~/code/work/dev/dev-skills) and manage it with skillshare as a tracked repo. To get skillshare update (git pull) and edit-in-place behavior, the only option today is to move the real repo into the source:

~/.config/skillshare/skills/_dev-skills/   <- real repo
~/code/work/dev/dev-skills                 <- symlink back to it

That works, but it inverts where the repo lives. Tools that canonicalize the working directory (editors, agent CLIs, tmux-style session managers) all resolve the symlink and display the ~/.config/... path, so the repo effectively has two names and the one everybody types is the one nothing shows. I would much rather keep the repo where every other project lives and put the symlink in the source:

~/code/work/dev/dev-skills                 <- real repo
~/.config/skillshare/skills/_dev-skills    <- symlink to it

Today that makes the repo invisible: skillshare list finds nothing inside it.

Why it does not work today

internal/sync/discover_walk.go walks with filepath.Walk, which stats entries with Lstat. A symlinked directory reports IsDir() == false, so it is neither descended into nor treated as a directory — the entry is effectively absent from the walk. The same is true of the other source walks (internal/install/install_queries.go, internal/config/reconcile_core.go, cmd/skillshare/update.go, ...).

I do not think this is a bug. It reads as a deliberate boundary: the source root may be a symlink, but its contents belong to the user.

What already points the other way

The codebase already makes room for symlinks when the user clearly meant them:

  • The source root itself may be a symlink — utils.ResolveSymlink(sourcePath) before every walk, documented for dotfiles managers (stow/chezmoi/yadm) in website/docs/understand/source-and-targets.md and reference/commands/sync.md#dotfiles-manager-compatibility.
  • FindLocalSkills (internal/sync/pull.go) follows an external target symlink and scans the resolved directory rather than reporting a conflict.

My request is the same situation one level down: a symlink the user created on purpose, that they want treated as part of the source.

Proposal

An opt-in declaration file at the source root, symmetric with .skillignore:

# ~/.config/skillshare/skills/.skillfollow
# first-level directory symlinks that discovery may follow
_dev-skills
  • Entry names, never target paths, so the file stays portable — the symlink resolves to a different absolute path on each machine (macOS vs Windows), but the declaration is identical and can be committed.
  • A .skillfollow.local companion for machine-local additions, mirroring .skillignore.local.
  • Only first-level entries of the source root; symlinks inside a followed tree are not followed, so there is no unbounded recursion.
  • Targets must resolve to an existing directory; cycles (an entry resolving to the source root or an ancestor) are rejected.
  • Default behavior is unchanged. With no .skillfollow, an undeclared symlink stays invisible exactly as today.

Once the walk descends, everything else falls out for free: tracked-repo detection already probes .git with os.Stat (which follows symlinks), and skills are reported under their logical path (<source>/_dev-skills/<skill>) so the links sync writes still point through the source.

Scope

I have a working implementation. The shape is a small internal/skillfollow package (parser + filepath.Walk/WalkDir wrappers), with the wrappers swapped in at each source-root walk — one line per call site. Total upstream-file diff is ~26 insertions / 17 deletions across 11 files; the rest is the new package and tests.

Three call sites need slightly more than a one-line swap:

  • PruneOrphanLinksWithSkills and CheckStatusMerge decide "is this link ours?" with a prefix test against the source path. That still holds for absolute links, but relative links (shouldUseRelative) and Windows junctions are canonicalized at creation time, so a followed skill's link resolves outside the source and gets classified as external.
  • update --group / uninstall --group explicitly reject a group that resolves outside the source. Declared entries need to be exempt (undeclared ones stay rejected — the existing TestUninstallGroup_ExternalSymlinkRejected / TestUpdateGroup_ExternalSymlinkRejected still pass).

Known gaps I deliberately left out of a first cut, happy to discuss: internal/git/scope.go's nested-repo scan does not see a followed repo, there is no Web UI editor for .skillfollow (unlike .skillignore), and collect --force against a name that collides with a followed entry would RemoveAll the symlink rather than its target.

I also noticed while working on this that cmd/skillshare/update.go and cmd/skillshare/update_project.go walk sourcePath directly without utils.ResolveSymlink, unlike every other source walk — so update --all does not currently support a symlinked source root. Happy to split that out as a separate bug report if you prefer.

Next step

CONTRIBUTING says features go through an issue and then a proposals/ PR, with implementation handled by you. Glad to follow that — let me know if this is worth a proposal and I will write one up, and I can point at my branch as a reference implementation.

Activity

  1. self-assigned this
    on Sep 5, 2026
  2. added
    feature
    on Sep 19, 2026
  3. runkids commented on Sep 21, 2026

    @runkids
    Owner

    Thanks for the detailed write-up — the use case makes sense, and keeping the repo where your other projects live is a reasonable ask.

    Yes, please go ahead with a proposal. Feel free to link your branch as a reference.

    The .skillfollow file approach sounds right to me, since it lives with the source like .skillignore. A few things I'd like the proposal to cover:

    • Future-proofing: how we make sure new code that scans the source doesn't forget to follow declared entries (e.g. a test that catches it).
    • Link ownership: how prune/status decide a followed skill's link is ours, with test cases for relative links and Windows junctions.
    • Git operations: the nested-repo gap, since tracked-repo updates are the main point of this setup.

    Related: #253 and #206 ask for the same underlying thing from different angles — using skills that live outside the source without copying them. It'd be great if the proposal could note whether .skillfollow can serve as the common base for those too (e.g. install --link just creating the symlink + declaration).

    On the update --all symlinked source root: that looks already handled on current main, so no need for a separate report.

  4. added
    awaiting-reply
    on Sep 21, 2026
  5. star-nebula commented on Oct 1, 2026

    @star-nebula
    Contributor

    Windows data point that may change the shape of the follow-list, plus a confirmation of your
    "three call sites need more than a one-line swap" note.

    On Windows the link a user can actually create is a junction, not a symlink. Your own
    internal/sync/symlink_windows.go documents why: createLink falls back to
    createJunction (mklink /J) because directories need no privileges that way, while real
    symlinks need Developer Mode. So if .skillfollow makes discovery descend only into
    ModeSymlink entries, the feature is unreachable for Windows users in exactly the situation
    this issue describes — they cannot put the "back-link" into the source in the privileged form.

    Measured on 0.22.0 with an isolated config (src/plain is a real skill directory,
    src/_extrepo is a junction to an external repo holding 2 skills):

    $ skillshare sync --dry-run -g
    ✓ Discovered 1 skills          # the 2 skills behind the junction are invisible
    

    The code reason is one level below your filepath.Walk note: since Go 1.23 a junction reports
    ModeIrregular rather than ModeSymlink and not as a directory, which is precisely what
    internal/utils/link.go says when it justifies the extra reparse-tag read inside IsLinkMode.
    internal/sync/discover_walk.go then branches only on info.IsDir() (:168, :176, :187, :216)
    and on !info.IsDir() && info.Name() == "SKILL.md" (:234), so a junction satisfies neither and
    drops out of the walk silently — no skip notice, unlike .skillignore.

    Two suggestions that follow from that, if they are useful:

    1. Declare the followed entries and then test them with utils.IsLinkMode(path, info.Mode())
      rather than a symlink-only mode check, so one declaration file covers both link kinds.
    2. filepath.Walk will not descend into either kind, so the wrapper has to read the resolved
      directory itself — worth stating in the proposal, because it is where the recursion guard
      ("only first-level entries") actually has to live.

    On your known gap with PruneOrphanLinksWithSkills / CheckStatusMerge: agreed, and the same
    source-prefix heuristic misfires in the other direction too. Because the prefix test is the only
    ownership evidence the link branch uses, a junction that resolves under the source is treated as
    skillshare's own regardless of who created it — on my 12-target / 663-link setup one plain
    sync removed 140 links I had made by hand, and I have filed that separately as #314. If
    provenance came from manifest.Managed instead of the path prefix, both misclassifications
    disappear at once, which may be cheaper than special-casing followed entries in those two
    functions.

  6. salmonumbrella commented on Oct 3, 2026

    @salmonumbrella
    Contributor

    +1

  7. runkids commented on Oct 3, 2026

    @runkids
    Owner

    Thanks for the +1s and the detailed design. To move this forward, I wrote up a proposal based on @hhdebb's .skillfollow design and @star-nebula's Windows/provenance notes: #369 (proposals/274-skillfollow.md).

    It covers the three requirements from earlier in this thread:

    • Future-proofing: a single source walker plus a guard test that fails make check on any new raw walk of the source. Today there are 12 raw source walks. One of them, reconcileSkillsWalk, would silently delete metadata for followed skills if it were missed.
    • Link ownership: prune requires both manifest.Managed and a link that resolves into the source or a followed target. Relative links are created through the logical path, so sync stays idempotent.
    • Git: followed links get an anchored /_name ignore entry, because the current _name/ pattern doesn't match a symlink. commit/push refuse if the link isn't ignored. update --force is refused on a followed repo, since it would reset the user's own working copy.

    The proposal ends with open questions, including Windows junction read-back and whether followed single skills belong in phase 1. Feedback on the PR is welcome. Implementation starts once the design is agreed.

  8. salmonumbrella commented on Oct 3, 2026

    @salmonumbrella
    Contributor

    btw @hhdebb thanks for herdr radar. i submitted a PR yesterday, and saw you in skillshare today. small world!

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

    @runkids
    Owner

    This shipped in v0.25.0. Thank you @hhdebb for the design and @star-nebula for the Windows notes; both shaped what landed.

    Your repo can now stay where your other projects live:

    skillshare link ~/code/work/dev/dev-skills --enable
    skillshare sync

    It ended up as a single follow_source_links setting rather than a .skillfollow file, and skillshare link / unlink create and remove the link for you (on Windows too). The dashboard can do the same.

    Docs: link, follow_source_links.

    Closing this as completed. If anything doesn't work as expected, please open a new issue.

  11. removed
    awaiting-reply
    on Oct 6, 2026
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