YAML Frontmatter Parser
БесплатноБез исполняемых скриптовНе проверенParse and validate YAML frontmatter in markdown files for skills and agents
Об этом скилле
YAML Frontmatter Parser Skill
This skill provides expertise in parsing and validating YAML frontmatter from markdown files, specifically for Claude Code configuration files like skills and sub-agents.
What is YAML Frontmatter?
YAML frontmatter is metadata at the beginning of markdown files, enclosed in triple dashes:
---
name: my-skill
description: A useful skill
version: 1.0.0
author: Developer Name
---
# Skill Content
The rest of the markdown content...
Parsing YAML Frontmatter
Basic Parser Implementation
interface YAMLFrontmatter {
[key: string]: string | number | boolean | string[];
}
/**
* Extract YAML frontmatter from markdown content
*/
function extractFrontmatter(content: string): YAMLFrontmatter | null {
// Match YAML frontmatter pattern
const frontmatterRegex = /^---\s*\n([\s\S]*?)\n---\s*\n/;
const match = content.match(frontmatterRegex);
if (!match || !match[1]) {
return null;
}
const yamlContent = match[1];
return parseYAML(yamlContent);
}
/**
* Simple YAML parser for key-value pairs
* Note: This handles simple cases. For complex YAML, use a library like js-yaml
*/
function parseYAML(yaml: string): YAMLFrontmatter {
const result: YAMLFrontmatter = {};
const lines = yaml.split('\n');
for (const line of lines) {
// Skip empty lines and comments
if (!line.trim() || line.trim().startsWith('#')) {
continue;
}
// Parse key-value pair
const colonIndex = line.indexOf(':');
if (colonIndex === -1) {
continue;
}
const key = line.substring(0, colonIndex).trim();
let value: string | number | boolean = line.substring(colonIndex + 1).trim();
// Remove quotes
if ((value.startsWith('"') && value.endsWith('"')) ||
(value.startsWith("'") && value.endsWith("'"))) {
value = value.slice(1, -1);
}
// Parse booleans
if (value === 'true') value = true;
if (value === 'false') value = false;
// Parse numbers
if (!isNaN(Number(value)) && value !== '') {
value = Number(value);
}
result[key] = value;
}
return result;
}
Usage Example
import * as fs from 'fs/promises';
// Read markdown file
const content = await fs.readFile('skill.md', 'utf-8');
// Extract frontmatter
const frontmatter = extractFrontmatter(content);
if (frontmatter) {
console.log('Name:', frontmatter.name);
console.log('Description:', frontmatter.description);
console.log('Version:', frontmatter.version);
}
// Remove frontmatter to get body content
const body = content.replace(/^---\s*\n[\s\S]*?\n---\s*\n/, '');
Claude Code Configuration Schemas
Skill YAML Frontmatter
---
name: skill-name # Required: Skill identifier
description: Brief description # Required: One-line description
version: 1.0.0 # Optional: Semantic version
author: Author Name # Optional: Author information
tags: [tag1, tag2] # Optional: Categories/tags
dependencies: [other-skill] # Optional: Required skills
---
Validation:
interface SkillFrontmatter {
name: string;
description: string;
version?: string;
author?: string;
tags?: string[];
dependencies?: string[];
}
function validateSkillFrontmatter(fm: YAMLFrontmatter): SkillFrontmatter {
if (!fm.name || typeof fm.name !== 'string') {
throw new Error('Skill frontmatter must include "name" field');
}
if (!fm.description || typeof fm.description !== 'string') {
throw new Error('Skill frontmatter must include "description" field');
}
return {
name: fm.name,
description: fm.description,
version: fm.version as string | undefined,
author: fm.author as string | undefined,
tags: Array.isArray(fm.tags) ? fm.tags : undefined,
dependencies: Array.isArray(fm.dependencies) ? fm.dependencies : undefined,
};
}
Sub-Agent YAML Frontmatter
---
name: agent-name # Required: Agent identifier
color: blue # Optional: Icon color (red, blue, green, purple, yellow, orange)
description: Brief description # Optional: Agent purpose
model: sonnet # Optional: Preferred model
tools: [Read, Write, Bash] # Optional: Tool restrictions
---
Validation:
interface AgentFrontmatter {
name: string;
color?: 'red' | 'blue' | 'green' | 'purple' | 'yellow' | 'orange' | 'default';
description?: string;
model?: 'sonnet' | 'opus' | 'haiku';
tools?: string[];
}
function validateAgentFrontmatter(fm: YAMLFrontmatter): AgentFrontmatter {
if (!fm.name || typeof fm.name !== 'string') {
throw new Error('Agent frontmatter must include "name" field');
}
// Validate color
const validColors = ['red', 'blue', 'green', 'purple', 'yellow', 'orange', 'default'];
if (fm.color && !va
Установить YAML Frontmatter Parser в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл YAML Frontmatter Parser?
Parse and validate YAML frontmatter in markdown files for skills and agents
Как установить скилл YAML Frontmatter Parser?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл YAML Frontmatter Parser запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic