Skip to content

fix(skills): support skills belonging to multiple groups#64

Merged
EricFernandezPort merged 1 commit into
mainfrom
cursor/fix-skills-multi-group
May 19, 2026
Merged

fix(skills): support skills belonging to multiple groups#64
EricFernandezPort merged 1 commit into
mainfrom
cursor/fix-skills-multi-group

Conversation

@matanAlltra

Copy link
Copy Markdown
Collaborator

Summary

  • Bug: When a skill entity was listed in more than one group's relations.skills, the CLI stored only the last group encountered (last-write-wins on map[string]string), so port skills list showed the skill under only a single group.
  • Fix: Replace Skill.GroupID string with Skill.GroupIDs []string and propagate the change through parsing, filtering, writing, selection logic, and display.

Changes

Area What changed
Skill struct GroupID stringGroupIDs []string
ParseFetchedSkills skillGroupMap is now map[string][]string; each group ID is appended instead of overwriting
FilterSkills New anyGroupSelected() helper checks membership across all of a skill's groups
writeSkillsToTargets Writes SKILL.md (and all associated files) under every group directory the skill belongs to; reconciliation map covers all (groupID, skillID) pairs
isSkillSelected Iterates over all GroupIDs when matching against selected groups
AvailableUngroupedSkillsToAdd Uses len(s.GroupIDs) > 0 guard
port skills list Skill is bucketed into every group it belongs to, appearing under each group in the output
Tests All GroupIDGroupIDs; new TestWriteSkills_MultiGroupSkillWrittenToAllGroups and TestParseFetchedSkills_MultiGroupSkill directly cover the bug scenario

Test plan

  • go test ./internal/modules/skills/... ./internal/commands/... passes
  • go build ./... compiles cleanly
  • port skills list with a skill belonging to two groups shows it under both group headings
  • port skills sync with a multi-group skill writes SKILL.md under each group directory

Made with Cursor

Replace the single Skill.GroupID string field with GroupIDs []string so
a skill that appears in more than one group's relations is no longer
silently dropped to a single group (last-write-wins).

- ParseFetchedSkills: accumulates all group IDs per skill instead of
  overwriting; skillGroupMap is now map[string][]string
- FilterSkills: anyGroupSelected() checks membership across all GroupIDs
- writeSkillsToTargets: writes SKILL.md under every group directory the
  skill belongs to; reconciliation map covers all (groupID, skillID) pairs
- isSkillSelected / AvailableUngroupedSkillsToAdd: updated for []string
- port skills list: skill is bucketed into every group it belongs to, so
  it appears under each group in the CLI output
- Tests: all GroupID → GroupIDs, plus new TestWriteSkills_MultiGroupSkill
  and TestParseFetchedSkills_MultiGroupSkill covering the bug scenario

Co-authored-by: Cursor <cursoragent@cursor.com>
@matanAlltra matanAlltra reopened this May 19, 2026
@matanAlltra matanAlltra marked this pull request as ready for review May 19, 2026 08:57

@EricFernandezPort EricFernandezPort left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@EricFernandezPort EricFernandezPort merged commit 1139dbf into main May 19, 2026
8 checks passed
@EricFernandezPort EricFernandezPort deleted the cursor/fix-skills-multi-group branch May 19, 2026 09:21
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.

2 participants