Prompt Buddy logoPrompt Buddy

astro · Astro Docs

Content collections

Teaches how to use Astro Content Collections to organize, validate, and type-safe manage local Markdown or MDX content files using Zod schemas.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Content collections

Teaches how to use Astro Content Collections to organize, validate, and type-safe manage local Markdown or MDX content files using Zod schemas.

When To Use

Use when you need to implement type-safe content management for Markdown or MDX files in an Astro project using Zod for schema validation.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/collections-workflow-guide.mdA guide explaining how to manage structured content sets like blog posts and product descriptions using Astro content collections.Questions about a guide explaining how to manage structured content sets like blog posts and product descriptions using Astro content...
examples/collections-astro-collections-config.textA configuration example for defining content collection schemas in an Astro project.Exact payloads, commands, or snippets shown in A configuration example for defining content collection schemas in an Astro project.
examples/collections-astro-collections-definecollection-zod.textA code example demonstrating how to use defineCollection with loaders and Zod schemas to configure content collections in Astro.Exact payloads, commands, or snippets shown in A code example demonstrating how to use defineCollection with loaders and Zod schemas to configure content collection...
examples/collections-astro-collections-definecollection-glob-loader.textA TypeScript code example demonstrating how to define a content collection using the glob loader in Astro.Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to define a content collection using the glob loader in Astro.
examples/collections-astro-collections-markdown-frontmatter.textA markdown file demonstrating the use of frontmatter properties like title and slug within Astro content collections.Exact payloads, commands, or snippets shown in A markdown file demonstrating the use of frontmatter properties like title and slug within Astro content collections.
examples/collections-astro-collections-frontmatter.textA text example demonstrating frontmatter configuration for content collection entries including title, slug, and description fields.Exact payloads, commands, or snippets shown in A text example demonstrating frontmatter configuration for content collection entries including title, slug, and desc...
examples/collections-astro-collections-definecollection-loader-glob.textA code example demonstrating how to use the defineCollection function with a glob loader to retrieve JSON files in an Astro content collection.Exact payloads, commands, or snippets shown in A code example demonstrating how to use the defineCollection function with a glob loader to retrieve JSON files in an...
examples/collections-astro-collections-definecollection-loader.textA code example demonstrating how to use defineCollection with a file loader to set up content collections in Astro.Exact payloads, commands, or snippets shown in A code example demonstrating how to use defineCollection with a file loader to set up content collections in Astro.
examples/collections-astro-collections-id-property.textAn example demonstrating how to specify an id property within an array of objects for Astro content collections.Exact payloads, commands, or snippets shown in An example demonstrating how to specify an id property within an array of objects for Astro content collections.
examples/collections-astro-collections-config-2.textA text example demonstrating the configuration of a content collection schema using object definitions for dog breeds.Exact payloads, commands, or snippets shown in A text example demonstrating the configuration of a content collection schema using object definitions for dog breeds.
examples/collections-astro-collections-definecollection-csv-loader.textAn example demonstrating how to use the defineCollection function with a CSV file loader in Astro content collections.Exact payloads, commands, or snippets shown in An example demonstrating how to use the defineCollection function with a CSV file loader in Astro content collections.
examples/collections-astro-collections-config-3.textA text representation of a content collections configuration object showing schema definitions for dogs and cats.Exact payloads, commands, or snippets shown in A text representation of a content collections configuration object showing schema definitions for dogs and cats.
examples/collections-astro-collections-definecollection-loader-2.textA code example demonstrating how to use the defineCollection function with the file loader and a custom parser in Astro content collections.Exact payloads, commands, or snippets shown in A code example demonstrating how to use the defineCollection function with the file loader and a custom parser in Ast...
examples/collections-astro-collections-definecollection-loader-3.textA code example demonstrating how to use the defineCollection function with a custom loader in Astro content collections.Exact payloads, commands, or snippets shown in A code example demonstrating how to use the defineCollection function with a custom loader in Astro content collections.
examples/collections-astro-collections-definecollection-zod-2.textA code example demonstrating how to use defineCollection with glob and file loaders and Zod schema validation in Astro.Exact payloads, commands, or snippets shown in A code example demonstrating how to use defineCollection with glob and file loaders and Zod schema validation in Astro.
examples/collections-astro-collections-definecollection.textA code example demonstrating how to use defineCollection and Zod schemas to configure content collections in Astro.Exact payloads, commands, or snippets shown in A code example demonstrating how to use defineCollection and Zod schemas to configure content collections in Astro.
examples/collections-astro-collections-markdown-frontmatter-2.textA markdown file demonstrating frontmatter structure and local file references within Astro content collections.Exact payloads, commands, or snippets shown in A markdown file demonstrating frontmatter structure and local file references within Astro content collections.
examples/collections-astro-collections-getcollection-getentry-javascript.textA code snippet demonstrating how to use getCollection and getEntry functions to retrieve data from Astro content collections.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to use getCollection and getEntry functions to retrieve data from Astro content coll...
examples/collections-astro-collections-getcollection-javascript.textA code snippet demonstrating how to use the getCollection function to fetch and sort content from a collection in Astro.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to use the getCollection function to fetch and sort content from a collection in Astro.
examples/collections-astro-collections-getcollection.textAn example demonstrating how to use the getCollection function to fetch and render content collection entries in an Astro component.Exact payloads, commands, or snippets shown in An example demonstrating how to use the getCollection function to fetch and render content collection entries in an A...
examples/collections-astro-collections-getentry-render.textA code example demonstrating how to use getEntry and render from astro:content to fetch and display a specific content collection entry.Exact payloads, commands, or snippets shown in A code example demonstrating how to use getEntry and render from astro:content to fetch and display a specific conten...
examples/collections-astro-collections-collectionentry-props-typescript.textA TypeScript code snippet demonstrating how to use the CollectionEntry type to define component props for a content collection entry.Exact payloads, commands, or snippets shown in A TypeScript code snippet demonstrating how to use the CollectionEntry type to define component props for a content c...
examples/collections-astro-collections-filter-draft-entries.textA code example demonstrating how to use getCollection to filter out content entries where the draft property is set to true.Exact payloads, commands, or snippets shown in A code example demonstrating how to use getCollection to filter out content entries where the draft property is set t...
examples/collections-astro-collections-filter-draft-entries-2.textAn example demonstrating how to filter out content entries marked as drafts during a production build using getCollection.Exact payloads, commands, or snippets shown in An example demonstrating how to filter out content entries marked as drafts during a production build using getCollec...
examples/collections-astro-collections-filter-entries-by-subdirectory.textAn example demonstrating how to use the getCollection function to filter content collection entries by a specific subdirectory prefix.Exact payloads, commands, or snippets shown in An example demonstrating how to use the getCollection function to filter content collection entries by a specific sub...
examples/collections-astro-collections-getentry-getentries.textA code example demonstrating how to use getEntry and getEntries to query content collections and retrieve referenced items in Astro.Exact payloads, commands, or snippets shown in A code example demonstrating how to use getEntry and getEntries to query content collections and retrieve referenced...
examples/collections-astro-collections-getcollection-getstaticpaths.textAn example demonstrating how to use getCollection and getStaticPaths to generate dynamic routes for content collection entries in Astro.Exact payloads, commands, or snippets shown in An example demonstrating how to use getCollection and getStaticPaths to generate dynamic routes for content collectio...
examples/collections-astro-collections-getentry-server-request.textAn example demonstrating how to use getEntry to retrieve a content collection entry using a slug from a server-side request in Astro.Exact payloads, commands, or snippets shown in An example demonstrating how to use getEntry to retrieve a content collection entry using a slug from a server-side r...
examples/collections-astro-collections-define-live-collection.textA code example demonstrating how to use defineLiveCollection with a custom loader to access real-time data in Astro content collections.Exact payloads, commands, or snippets shown in A code example demonstrating how to use defineLiveCollection with a custom loader to access real-time data in Astro c...
examples/collections-astro-collections-define-live-collection-zod.textAn example demonstrating how to use defineLiveCollection with a custom loader and Zod schema validation in Astro.Exact payloads, commands, or snippets shown in An example demonstrating how to use defineLiveCollection with a custom loader and Zod schema validation in Astro.
examples/collections-astro-collections-getliveentry-typescript.textA TypeScript code example demonstrating how to use the getLiveEntry function to fetch and validate content collection entries in Astro.Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to use the getLiveEntry function to fetch and validate content collection...
examples/collections-astro-collections-getlivecollection-getliveentry.textAn example demonstrating the use of getLiveCollection and getLiveEntry functions within Astro content collections.Exact payloads, commands, or snippets shown in An example demonstrating the use of getLiveCollection and getLiveEntry functions within Astro content collections.
examples/collections-astro-collections-config-4.textA text example demonstrating the configuration and usage of content collections within an Astro project.Exact payloads, commands, or snippets shown in A text example demonstrating the configuration and usage of content collections within an Astro project.
examples/collections-astro-collections-getliveentry.textAn example demonstrating how to use the getLiveEntry function within Astro content collections to fetch dynamic entries.Exact payloads, commands, or snippets shown in An example demonstrating how to use the getLiveEntry function within Astro content collections to fetch dynamic entries.
examples/collections-astro-collections.textA markdown frontmatter example demonstrating the use of a JSON schema for validating content collection entries in Astro.Exact payloads, commands, or snippets shown in A markdown frontmatter example demonstrating the use of a JSON schema for validating content collection entries in As...
examples/collections-astro-collections-config-json-schemas.textA configuration snippet demonstrating how to define fileMatch patterns and schema URLs within the Astro content collections configuration.Exact payloads, commands, or snippets shown in A configuration snippet demonstrating how to define fileMatch patterns and schema URLs within the Astro content colle...
examples/collections-astro-collections-authors-yaml.textA YAML file demonstrating a content collection entry for authors including a schema reference and metadata.Exact payloads, commands, or snippets shown in A YAML file demonstrating a content collection entry for authors including a schema reference and metadata.
examples/collections-astro-collections-yaml-configuration.textA configuration snippet defining YAML schemas for content collections within an Astro project.Exact payloads, commands, or snippets shown in A configuration snippet defining YAML schemas for content collections within an Astro project.

What This Skill Covers

  • Added in: [email protected]
  • Main sections: What are Content Collections?, Types of collections, When to create a collection, When not to create a collection, TypeScript configuration for collections.

Workflow

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical source: https://docs.astro.build/en/guides/content-collections