Skip to content
Skills Library
Programming · Building & coding

astro-content

/astro-content

Use when managing structured content, blog posts, or typed data collections in Astro via the Content Layer API (content.config.ts).

Repository
agents ↗
Licence
MIT
Last repository change
12.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
9
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 12.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Use when managing structured content, blog posts, or typed data collections in Astro via the Content Layer API (content.config.ts).

Original author description

Use when managing structured content, blog posts, or typed data collections in Astro via the Content Layer API (content.config.ts).

How it works

  1. Agent Workflow (MANDATORY)
  2. Overview
  3. Core Concepts
  4. Reference Guide
  5. Best Practices
Original SKILL.md headings · 92 lines, 502 words
SKILL.md preview
---
name: astro-content
description: Use when managing structured content, blog posts, or typed data collections in Astro via the Content Layer API (content.config.ts).
versions:
  astro: 7
  zod: 4
user-invocable: true
references: references/overview.md, references/config.md, references/loaders.md, references/querying.md, references/rendering.md, references/mdx.md, references/templates/blog-collection.md, references/templates/custom-loader.md
related-skills: astro-7, astro-actions, astro-seo
---

<objective>
Implements Astro's Content Layer API: the `src/content.config.ts` config file, built-in `glob()` and `file()` loaders for local Markdown/MDX/JSON/YAML content, custom loaders for remote APIs/CMS/databases, Zod 4 schemas for type-safe frontmatter, and the query APIs `getCollection()`, `getEntry()`, and `render()` (which returns a `Content` component plus headings).

Also covers MDX authoring with Remark/Rehype plugins and the `astro sync` workflow for generating collection types. Does not cover form submission via Astro Actions (astro-actions) or SEO metadata generation from content (astro-seo) — those are handled by their own skills.
</objective>

# Astro Content Layer Expert

Type-safe content management with loaders, Zod schemas, and the unified Content Layer API.

## Agent Workflow (MANDATORY)

Before ANY implementation, spawn 3 agents in parallel, one `Agent` call each with a `name`:

1. **fuse-ai-pilot:explore-codebase** - Check existing collections, loaders, and content structure
2. **fuse-ai-pilot:research-expert** - Verify latest Content Layer docs via Context7/Exa
3. **mcp__context7__query-docs** - Get loader and schema examples

After implementation, run **fuse-ai-pilot:sniper** for validation.

---

## Overview

### When to Use

- Managing blog posts, docs, or product descriptions in Markdown/MDX
- Fetching content from a CMS, API, or database with type safety
- Needing TypeScript autocomplete for frontmatter fields
- Migrating from Astro 4 legacy content collections

### Why Content Layer API

| Feature | Benefit |
|---------|---------|
| `src/content.config.ts` | Single config file at project root |
| Built-in loaders | `glob()` and `file()` for local files |
| Custom loaders | Fetch from any external source |
| Zod 4 schemas | Full TypeScript type safety |
| `astro sync` | Generates types from collections |

---

## Core Concepts

### Config File Location

The config file moved from `src/content/config.ts` to `src/content.config.ts` in Astro 5+.

### Collection Types

| Loader | Use Case |
|--------|----------|
| `glob()` | Multiple files in a directory (MD, MDX, JSON, YAML) |
| `file()` | Single JSON/YAML file with multiple entries |
| Custom | Remote API, database, or any async data source |

### Key APIs

| API | Description |
|-----|-------------|
| `getCollection(name)` | Fetch all entries in a collection |
| `getEntry(name, id)` | Fetch a single entry by ID |
| `render(entry)` | Render a content entry to HTML + headings |
| `defineCollection()` | Define a collection with loader and schema |

---

## Reference Guide

| Need | Reference |
|------|-----------|
| Overview & concepts | [overview.md](references/overview.md) |
| Config file setup | [config.md](references/config.md) |
| Glob, file, custom loaders | [loaders.md](references/loaders.md) |
| getCollection / getEntry | [querying.md](references/querying.md) |
| render() + headings | [rendering.md](references/rendering.md) |
| MDX + Remark/Rehype | [mdx.md](references/mdx.md) |
| Blog collection example | [templates/blog-collection.md](references/templates/blog-collection.md) |
| Custom remote loader | [templates/custom-loader.md](references/templates/custom-loader.md) |

---

## Best Practices

1. **Always define schemas** — Never skip Zod validation
2. **Run `astro sync`** — After changing `content.config.ts`
3. **Use `glob()` for local files** — Supports MD, MDX, JSON, YAML, TOML
4. **Custom loaders for remote data** — CMS, REST API, GraphQL
5. **`render()` for MDX** — Returns `Content` component + headings array
Files in this package (9)
  • SKILL.md 4 KB
  • references/config.md 2 KB
  • references/loaders.md 2 KB
  • references/mdx.md 3 KB
  • references/overview.md 2 KB
  • references/querying.md 2 KB
  • references/rendering.md 2 KB
  • references/templates/blog-collection.md 2 KB
  • references/templates/custom-loader.md 2 KB

Versions

The database has no other skills named astro-content.

Database snapshot: 13.11.2026 · package version 24040d157a56 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 2 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100astro
    Astro 5+ knowledge base - Content Collections, Islands, SSG/SSR, integrations. Use when working on an Astro project, building static sites, or migrating from Next.js to Astro.
  • 100astro
    Builds Astro sites with islands, content collections, actions and server rendering. Use when editing .astro files, astro.config.mjs or src/content.config.ts, choosing client:* or server:defer, upgrading Astro, or cutting shipped JavaScript, including output mode, adapter and…
  • 90astro-modern
    Build and upgrade Astro content sites and applications with deliberate islands, content contracts and rendering modes. Use when implementing Astro pages, content collections or on-demand routes; avoid hydrating the entire page for small interactions.
  • 100astro
    Skill for building with the Astro web framework. Helps create Astro components and pages, configure SSR adapters, set up content collections, deploy static sites, and manage project structure and CLI commands. Use when the user needs to work with Astro, mentions .astro files,…
  • 90frontend-astro-architecture
    Use this skill when the user says 'Astro', 'Astro architecture', 'Astro islands', 'Astro component', 'Astro page', 'Astro content collection', 'Astro SSG', 'Astro SSR', '.astro file'. This skill enforces: zero-JS-by-default component model, island architecture with client:*…
  • 100astro
    Astro development standards and best practices for content-driven websites Triggers on: **/*.astro, **/*.ts, **/*.js, **/*.md, **/*.mdx

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.