commands-frontmatter-adapter

Extract YAML frontmatter and body from Claude command files as JSON.

Updated Jan 10, 2025
One-click install
npx skills add https://github.com/hairihou/dotfiles --skill commands-frontmatter-adapter
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: commands-frontmatter-adapter
Source: https://github.com/hairihou/dotfiles/tree/main/src/.claude/skills/commands-frontmatter-adapter
Command: npx skills add https://github.com/hairihou/dotfiles --skill commands-frontmatter-adapter

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pyyaml, and includes scripts (resource) components.

What problem does it solve?

Extracts frontmatter and body from Claude-style command files so they can be used as prompts while exposing metadata as JSON.

Core Features & Use Cases

  • Frontmatter extraction from the first YAML block.
  • JSON-structured outputs that include file path, frontmatter, and body.
  • Multiple modes via --body-only, --frontmatter-only, or --raw-frontmatter.

Quick Start

Run the adapter for the diary command: ./adapter.py --command diary --pretty to get a JSON payload, or --body-only to paste the command body into your prompt.

Frequently Asked Questions about commands-frontmatter-adapter

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I extract frontmatter from Claude command files?

Frontmatter extraction reads the YAML block at the start of Claude-style command files and outputs it as structured JSON alongside the command body. Run the adapter with your command file to parse metadata and content separately for use in prompts.

Can I output just the command body without frontmatter?

Yes, the adapter supports multiple output modes. Use the --body-only flag to extract and output only the command body, which you can then paste directly into your prompt without metadata overhead.

What YAML parsing does this adapter support?

The adapter uses PyYAML's safe_load for secure YAML parsing with a fallback parser for edge cases. This ensures both standard YAML frontmatter and malformed blocks are handled gracefully.

How do I use Claude frontmatter with Codex CLI?

The adapter extracts frontmatter and body from files in src/.claude/commands, outputting JSON payloads that feed directly into Codex CLI prompts. Use --pretty to format output or specific flags like --frontmatter-only for metadata-only workflows.

Does this work with globally installed command files?

Yes, the adapter supports symlinked global installs alongside local files under src/.claude/commands, so you can parse both project-specific and system-wide command definitions.

What output formats does the adapter provide?

The adapter outputs JSON containing file path, frontmatter, frontmatter_raw, and body. You can request pretty-printed JSON, body-only, frontmatter-only, or raw frontmatter via command flags.