An agentic skills framework & software development methodology that works.
feat: create shared skills core module with frontmatter parser
Jesse Vincent85effaaedb35
diff --git a/lib/skills-core.js b/lib/skills-core.jsnew file mode 100644index 000000000..886294304--- /dev/null+++ b/lib/skills-core.js@@ -0,0 +1,54 @@+const fs = require('fs');++/**+ * Extract YAML frontmatter from a skill file.+ * Current format:+ * ---+ * name: skill-name+ * description: Use when [condition] - [what it does]+ * ---+ *+ * @param {string} filePath - Path to SKILL.md file+ * @returns {{name: string, description: string}}+ */+function extractFrontmatter(filePath) {+ try {+ const content = fs.readFileSync(filePath, 'utf8');+ const lines = content.split('\n');++ let inFrontmatter = false;+ let name = '';+ let description = '';++ for (const line of lines) {+ if (line.trim() === '---') {+ if (inFrontmatter) break;+ inFrontmatter = true;+ continue;+ }++ if (inFrontmatter) {+ const match = line.match(/^(\w+):\s*(.*)$/);+ if (match) {+ const [, key, value] = match;+ switch (key) {+ case 'name':+ name = value.trim();+ break;+ case 'description':+ description = value.trim();+ break;+ }+ }+ }+ }++ return { name, description };+ } catch (error) {+ return { name: '', description: '' };+ }+}++module.exports = {+ extractFrontmatter+};