MCPcopy
hub / github.com/Doorman11991/smallcode / add

Method add

src/plugins/skills.js:198–229  ·  view source on GitHub ↗
(name, content, options = {})

Source from the content-addressed store, hash-verified

196
197 // Create a new skill in the project's .smallcode/skills directory
198 add(name, content, options = {}) {
199 const dir = path.join(this.projectDir, '.smallcode', 'skills');
200 if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
201
202 const trigger = options.trigger || 'manual';
203 const keywords = options.keywords || [];
204
205 const frontmatter = [
206 '---',
207 `name: ${name}`,
208 `trigger: ${trigger}`,
209 keywords.length ? `keywords: [${keywords.join(', ')}]` : null,
210 '---',
211 ].filter(Boolean).join('\n');
212
213 const fullContent = `${frontmatter}\n${content}\n`;
214 const filename = `${name.replace(/[^a-z0-9-_]/gi, '-')}.md`;
215 const filePath = path.join(dir, filename);
216
217 fs.writeFileSync(filePath, fullContent);
218
219 const skill = {
220 name,
221 trigger,
222 keywords,
223 content,
224 path: filePath,
225 origin: 'flat',
226 };
227 this.skills.set(name, skill);
228 return skill;
229 }
230
231 // Remove a skill
232 remove(name) {

Callers 15

skills.test.jsFile · 0.80
recordReadMethod · 0.80
recordWriteMethod · 0.80
checkWriteMethod · 0.80
extractFromMessageFunction · 0.80
recordMethod · 0.80
redactValueFunction · 0.80
hostVariantsFunction · 0.80
hostVariantsFunction · 0.80
retrieveContextFunction · 0.80
validateSchemaOnlyFunction · 0.80
validateSchemaOnlyFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected