MCPcopy Create free account
hub / github.com/JordanCoin/codemap / runSkillInit

Function runSkillInit

cmd/skill.go:91–135  ·  view source on GitHub ↗
(root string)

Source from the content-addressed store, hash-verified

89}
90
91func runSkillInit(root string) {
92 skillsDir := root + "/.codemap/skills"
93 if err := os.MkdirAll(skillsDir, 0755); err != nil {
94 fmt.Fprintf(os.Stderr, "Error creating skills directory: %v\n", err)
95 os.Exit(1)
96 }
97
98 template := `---
99name: my-skill
100description: Describe when this skill should activate and what it does
101priority: 5
102keywords: ["keyword1", "keyword2"]
103languages: ["go"]
104---
105
106# My Skill
107
108Instructions for the AI agent when this skill is activated.
109
110## When to use
111
112Describe the situations where this skill applies.
113
114## Steps
115
1161. First step
1172. Second step
1183. Third step
119`
120
121 path := skillsDir + "/my-skill.md"
122 if _, err := os.Stat(path); err == nil {
123 fmt.Printf("Skill template already exists at %s\n", path)
124 return
125 }
126
127 if err := os.WriteFile(path, []byte(template), 0644); err != nil {
128 fmt.Fprintf(os.Stderr, "Error writing template: %v\n", err)
129 os.Exit(1)
130 }
131
132 fmt.Printf("Created skill template at %s\n", path)
133 fmt.Println("Edit the file to define your custom skill.")
134 fmt.Println("Run 'codemap skill list' to verify it loads.")
135}

Callers 1

RunSkillFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected