From outputai
Fixes Zod schema import issues in Output SDK workflows by replacing 'zod' imports with '@outputai/core'. Use for incompatible schema errors, type errors at step boundaries, and validation failures.
npx claudepluginhub growthxai/output --plugin outputaiThis skill is limited to using the following tools:
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 `@outputai/core`, not directly from `zod`.
Fixes missing inputSchema and outputSchema definitions in Output SDK steps to resolve type errors, undefined properties at boundaries, validation failures, and poor typing.
Provides Zod best practices for schema validation, type safety, parsing with safeParse, z.infer, and error handling in TypeScript apps. Use for z.object schemas, z.string validations.
Mandates invoking relevant skills via tools before any response in coding sessions. Covers access, priorities, and adaptations for Claude Code, Copilot CLI, Gemini CLI.
Share bugs, ideas, or general feedback.
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 @outputai/core, not directly from zod.
You're seeing:
The issue occurs when you import z from zod instead of @outputai/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.
Error: Incompatible schema types
Error: Schema validation failed: expected compatible Zod instance
TypeError: Cannot read property 'parse' of undefined
// WRONG: Importing from 'zod' directly
import { z } from 'zod';
const inputSchema = z.object({
name: z.string(),
});
Search your codebase for incorrect imports:
grep -r "from 'zod'" src/
grep -r 'from "zod"' src/
Change all imports from:
// Wrong
import { z } from 'zod';
To:
// Correct
import { z } from '@outputai/core';
Check your imports don't accidentally use zod elsewhere:
grep -r "import.*zod" src/
All matches should show @outputai/core, not zod.
// src/workflows/my-workflow/steps/process.ts
import { z } from 'zod'; // Wrong!
import { step } from '@outputai/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}` };
},
});
// src/workflows/my-workflow/steps/process.ts
import { z, step } from '@outputai/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}` };
},
});
# Should return no results
grep -r "from 'zod'" src/
grep -r 'from "zod"' src/
npm run output:worker:build
npx output workflow run <workflowName> '<input>'
Add a rule to prevent direct zod imports:
// .eslintrc.js
module.exports = {
rules: {
'no-restricted-imports': ['error', {
paths: [{
name: 'zod',
message: "Import { z } from '@outputai/core' instead of 'zod'"
}]
}]
}
};
Configure your editor to auto-import from @outputai/core:
For VS Code, add to settings.json:
{
"typescript.preferences.autoImportFileExcludePatterns": ["zod"]
}
Even one wrong import can cause issues:
import { z } from '@outputai/core';
import { z as zod } from 'zod'; // This causes problems!
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();
If using external Zod schemas, you may need to recreate them:
// Don't use: externalLibrary.schema
// Instead: recreate the schema with @outputai/core's z
output-error-missing-schemas