output-dev-workflow-function
Create workflow.ts files for Output SDK workflows. Use when defining workflow functions, orchestrating steps, or fixing workflow structure issues.
What this skill does
# Creating workflow.ts Files
## Overview
This skill documents how to create `workflow.ts` files for Output SDK workflows. The workflow file contains the main orchestration logic that coordinates step execution.
## When to Use This Skill
- Creating a new workflow's main definition
- Understanding workflow structure requirements
- Debugging workflow orchestration issues
- Refactoring existing workflow logic
## Critical Rules
### 1. Import Pattern
```typescript
// CORRECT - Import from @outputai/core
import { workflow, z } from '@outputai/core';
// WRONG - Never import z from zod
import { z } from 'zod';
```
### 2. ES Module Imports
All imports MUST use `.js` extension:
```typescript
// CORRECT
import { stepName } from './steps.js';
import { WorkflowInputSchema } from './types.js';
// WRONG - Missing .js extension
import { stepName } from './steps';
import { WorkflowInputSchema } from './types';
```
### 3. Determinism Requirement
**CRITICAL**: The workflow `fn` must be deterministic. No direct I/O operations are allowed in the workflow function.
```typescript
// WRONG - Direct I/O in workflow
export default workflow( {
// ...
fn: async input => {
const response = await fetch( 'https://api.example.com' ); // NEVER do this!
return response.json();
}
} );
// CORRECT - Delegate I/O to steps
export default workflow( {
// ...
fn: async input => {
const result = await fetchDataStep( input ); // Steps handle I/O
return result;
}
} );
```
**Related Skill**: `output-error-nondeterminism`
## Basic Structure
```typescript
import { workflow, z } from '@outputai/core';
import { stepOne, stepTwo } from './steps.js';
import { WorkflowInputSchema, WorkflowOutput } from './types.js';
export default workflow( {
name: 'workflowName',
description: 'Brief description of what the workflow does',
inputSchema: WorkflowInputSchema,
outputSchema: z.object( { /* output shape */ } ),
fn: async ( input ): Promise<WorkflowOutput> => {
// Orchestrate step calls
const result = await stepOne( input );
const final = await stepTwo( result );
return final;
}
} );
```
## Required Properties
### name (string)
Unique identifier for the workflow. Use camelCase.
```typescript
name: 'contentUtilsImageInfographicNano'
```
### description (string)
Human-readable description of the workflow's purpose.
```typescript
description: 'Generate high-quality infographic images using AI-powered ideation'
```
### inputSchema (Zod schema)
Schema for validating workflow input. Import from `types.ts`.
```typescript
inputSchema: WorkflowInputSchema
```
**Related Skill**: `output-dev-types-file`
### outputSchema (Zod schema)
Schema for validating workflow output.
```typescript
outputSchema: z.object( {
results: z.array( z.string() ),
metadata: z.object( {
processedAt: z.string()
} )
} )
```
### fn (async function)
The workflow execution function. Must be deterministic.
```typescript
fn: async ( input ): Promise<WorkflowOutput> => {
// Step orchestration only - no direct I/O
const result = await processStep( input );
return result;
}
```
## Complete Example
Based on a real workflow (`image_infographic_nano`):
```typescript
import { workflow, z } from '@outputai/core';
import {
generateImageIdeas,
generateImages,
validateReferenceImages
} from './steps.js';
import {
WorkflowInput,
WorkflowInputSchema,
WorkflowOutput
} from './types.js';
import { normalizeReferenceImageUrls } from './utils.js';
export default workflow( {
name: 'contentUtilsImageInfographicNano',
description: 'Generate high-quality infographic images using Google Gemini 3 Pro Image model with AI-powered ideation',
inputSchema: WorkflowInputSchema,
outputSchema: z.array( z.string() ),
fn: async ( rawInput: WorkflowInput ): Promise<WorkflowOutput> => {
// Pre-process input (pure function - OK in workflow)
const input = {
...rawInput,
referenceImageUrls: normalizeReferenceImageUrls( rawInput.referenceImageUrls )
};
// Conditional step execution
if ( input.referenceImageUrls && input.referenceImageUrls.length > 0 ) {
await validateReferenceImages( {
referenceImageUrls: input.referenceImageUrls as string[]
} );
}
// Sequential step execution
const ideas = await generateImageIdeas( {
content: input.content,
numberOfIdeas: input.numberOfIdeas,
colorPalette: input.colorPalette,
artDirection: input.artDirection
} );
// Parallel step execution
const generations = await Promise.all(
ideas.map( idea =>
generateImages( {
input: {
referenceImageUrls: input.referenceImageUrls,
aspectRatio: input.aspectRatio,
resolution: input.resolution,
numberOfGenerations: input.numberOfGenerations,
storageNamespace: input.storageNamespace
},
prompt: idea
} )
)
);
return generations.flat();
}
} );
```
## Orchestration Patterns
### Sequential Execution
Execute steps one after another:
```typescript
fn: async input => {
const step1Result = await stepOne( input );
const step2Result = await stepTwo( step1Result );
const step3Result = await stepThree( step2Result );
return step3Result;
}
```
### Parallel Execution
Execute independent steps concurrently:
```typescript
fn: async input => {
const [ resultA, resultB, resultC ] = await Promise.all( [
stepA( input ),
stepB( input ),
stepC( input )
] );
return { resultA, resultB, resultC };
}
```
### Conditional Execution
Execute steps based on conditions:
```typescript
fn: async input => {
if ( input.includeImages ) {
await processImages( input );
}
const result = input.mode === 'fast' ?
await quickProcess( input ) :
await detailedProcess( input );
return result;
}
```
### Fan-Out Pattern
Process multiple items in parallel:
```typescript
fn: async input => {
const results = await Promise.all(
input.items.map( item => processItem( { item } ) )
);
return { processedItems: results };
}
```
### Pipeline Pattern
Chain multiple transformations:
```typescript
fn: async input => {
const extracted = await extractData( input );
const transformed = await transformData( extracted );
const validated = await validateData( transformed );
const enriched = await enrichData( validated );
return enriched;
}
```
## What is Allowed in Workflow fn
### Allowed (Deterministic Operations)
- Calling step functions
- Pure data transformations
- Conditional logic based on input
- Array operations (map, filter, reduce)
- Object destructuring and construction
- Promise.all for parallel steps
- Control flow (if/else, loops)
### NOT Allowed (Non-Deterministic Operations)
- HTTP requests (use steps)
- Database queries (use steps)
- File system operations (use steps)
- Random number generation
- Current date/time access
- Environment variable access
- Any external service calls
## Verification Checklist
- [ ] `workflow` and `z` imported from `@outputai/core`
- [ ] All imports use `.js` extension
- [ ] Default export used for the workflow
- [ ] `name` is camelCase and unique
- [ ] `description` clearly explains the workflow
- [ ] `inputSchema` imported from `types.ts`
- [ ] `outputSchema` matches actual return type
- [ ] `fn` is deterministic (no direct I/O)
- [ ] All I/O delegated to step functions
- [ ] Code follows style conventions (see output-dev-code-style)
## Related Skills
- `output-dev-step-function` - Creating step functions that handle I/O
- `output-dev-evaluator-function` - Using steps in evaluator functions
- `output-dev-types-file` - Defining input/output schemas
- `output-dev-folder-structure` - Where workflow.ts belongs
- `output-error-nondeterminism` - Fixing determinism violations
- `output-error-zod-import` - Fixing schema import issues
- `output-dev-code-style`
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.