Automated summary
This skill diagnoses and fixes "incompatible schema" errors in Output SDK workflows that come from importing Zod from `zod` instead of `@output.ai/core`.
Strengths
- Clearly explains the root cause: two separate Zod instances are not interchangeable inside the SDK
- Provides the exact grep commands to locate every faulty import
- Includes a full before/after example on a workflow step
- Offers concrete prevention: an ESLint `no-restricted-imports` rule and a VS Code auto-import exclusion
Limitations
- Highly specific to Output SDK and `@output.ai/core`, not reusable elsewhere
- Only covers the wrong-import-source cause, not genuine schema shape mismatches
- Assumes terminal access to run grep and the build commands
Use it when an Output SDK workflow fails schema validation or step-boundary data passing with Zod type errors.
Skip it when the schema error stems from genuinely different data shapes or when the project does not use Output SDK.
Security analysis
SafeThe skill is purely instructional: it explains a Zod import mismatch and suggests grep-based searches, source edits, an ESLint rule, and standard build/run commands. There is no writing outside the project, no deletion, no credential handling, no curl|sh, and no instruction to bypass safety checks. Bash is declared but only used for read-only searches and conventional project builds, so listing it carries minimal risk.
- •Bash usage is limited to grep searches plus `npm run output:workflow:build` / `npx output workflow run` on the user's own project; no network exfiltration, no destructive commands, no obfuscation.
- •`npx output workflow run` could in principle resolve a package at invocation time if the CLI is not already installed locally - minor, standard dev-tool behavior.
Examples
My Output SDK workflow throws "Incompatible schema types" when I pass data between steps. Find the wrong Zod imports in src/ and fix them.Make sure no file in this Output SDK repo imports z from 'zod', and add an ESLint rule so nobody reintroduces it.A step in my Output SDK workflow fails with "Expected ZodObject but received..." — check whether the schema is imported from the wrong place.name: output-error-zod-import description: Fix Zod schema import issues in Output SDK workflows. Use when seeing "incompatible schema" errors, type errors at step boundaries, schema validation failures, or when schemas don't match between steps. allowed-tools: [Bash, Read]
Fix Zod Import Source Issues
Overview
This skill helps diagnose and fix a common issue where Zod schemas are imported from the wrong source. Output SDK requires schemas to be imported from @output.ai/core, not directly from zod.
When to Use This Skill
You're seeing:
- "incompatible schema" errors
- Type errors at step boundaries
- Schema validation failures when passing data between steps
- Errors mentioning Zod types not matching
- "Expected ZodObject but received..." errors
Root Cause
The issue occurs when you import z from zod instead of @output.ai/core. While both provide Zod schemas, they create different schema instances that aren't compatible with each other within the Output SDK context.
Why this matters: Output SDK uses a specific version of Zod internally for serialization and validation. When you use a different Zod instance, the schemas are technically different objects even if they define the same shape.
Symptoms
Error Messages
Error: Incompatible schema types
Error: Schema validation failed: expected compatible Zod instance
TypeError: Cannot read property 'parse' of undefined
Code Patterns That Cause This
// WRONG: Importing from 'zod' directly
import { z } from 'zod';
const inputSchema = z.object({
name: z.string(),
});
Solution
Step 1: Find All Zod Imports
Search your codebase for incorrect imports:
grep -r "from 'zod'" src/
grep -r 'from "zod"' src/
Step 2: Update Imports
Change all imports from:
// Wrong
import { z } from 'zod';
To:
// Correct
import { z } from '@output.ai/core';
Step 3: Verify No Direct Zod Dependencies
Check your imports don't accidentally use zod elsewhere:
grep -r "import.*zod" src/
All matches should show @output.ai/core, not zod.
Complete Example
Before (Wrong)
// src/workflows/my-workflow/steps/process.ts
import { z } from 'zod'; // Wrong!
import { step } from '@output.ai/core';
export const processStep = step({
name: 'processData',
inputSchema: z.object({
id: z.string(),
}),
outputSchema: z.object({
result: z.string(),
}),
fn: async (input) => {
return { result: `Processed ${input.id}` };
},
});
After (Correct)
// src/workflows/my-workflow/steps/process.ts
import { z, step } from '@output.ai/core'; // Correct!
export const processStep = step({
name: 'processData',
inputSchema: z.object({
id: z.string(),
}),
outputSchema: z.object({
result: z.string(),
}),
fn: async (input) => {
return { result: `Processed ${input.id}` };
},
});
Verification Steps
1. Check for remaining wrong imports
# Should return no results
grep -r "from 'zod'" src/
grep -r 'from "zod"' src/
2. Build the project
npm run output:workflow:build
3. Run the workflow
npx output workflow run <workflowName> '<input>'
Prevention
ESLint Rule (if using ESLint)
Add a rule to prevent direct zod imports:
// .eslintrc.js
module.exports = {
rules: {
'no-restricted-imports': ['error', {
paths: [{
name: 'zod',
message: "Import { z } from '@output.ai/core' instead of 'zod'"
}]
}]
}
};
IDE Settings
Configure your editor to auto-import from @output.ai/core:
For VS Code, add to settings.json:
{
"typescript.preferences.autoImportFileExcludePatterns": ["zod"]
}
Common Gotchas
Mixed Imports in Same File
Even one wrong import can cause issues:
import { z } from '@output.ai/core';
import { z as zod } from 'zod'; // This causes problems!
Indirect Dependencies
If a utility file uses the wrong import and is shared:
// utils/schemas.ts
import { z } from 'zod'; // Wrong! This affects all files using these schemas
export const idSchema = z.string().uuid();
Third-Party Libraries
If using external Zod schemas, you may need to recreate them:
// Don't use: externalLibrary.schema
// Instead: recreate the schema with @output.ai/core's z
Related Issues
- If schemas are correct but you still see type errors, check
output-error-missing-schemas - For validation failures with correct imports, verify schema definitions match actual data
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/fix-zod-schema-import-issues-mmbizjrt/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/fix-zod-schema-import-issues-mmbizjrt' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/fix-zod-schema-import-issues-mmbizjrt/download' --output '.skill-downloads/fix-zod-schema-import-issues-mmbizjrt/SKILL.md.part' && mv '.skill-downloads/fix-zod-schema-import-issues-mmbizjrt/SKILL.md.part' '.skill-downloads/fix-zod-schema-import-issues-mmbizjrt/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/fix-zod-schema-import-issues-mmbizjrt/SKILL.md' && test -s '.skill-downloads/fix-zod-schema-import-issues-mmbizjrt/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/output-error-zod-import' && cp -R '.skill-downloads/fix-zod-schema-import-issues-mmbizjrt' '.claude/skills/output-error-zod-import'Cursor
test -f '.skill-downloads/fix-zod-schema-import-issues-mmbizjrt/SKILL.md' && test -s '.skill-downloads/fix-zod-schema-import-issues-mmbizjrt/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/output-error-zod-import' && cp -R '.skill-downloads/fix-zod-schema-import-issues-mmbizjrt' '.cursor/skills/output-error-zod-import'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/fix-zod-schema-import-issues-mmbizjrt'openskills read 'fix-zod-schema-import-issues-mmbizjrt'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/fix-zod-schema-import-issues-mmbizjrt/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.