Complete content collections setup and management for Astro projects, including type-safe schemas, query patterns, frontmatter validation, and content organization.
/plugin marketplace add vanman2024/ai-dev-marketplace/plugin install website-builder@ai-dev-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
examples/blog-with-tags-example.mdexamples/documentation-site-example.mdexamples/portfolio-projects-example.mdscripts/generate-types.shscripts/query-builder.shscripts/setup-content-collections.shscripts/test-collections.shscripts/validate-frontmatter.shtemplates/python/collection-schema.pytemplates/python/query-patterns.pytemplates/queries/advanced-queries.tstemplates/queries/basic-queries.tstemplates/queries/filtered-queries.tstemplates/schemas/author-collection-schema.tstemplates/schemas/blog-collection-schema.tstemplates/schemas/docs-collection-schema.tstemplates/schemas/product-collection-schema.tstemplates/typescript/collection-helpers.tstemplates/typescript/content-types.tstemplates/validation/frontmatter-validator.jsComplete content collections setup and management for Astro projects, including type-safe schemas, query patterns, frontmatter validation, and content organization.
This skill provides comprehensive support for Astro content collections:
Run the setup script to initialize content collections in an Astro project:
bash scripts/setup-content-collections.sh [project-path]
This script:
src/content/config.ts if not existsUse schema templates to define type-safe collection schemas:
TypeScript Schema (Recommended):
# Read template for reference
Read: templates/schemas/blog-collection-schema.ts
Read: templates/schemas/docs-collection-schema.ts
Python Schema (for build scripts):
# For Python-based content generation
Read: templates/python/collection-schema.py
Generate TypeScript types from your collection schemas:
bash scripts/generate-types.sh [project-path]
This creates:
src/content/config.ts exports.astro/types.d.tsUse query builder patterns for type-safe content retrieval:
TypeScript Queries:
Read: templates/queries/basic-queries.ts
Read: templates/queries/advanced-queries.ts
Read: templates/queries/filtered-queries.ts
Python Queries (for build scripts):
Read: templates/python/query-patterns.py
Validate content frontmatter against schemas:
bash scripts/validate-frontmatter.sh [collection-name] [content-path]
This script:
Generate optimized query patterns:
bash scripts/query-builder.sh [collection-name] [query-type]
Query types:
all - Get all entriesfiltered - Filter by frontmatter fieldssorted - Sort by date/title/custom fieldpaginated - Paginate resultsrelated - Find related contentRun comprehensive collection tests:
bash scripts/test-collections.sh [project-path]
Tests include:
All scripts located in scripts/:
templates/typescript/)templates/python/)templates/schemas/)templates/queries/)templates/validation/)See comprehensive examples in examples/:
import { defineCollection, z } from 'astro:content';
const blogCollection = defineCollection({
schema: z.object({
title: z.string()
description: z.string()
pubDate: z.date()
updatedDate: z.date().optional()
heroImage: z.string().optional()
tags: z.array(z.string()).default([])
author: z.string()
draft: z.boolean().default(false)
})
});
export const collections = { blog: blogCollection };
import { getCollection, getEntry } from 'astro:content';
// Get all published blog posts
const posts = await getCollection('blog', ({ data }) => {
return data.draft !== true;
});
// Get single post by slug
const post = await getEntry('blog', 'my-post-slug');
// Sort by date descending
const sortedPosts = posts.sort((a, b) =>
b.data.pubDate.valueOf() - a.data.pubDate.valueOf()
);
import { z } from 'zod';
const blogSchema = z.object({
title: z.string().min(1, "Title required")
description: z.string().max(160, "Description too long")
pubDate: z.date()
});
// Validate frontmatter
const result = blogSchema.safeParse(frontmatter);
if (!result.success) {
console.error(result.error.format());
}
Schema Design:
Query Optimization:
Frontmatter Validation:
Content Organization:
Common issues and solutions documented in examples/error-handling.md:
mdx-integration - MDX component usage in contentimage-optimization - Image handling in contentseo-optimization - SEO for content collectionsstatic-generation - Static site generation patternsSkill Version: 1.0.0 Last Updated: 2025-10-28 Plugin: website-builder
Create employment contracts, offer letters, and HR policy documents following legal best practices. Use when drafting employment agreements, creating HR policies, or standardizing employment documentation.
Implement GDPR-compliant data handling with consent management, data subject rights, and privacy by design. Use when building systems that process EU personal data, implementing privacy controls, or conducting GDPR compliance reviews.