Skill frontmatter gray matter
Skill kjuhwa/skills-hub/skills/agent-sdk/skill-frontmatter-gray-matter
Store Claude-style Agent Skills as SKILL.md with YAML frontmatter (name, description, icon, requiredSources) parsed with gray-matter and a normalization pass that accepts both string and array values.From its SKILL.md
npx -y skills add kjuhwa/skills-hub --skill skill-frontmatter-gray-matterAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.1 KB, 598 tokens by cl100k_base, as published. Nobody here has run it
Skill frontmatter + gray-matter parse
When to use
- App that lets users define agent skills (snippets of reusable instructions) as Markdown files.
- Need a tiny metadata header (name, description, maybe icon / required sources) without adopting a heavyweight schema.
- Want it readable/editable in any text editor.
How it works
- Each skill is a directory with a
SKILL.md:skills/ build-release-notes/ SKILL.md scripts/helper.py (optional resources) SKILL.mdstarts with a YAML frontmatter block:--- name: build-release-notes description: Generate release notes from git log icon: 📝 requiredSources: [github] ---- Parse with
gray-matter:import matter from 'gray-matter'; const { data, content } = matter(fileContent); - Validate required fields (
name,description) - returnnullrather than throw so the loader can skip malformed skills without breaking the UI. - Normalize flexible fields -
requiredSourcesmay be a string OR array; coerce to deduped array:const normalized = typeof v === 'string' ? [v] : Array.isArray(v) ? v : []; - Validate the icon field (emoji or URL only, reject inline SVG and relative paths) to keep skill rendering safe.
- Global vs project skills: look in both
~/.agents/skills/(global) and<workspace>/.agents/skills/(project), merge with workspace precedence.
Example
import matter from 'gray-matter';
function parseSkillFile(content: string) {
const parsed = matter(content);
if (!parsed.data.name || !parsed.data.description) return null;
return {
metadata: {
name: String(parsed.data.name),
description: String(parsed.data.description),
icon: validateIconValue(parsed.data.icon),
requiredSources: normalizeRequiredSources(parsed.data.requiredSources),
},
body: parsed.content.trim(),
};
}
Gotchas
gray-mattercaches by filename by default; pass{ bustCache: true }if you re-read during hot-reload, or disable caching when developing.- Don't trust user-supplied
icon- validate emoji / URL explicitly; inline SVG opens XSS if rendered naively. - YAML booleans (
yes,no,on,off) can accidentally coercename: on->true. Always cast toString(data.name). - Keep the set of accepted frontmatter fields stable and versioned - adding one is easy, renaming is data migration.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.