Your AI agent skills, finally organized. A macOS app to browse, edit, and manage skills across Claude Code, Cursor, Codex, Windsurf, and Amp.
feat: Default new skill creation to Global with symlinks to all agents (#81)
Josh Pigford92ca74c8950f
diff --git a/Chops/Models/Skill.swift b/Chops/Models/Skill.swiftindex 95f5f37..6790de5 100644--- a/Chops/Models/Skill.swift+++ b/Chops/Models/Skill.swift@@ -209,17 +209,47 @@ final class Skill {}}+ private var linkedAgentSkillDirectories: [String] {+ guard isDirectory else { return [] }++ let fm = FileManager.default+ let skillDirectoryName = URL(fileURLWithPath: filePath)+ .deletingLastPathComponent()+ .lastPathComponent++ guard !skillDirectoryName.isEmpty else { return [] }++ let canonicalDirectories = Set(+ ([filePath] + installedPaths).map {+ URL(fileURLWithPath: $0)+ .deletingLastPathComponent()+ .resolvingSymlinksInPath()+ .path+ }+ )++ return AgentTarget.all.compactMap { agent in+ let candidate = "\(agent.expandedSkillsDir)/\(skillDirectoryName)"+ guard fm.fileExists(atPath: candidate) else { return nil }+ let resolvedCandidate = URL(fileURLWithPath: candidate)+ .resolvingSymlinksInPath()+ .path+ return canonicalDirectories.contains(resolvedCandidate) ? candidate : nil+ }+ }+var deletionTargets: [String] {- Array(- Set(- ([filePath] + installedPaths).map { path in- if isDirectory {- return (path as NSString).deletingLastPathComponent- }- return path+ var targets = Set(+ ([filePath] + installedPaths).map { path in+ if isDirectory {+ return (path as NSString).deletingLastPathComponent}- )- ).sorted()+ return path+ }+ )++ targets.formUnion(linkedAgentSkillDirectories)+ return Array(targets).sorted()}func deleteFromDisk() throws {diff --git a/Chops/Views/Shared/NewSkillSheet.swift b/Chops/Views/Shared/NewSkillSheet.swiftindex 35601a1..c2302be 100644--- a/Chops/Views/Shared/NewSkillSheet.swift+++ b/Chops/Views/Shared/NewSkillSheet.swift@@ -6,7 +6,7 @@ struct NewSkillSheet: View {@Environment(\.modelContext) private var modelContext@Environment(AppState.self) private var appState@State private var skillName = ""- @State private var selectedTool: ToolSource = .claude+ @State private var selectedTool: ToolSource = .agents@State private var errorMessage: String?private var itemKind: ItemKind { appState.newItemKind }@@ -14,7 +14,7 @@ struct NewSkillSheet: View {private var creatableTools: [ToolSource] {switch itemKind {case .skill:- return [.claude, .agents, .cursor, .codex, .amp, .opencode, .pi, .antigravity]+ return [.agents, .amp, .antigravity, .claude, .codex, .cursor, .opencode, .pi]case .agent:return ToolSource.allCases.filter { !$0.globalAgentPaths.isEmpty }case .rule:@@ -115,6 +115,8 @@ struct NewSkillSheet: View {try fm.createDirectory(atPath: basePath, withIntermediateDirectories: true)let filePath = "\(basePath)/\(fileName)"+ var installedPaths = [filePath]+ var toolSources = [selectedTool]guard !fm.fileExists(atPath: filePath) else {errorMessage = "A \(itemKind.singularName.lowercased()) with this name already exists"@@ -124,6 +126,20 @@ struct NewSkillSheet: View {let boilerplate = generateBoilerplate(name: skillName, skillID: sanitizedName, tool: selectedTool)try boilerplate.write(toFile: filePath, atomically: true, encoding: .utf8)+ // When creating a Global skill, symlink from each installed agent's skills dir+ if itemKind == .skill && selectedTool == .agents {+ for agent in AgentTarget.installed {+ let agentDir = "\(agent.expandedSkillsDir)/\(sanitizedName)"+ guard !fm.fileExists(atPath: agentDir) else { continue }+ try fm.createDirectory(atPath: agent.expandedSkillsDir, withIntermediateDirectories: true)+ try fm.createSymbolicLink(atPath: agentDir, withDestinationPath: basePath)+ installedPaths.append("\(agentDir)/SKILL.md")+ if let toolSource = ToolSource.allCases.first(where: { $0.globalPaths.contains(agent.expandedSkillsDir) }) {+ toolSources.append(toolSource)+ }+ }+ }+let parsed = FrontmatterParser.parse(boilerplate)let skill = Skill(filePath: filePath,@@ -139,6 +155,8 @@ struct NewSkillSheet: View {resolvedPath: filePath,kind: itemKind)+ skill.installedPaths = installedPaths+ skill.toolSources = toolSourcesmodelContext.insert(skill)try modelContext.save()@@ -177,7 +195,7 @@ struct NewSkillSheet: View {"""case .skill:switch tool {- case .claude, .cursor:+ case .claude, .cursor, .agents:return """---name: \(skillID)