| name | gemini-blog |
| description | Configure or debug LLM blog post generation using Vercel AI SDK and Google Gemini. Use when updating blog generation prompts, fixing AI integration issues, modifying content generation logic, or working with structured output schemas. |
| allowed-tools | Read, Edit, Grep, Glob, Bash |
Gemini Blog Generation Skill
Blog generation package: packages/ai/
Architecture
packages/ai/
├── src/
│ ├── generate-post.ts # 2-step generation (analysis → structured output)
│ ├── config.ts # System instructions
│ ├── schemas.ts # Zod schemas (postSchema, highlightSchema)
│ ├── tags.ts # Tag constants (CARS_TAGS, COE_TAGS)
│ ├── hero-images.ts # Hero image URLs
│ └── save-post.ts # Post persistence with idempotency
2-Step Flow
- Step 1 (Analysis):
generateText() + Code Execution Tool + Extended Thinking → Accurate calculations
- Step 2 (Generation):
generateObject() + Zod schema → Type-safe structured output
Key Functions
import { generateBlogContent } from "@sgcarstrends/ai";
const { object } = await generateBlogContent({
data: tokenisedData,
month: "October 2024",
dataType: "cars",
});
Schemas
z.object({
title: z.string().max(100),
excerpt: z.string().max(500),
content: z.string(),
tags: z.array(z.string()).min(1).max(10),
highlights: z.array(highlightSchema),
});
z.object({
value: z.string(),
label: z.string(),
detail: z.string(),
});
Tag Constants
export const CARS_TAGS = ["Cars", "Registrations", "Fuel Types", "Market Trends", ...] as const;
export const COE_TAGS = ["COE", "Quota Premium", "1st Bidding Round", "PQP", ...] as const;
Updating Prompts
Edit packages/ai/src/config.ts:
ANALYSIS_INSTRUCTIONS: For calculation logic
GENERATION_INSTRUCTIONS: For output format
Debugging
Low Quality Output: Check Step 1 analysis logs, verify Code Execution Tool runs Python
Schema Validation Errors: Check Zod constraints (max lengths, array bounds)
API Errors: Verify GOOGLE_GENERATIVE_AI_API_KEY, check quota
Environment Variables
GOOGLE_GENERATIVE_AI_API_KEY=... # Required
LANGFUSE_PUBLIC_KEY=pk-lf-... # Optional telemetry
LANGFUSE_SECRET_KEY=sk-lf-...
Best Practices
- Always use 2-step flow: Separate analysis from generation
- Never skip Code Execution: Required for accurate calculations
- Use tag constants: Maintain vocabulary consistency
- Enable telemetry: Track costs and quality
References
packages/ai/CLAUDE.md for full package documentation
- Vercel AI SDK: Use Context7 for latest docs