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.

\n```\n\n## API Endpoint\n\n```typescript\n// src/pages/api/newsletter.ts\nimport type { APIRoute } from 'astro';\n\nexport const POST: APIRoute = async ({ request }) => {\n const { email } = await request.json();\n\n if (!email?.includes('@')) {\n return new Response(JSON.stringify({ error: 'Invalid email' }), { status: 400 });\n }\n\n try {\n await subscribeToNewsletter(email);\n return new Response(JSON.stringify({ success: true }), { status: 200 });\n } catch {\n return new Response(JSON.stringify({ error: 'Failed' }), { status: 500 });\n }\n};\n```\n\n## Best Practices\n\n1. **Content Collections**: Type-safe content with Zod\n2. **Islands**: Only hydrate interactive components\n3. **Client Directives**: client:visible, client:idle, client:load\n4. **Static Generation**: Pre-render at build time\n5. **Image Optimization**: Built-in image component\n6. **View Transitions**: Smooth page transitions\n\nGoogle Antigravity's Gemini 3 can generate Astro components and optimize hydration.","author":{"@type":"Person","name":"Antigravity Team"},"dateCreated":"2026-01-03T23:55:09.029973+00:00","keywords":"Astro, Static Site, JavaScript, Performance, SSG","programmingLanguage":"Antigravity AI Prompt","codeRepository":"https://antigravityai.directory"}
Antigravity AI Directory
PromptsMCPBest PracticesUse CasesLearn
Home
Prompts
Astro Content Site Patterns

Astro Content Site Patterns

Build blazing-fast static sites with Astro islands and content collections in Google Antigravity

AstroStatic SiteJavaScriptPerformanceSSG
by Antigravity Team
⭐0Stars
.antigravity
# Astro Content Site Patterns for Google Antigravity

Astro delivers high-performance static sites with partial hydration. This guide covers patterns optimized for Google Antigravity IDE and Gemini 3.

## Blog Post Page

```astro
---
// src/pages/blog/[slug].astro
import { getCollection } from 'astro:content';
import BaseLayout from '../../layouts/BaseLayout.astro';
import Comments from '../../components/Comments';

export async function getStaticPaths() {
  const posts = await getCollection('blog');
  return posts.map((post) => ({
    params: { slug: post.slug },
    props: { post },
  }));
}

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

<BaseLayout title={post.data.title}>
  <article class="max-w-4xl mx-auto px-4 py-8">
    <header class="mb-8">
      <h1 class="text-4xl font-bold mb-4">{post.data.title}</h1>
      <time datetime={post.data.publishedAt.toISOString()}>
        {post.data.publishedAt.toLocaleDateString()}
      </time>
    </header>
    <div class="prose prose-lg max-w-none">
      <Content />
    </div>
    <Comments client:visible postId={post.slug} />
  </article>
</BaseLayout>
```

## Content Collection Schema

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

const blogCollection = defineCollection({
  type: 'content',
  schema: z.object({
    title: z.string().max(100),
    excerpt: z.string().max(200),
    publishedAt: z.date(),
    author: z.object({ name: z.string(), avatar: z.string().url() }),
    tags: z.array(z.string()),
    draft: z.boolean().default(false),
  }),
});

export const collections = { blog: blogCollection };
```

## Island Architecture

```astro
---
// src/components/SearchDialog.astro
---

<div id="search-trigger" class="cursor-pointer">
  <button class="flex items-center gap-2 px-4 py-2 bg-gray-100 rounded-lg">
    <span class="text-gray-500">Search...</span>
    <kbd class="ml-auto px-2 py-0.5 bg-gray-200 rounded text-xs">⌘K</kbd>
  </button>
</div>

<div id="search-dialog"></div>

<script>
  const trigger = document.getElementById('search-trigger');
  let SearchModal: any = null;

  async function openSearch() {
    if (!SearchModal) {
      const module = await import('./SearchModal');
      SearchModal = module.default;
    }
    // Render modal...
  }

  trigger?.addEventListener('click', openSearch);
  document.addEventListener('keydown', (e) => {
    if ((e.metaKey || e.ctrlKey) && e.key === 'k') {
      e.preventDefault();
      openSearch();
    }
  });
</script>
```

## API Endpoint

```typescript
// src/pages/api/newsletter.ts
import type { APIRoute } from 'astro';

export const POST: APIRoute = async ({ request }) => {
  const { email } = await request.json();

  if (!email?.includes('@')) {
    return new Response(JSON.stringify({ error: 'Invalid email' }), { status: 400 });
  }

  try {
    await subscribeToNewsletter(email);
    return new Response(JSON.stringify({ success: true }), { status: 200 });
  } catch {
    return new Response(JSON.stringify({ error: 'Failed' }), { status: 500 });
  }
};
```

## Best Practices

1. **Content Collections**: Type-safe content with Zod
2. **Islands**: Only hydrate interactive components
3. **Client Directives**: client:visible, client:idle, client:load
4. **Static Generation**: Pre-render at build time
5. **Image Optimization**: Built-in image component
6. **View Transitions**: Smooth page transitions

Google Antigravity's Gemini 3 can generate Astro components and optimize hydration.

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...