Google Antigravity Directory

The #1 directory for Google Antigravity prompts, rules, workflows & MCP servers. Optimized for Gemini 3 agentic development.

Resources

PromptsMCP ServersAntigravity RulesGEMINI.md GuideBest Practices

Company

Submit PromptAntigravityAI.directory

Popular Prompts

Next.js 14 App RouterReact TypeScriptTypeScript AdvancedFastAPI GuideDocker Best Practices

Legal

Privacy PolicyTerms of ServiceContact Us
Featured on FazierFeatured on WayfindioAntigravity AI - Featured on Startup FameFeatured on Wired BusinessFeatured on Twelve ToolsListed on Turbo0Featured on findly.toolsFeatured on Aura++That App ShowAI ToolzShinyLaunchMillion Dot HomepageSolver ToolsFeatured on FazierFeatured on WayfindioAntigravity AI - Featured on Startup FameFeatured on Wired BusinessFeatured on Twelve ToolsListed on Turbo0Featured on findly.toolsFeatured on Aura++That App ShowAI ToolzShinyLaunchMillion Dot HomepageSolver Tools

© 2026 Antigravity AI Directory. All rights reserved.

The #1 directory for Google Antigravity IDE

This website is not affiliated with, endorsed by, or associated with Google LLC. "Google" and "Gemini" are trademarks of Google LLC.

Antigravity AI Directory
PromptsMCPBest PracticesUse CasesLearn
Home
Prompts
Astro Content Collections Patterns

Astro Content Collections Patterns

Master Astro content collections with type-safe content management for Google Antigravity IDE projects

AstroContent CollectionsTypeScriptStatic Site
by Antigravity AI
⭐0Stars
.antigravity
# Astro Content Collections Patterns for Google Antigravity IDE

Master type-safe content management with Astro's content collections system, leveraging Google Antigravity IDE's Gemini 3 AI for intelligent content organization, schema validation, and static site generation. This comprehensive guide covers everything from basic collection setup to advanced content relationships.

## Configuration Setup

```typescript
// src/content/config.ts
import { defineCollection, z, reference } from "astro:content";

// Blog posts collection with full schema
const blogCollection = defineCollection({
  type: "content",
  schema: ({ image }) => z.object({
    title: z.string().max(100),
    description: z.string().max(200),
    pubDate: z.coerce.date(),
    updatedDate: z.coerce.date().optional(),
    heroImage: image().refine((img) => img.width >= 1080, {
      message: "Cover image must be at least 1080px wide",
    }),
    author: reference("authors"),
    category: reference("categories"),
    tags: z.array(z.string()).default([]),
    draft: z.boolean().default(false),
    featured: z.boolean().default(false),
    readingTime: z.number().optional(),
  }),
});

// Authors collection for relationships
const authorsCollection = defineCollection({
  type: "data",
  schema: ({ image }) => z.object({
    name: z.string(),
    bio: z.string(),
    avatar: image(),
    social: z.object({
      twitter: z.string().url().optional(),
      github: z.string().url().optional(),
      linkedin: z.string().url().optional(),
    }).optional(),
  }),
});

// Categories with nested structure
const categoriesCollection = defineCollection({
  type: "data",
  schema: z.object({
    name: z.string(),
    slug: z.string(),
    description: z.string(),
    color: z.string().regex(/^#[0-9A-Fa-f]{6}$/),
    parent: reference("categories").optional(),
  }),
});

export const collections = {
  blog: blogCollection,
  authors: authorsCollection,
  categories: categoriesCollection,
};
```

## Querying Content Collections

```typescript
// src/pages/blog/[...slug].astro
---
import { getCollection, getEntry } from "astro:content";
import type { CollectionEntry } from "astro:content";
import BlogLayout from "../../layouts/BlogLayout.astro";

export async function getStaticPaths() {
  const posts = await getCollection("blog", ({ data }) => {
    return import.meta.env.PROD ? !data.draft : true;
  });

  return posts.map((post) => ({
    params: { slug: post.slug },
    props: { post },
  }));
}

interface Props {
  post: CollectionEntry<"blog">;
}

const { post } = Astro.props;
const { Content, headings, remarkPluginFrontmatter } = await post.render();

// Resolve references
const author = await getEntry(post.data.author);
const category = await getEntry(post.data.category);

// Get related posts
const allPosts = await getCollection("blog");
const relatedPosts = allPosts
  .filter((p) => 
    p.slug !== post.slug && 
    p.data.tags.some((tag) => post.data.tags.includes(tag))
  )
  .slice(0, 3);
---

<BlogLayout
  title={post.data.title}
  description={post.data.description}
  image={post.data.heroImage}
>
  <article>
    <header>
      <h1>{post.data.title}</h1>
      <div class="meta">
        <img src={author.data.avatar.src} alt={author.data.name} />
        <span>{author.data.name}</span>
        <time datetime={post.data.pubDate.toISOString()}>
          {post.data.pubDate.toLocaleDateString()}
        </time>
        <span>{remarkPluginFrontmatter.readingTime} min read</span>
      </div>
    </header>
    <Content />
  </article>
</BlogLayout>
```

## Best Practices for Google Antigravity IDE

When working with Astro content collections in Google Antigravity, let Gemini 3 assist with schema design by describing your content structure. Use strict TypeScript schemas for compile-time validation. Leverage image optimization with the built-in image helper. Create reference relationships between collections for normalized data. Implement draft filtering for production builds. Generate reading time and other computed properties with remark plugins. Use collection queries with filter functions for efficient content retrieval.

Google Antigravity's agent mode excels at generating content schemas based on your existing markdown files and suggesting optimizations for your content architecture.

When to Use This Prompt

This Astro prompt is ideal for developers working on:

  • Astro applications requiring modern best practices and optimal performance
  • Projects that need production-ready Astro code with proper error handling
  • Teams looking to standardize their astro development workflow
  • Developers wanting to learn industry-standard Astro patterns and techniques

By using this prompt, you can save hours of manual coding and ensure best practices are followed from the start. It's particularly valuable for teams looking to maintain consistency across their astro implementations.

How to Use

  1. Copy the prompt - Click the copy button above to copy the entire prompt to your clipboard
  2. Paste into your AI assistant - Use with Claude, ChatGPT, Cursor, or any AI coding tool
  3. Customize as needed - Adjust the prompt based on your specific requirements
  4. Review the output - Always review generated code for security and correctness
💡 Pro Tip: For best results, provide context about your project structure and any specific constraints or preferences you have.

Best Practices

  • ✓ Always review generated code for security vulnerabilities before deploying
  • ✓ Test the Astro code in a development environment first
  • ✓ Customize the prompt output to match your project's coding standards
  • ✓ Keep your AI assistant's context window in mind for complex requirements
  • ✓ Version control your prompts alongside your code for reproducibility

Frequently Asked Questions

Can I use this Astro prompt commercially?

Yes! All prompts on Antigravity AI Directory are free to use for both personal and commercial projects. No attribution required, though it's always appreciated.

Which AI assistants work best with this prompt?

This prompt works excellently with Claude, ChatGPT, Cursor, GitHub Copilot, and other modern AI coding assistants. For best results, use models with large context windows.

How do I customize this prompt for my specific needs?

You can modify the prompt by adding specific requirements, constraints, or preferences. For Astro projects, consider mentioning your framework version, coding style, and any specific libraries you're using.

Related Prompts

💬 Comments

Loading comments...