9.0 KiB
icon
| icon |
|---|
| lucide/braces |
Frontmatter Contract
This page defines the SKILL.md frontmatter and FastMCP metadata contract.
Prompt modules use the same contract style in docs/prompts/<prompt-id>/PROMPT.md with prompt-specific capability and MCP-aligned prompt argument metadata.
Validated Frontmatter Surface
The registry runtime validates a strict, standard-only frontmatter surface:
- Top-level fields accepted for skills:
name,description,x-personal-mcp. - Top-level fields accepted for prompts:
name,description,x-personal-mcp. - Unknown top-level fields are rejected during registry load.
Skill and prompt identifier rules:
nameis required, 1-64 chars, lowercase kebab-case, and must not containanthropicorclaude.descriptionis required, 1-1024 chars.x-personal-mcp.idmust exactly matchname.- Directory slug must exactly match
name.
Capability invariants:
- Skill capabilities must include
resource://skills/<skill-id>/document. - Prompt capabilities must include
resource://prompts/<prompt-id>/document.
Repository contract decisions:
- Treat
nameanddescriptionas required in allSKILL.mdfiles. - Keep only validated standard fields at top level.
- Keep MCP indexing metadata in a namespaced extension block.
- Reject unsupported optional top-level fields until explicit model support is added.
Reference specs:
Canonical Frontmatter Schema
Use this two-layer pattern:
- Anthropic layer: top-level fields intended for Anthropic and Agent Skills behavior.
- Repository layer: one namespaced block,
x-personal-mcp, for MCP catalog and routing metadata.
Canonical shape:
---
name: <skill-id>
description: <what this skill does and when to use it>
# Repository-specific metadata
x-personal-mcp:
id: <skill-id>
version: <semver>
tags:
- <tag>
capabilities:
- resource://skills/<skill-id>/document
# Optional: overrides and nested references only.
# Top-level references/*.md are auto-discovered.
references:
<ref-id>:
path: references/<file>.md
mime_type: text/markdown
title: <short title>
---
Repository Metadata Field Rules
Rules for x-personal-mcp:
idis required, must follow the skill id rules from the content contract, and must equal the directory name.versionis required and must be a semantic version string.tagsis optional and should be a list of kebab-case discovery labels.capabilitiesis required and lists the MCP URIs the skill publishes.referencesis an optional map keyed byref-idfor overrides and nested entries.
Prompt-specific additions:
argumentsis an optional map keyed by argument name.- Each argument supports optional
title, optionaldescription, and optionalrequired. - This aligns with MCP
PromptArgumentshape (name, optionaltitle, optionaldescription, optionalrequired) wherenameis represented by the map key. - Prompt
capabilitiesmust includeresource://prompts/<prompt-id>/document.
Example prompt frontmatter:
---
name: initial-test-structure
description: Generate a baseline pytest test layout for a target scope.
x-personal-mcp:
id: initial-test-structure
version: 1.0.0
tags:
- pytest
- testing
capabilities:
- resource://prompts/initial-test-structure/document
arguments:
target_scope:
title: Target scope
description: Target package or module under test.
required: true
---
Reference entry rules:
ref-idis lowercase kebab-case.pathis a skill-relative markdown path and must stay inside the same skill directory.- Top-level files under
references/*.mdare auto-discovered withref-idderived from a normalized filename stem (lowercase kebab-case). - Nested folders under
references/are not auto-discovered and must be declared explicitly. mime_typedefaults totext/markdownwhen omitted.titleis an optional display label.- Renaming
ref-idvalues is allowed when needed; optional aliases may be used during transitions.
Auto-Generated Reference IDs
Top-level markdown files directly under references/ are auto-registered as MCP references even when x-personal-mcp.references is empty.
How ref-id is derived:
- Start from the filename stem (without
.md). - Normalize to lowercase kebab-case.
- Publish at
resource://skills/<skill-id>/references/<ref-id>.
Examples:
references/ruff-docs.md->ref-id: ruff-docsreferences/Ruff Integrations.md->ref-id: ruff-integrationsreferences/python_logging_docs.md->ref-id: python-logging-docs
When to use explicit x-personal-mcp.references entries:
- The file is nested, for example
references/guides/ci.md. - You need to override defaults (
title,mime_type, or customref-id). - You need compatibility aliases during a rename.
Validation Models
The normative runtime model uses strict Pydantic v2 validation:
- Models are immutable (
frozen=True) and reject unknown fields (extra="forbid"). SkillFrontmatteraccepts onlyname,description, andx-personal-mcp.PromptFrontmatteraccepts onlyname,description, andx-personal-mcp.PromptArgumentEntryaccepts only optionaltitle, optionaldescription, and optionalrequired.- Skill and prompt metadata enforce semver, kebab-case ids, capability requirements, and id/name/directory consistency.
- Reference paths are validated as markdown files under
references/.
Validation behavior contract:
- Validate required core fields and relationships during registry load before FastMCP resource or tool registration.
- Reject unknown or unsupported fields at parse and model-validation time.
- Treat hard contract violations, including missing required fields, invalid ids, and broken required mappings, as startup errors.
- Keep failure messages path-aware and field-specific for CI readability.
Projection mode contract for Anthropic API upload pipelines:
- Parse with
SkillFrontmatterfirst. - Emit Anthropic-safe frontmatter with standard fields only.
- Preserve
x-personal-mcpin source-of-truth documents; projection output is a build artifact.
Anthropic Upload Compatibility Rule
- Anthropic documentation guarantees behavior for standard frontmatter fields but does not explicitly guarantee handling of arbitrary unknown top-level keys.
- Publishing pipelines that target strict API compatibility should support a projection mode that emits only standard frontmatter fields for upload.
- Source-of-truth authoring remains in
x-personal-mcp; upload payload shape is an explicit build concern.
FastMCP Native Metadata Surfaces
Resources support native definition metadata:
namedescriptionmime_typetagsannotations, includingreadOnlyHintandidempotentHinticonsmetaversionenabled, which is deprecated in FastMCP v3 in favor of server-level enable and disable controls
Resources also support runtime metadata through ResourceContent.meta and ResourceResult.meta.
Tools support native definition metadata:
namedescriptiontagsannotations, includingtitle,readOnlyHint,destructiveHint,idempotentHint, andopenWorldHinticonsmetaversiontimeoutoutput_schemarun_in_threadenabled, which is deprecated in FastMCP v3 in favor of server-level enable and disable controls
Tools also support runtime metadata through ToolResult.meta.
Frontmatter To FastMCP Mapping Contract
At server startup, map x-personal-mcp into FastMCP registration as follows:
x-personal-mcp.iddefines the canonical URI namespace and identity checks.descriptionbecomes the default description for the primary skill document resource.x-personal-mcp.tagsmaps to resource and tool tags.x-personal-mcp.versionmaps to resource and tool version metadata.x-personal-mcp.capabilitiesbecomes the registered URI list and catalog exposure.x-personal-mcp.references[*]becomes resource templates or concrete resources withmime_type, read-only annotations, andmetathat includesskill_id,ref_id, and sourcepath.
Invariants
This contract guarantees:
- Anthropic-required frontmatter stays valid for custom skill upload and Claude Code loading.
- MCP-specific metadata remains embedded in
SKILL.mdfrontmatter, with nometadata.yamlsidecar. - FastMCP registration uses native metadata fields for resources and tools.
- Reference ids and metadata can evolve with low-friction updates while internal file layout under
references/stays refactor-friendly.
Non-Goals
This contract does not define:
- URI versioning and deprecation rollout policy details.
- Migration script design from existing
metadata.yamlfiles. - Runtime caching and indexing performance tuning.