ai-structured-output
Generate type-safe AI content using Gemini structured output with Zod validation and Code Execution Tool. Use when building AI generation functions that need guaranteed output format.
npx skills add majiayu000/claude-skill-registry --skill ai-structured-output --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# AI Structured Output Patterns This skill documents patterns for generating type-safe, validated AI content using Google Gemini with Vercel AI SDK. ## When to Use This Skill - Generating structured content (blog posts, reports, summaries) with guaranteed format - Need type-safe LLM output with TypeScript inference - Preventing hallucinations in data analysis through code execution - Creating reusable AI generation functions for workflows - Building multi-step AI pipelines with separate analysis and generation phases ## Architecture Overview The recommended architecture uses a **2-step generation flow**: ``` Step 1: Analysis (Accuracy) Step 2: Structured Output (Presentation) ┌─────────────────────────────┐ ┌─────────────────────────────┐ │ generateText() │ │ generateObject() │ │ + Code Execution Tool │ ──▶ │ + Zod Schema │ │ + Extended Thinking │ │ + Field Descriptions │ │ = Accurate calculations │ │ = Type-safe output │ └─────────────────────────────┘ └─────────────────────────────┘ ``` **Why 2 steps?** - Step 1 focuses on **accuracy**: Code execution prevents calculation errors - Step 2 focuses on **format**: Zod schema ensures consistent structure - Separation allows optimisati
- When to Use This Skill
- Architecture Overview
- 2-Step Generation Implementation
- Complete Example
- Code Execution Tool
- Configuration
- Why It Matters
- When to Use
- Example: Data Analysis with Code Execution
- Extended Thinking Configuration
- Example: Selective Extended Thinking
- Zod Schema Design Patterns
- Field Descriptions
- Type Inference
What does the ai-structured-output skill do?
Generate type-safe AI content using Gemini structured output with Zod validation and Code Execution Tool. Use when building AI generation functions that need guaranteed output format.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill ai-structured-output --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
