frontmatter-schemas

Define and enforce Zod-based schemas for Astro content frontmatter.

9|Updated Oct 29, 2025
One-click install
npx skills add https://github.com/yebot/rad-cc-plugins --skill frontmatter-schemas
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frontmatter-schemas
Source: https://github.com/yebot/rad-cc-plugins/tree/main/plugins/astro-content-author/skills/frontmatter-schemas
Command: npx skills add https://github.com/yebot/rad-cc-plugins --skill frontmatter-schemas

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Defining and validating content structures for Astro projects can be complex, requiring careful schema design and consistent frontmatter. This skill provides ready-to-use Zod schema patterns and best practices, ensuring type-safe content and reducing validation errors.

Core Features & Use Cases

  • Pre-built Zod Schema Patterns: Access common schemas for blog posts, documentation, products, team members, and projects, accelerating content collection setup.
  • Comprehensive Validation Examples: Learn how to apply string, number, date, array, object, and enum validations to ensure data integrity.
  • Frontmatter Best Practices: Get guidance on structuring YAML/JSON frontmatter to perfectly match your defined schemas, preventing content authoring issues.

Quick Start

To create a Zod schema for a blog post, ask the skill to "Generate a Zod schema for an Astro blog post with title, description, pubDate, author, tags, and an optional image object."

Frequently Asked Questions about frontmatter-schemas

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

FAQPage Schema
How do I validate Astro frontmatter with Zod schemas?

Validate Astro frontmatter by defining Zod schemas with z.object, applying type coercion for dates and enums, and using defineCollection loaders to enforce structure. This ensures type-safe content and prevents validation errors during build time.

What fields should I include in a blog post schema?

Core blog post fields include title, description, pubDate, author, and tags. Add optional fields like image objects, categories, and SEO metadata. Zod schemas support defaults and optional values to handle both required and flexible frontmatter structures.

Can I use Zod to validate nested objects in Astro content?

Yes, Zod supports nested object validation through z.object schemas. Define nested structures for image metadata, contributor details, or media objects within your frontmatter, and Zod will validate the entire hierarchy.

Does this approach work for documentation, products, and team profiles?

Yes, Zod schema patterns apply across multiple content types: blog posts, documentation pages, product catalogs, and team member profiles. Each content type can define its own schema with specific fields, defaults, and validation rules.

What validation types does Zod support for frontmatter?

Zod supports string, number, date, array, object, and enum validations for frontmatter. Date coercion, array constraints, enum restrictions, and nested object validation ensure data integrity across all content structures.

Why should I use schema-based validation instead of manual frontmatter checks?

Schema-based validation with Zod prevents authoring errors at build time, enforces consistent data types, applies automatic type coercion, and generates TypeScript types automatically. This reduces validation errors and improves content pipeline reliability.