create-workflow
Skill16 starsChanged 5 months agoMITView on GitHub
Scaffold a new reusable workflow function in workflows/index.ts. Use when the user wants to "create a workflow", "add a workflow function", "make a reusable generation function", "extend the workflow library", or compose existing generators into a new pipeline.
6 other projects use a version of this.
Adopted by
Most recently taken up by
- NighmareGit/skunkworks-toolboxtheir own version, first seen Aug 13, 2026
- nextflow-io/agent-skillstheir own version, first seen Aug 5, 2026
- buildpad-ai/skillstheir own version, first seen Jul 19, 2026
- aictrl-dev/skillstheir own version, first seen Jul 15, 2026
- getlark/skillstheir own version, first seen May 18, 2026
- ZhixiangLuo/10xProductivitytheir own version, first seen Mar 25, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- ZhixiangLuo/10xProductivity★ 478same name
- nextflow-io/agent-skills★ 21same name
- aictrl-dev/skills★ 2same name
- buildpad-ai/skills★ 1same name
- getlark/skills★ 1same name
- NighmareGit/skunkworks-toolbox★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository21 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- analyze-videoSkill
- content-preflightSkill
- content-reviewSkill
- cost-guardSkill
- generate-brand-assetsSkill
- generate-imageSkill
- generate-musicSkill
- generate-videoSkill
- generate-voiceoverSkill
- localize-contentSkill
- onboard-brandSkill
- package-contentSkill
- plan-contentSkill
- preview-pickSkill
- produce-contentSkill
- qa-reviewSkill
- repurpose-contentSkill
- revise-contentSkill
- write-copySkill
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 2 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
Add a new reusable, agent-callable function to the workflow library (workflows/index.ts).
- Distinctive: line 37
Read one similar existing function end-to-end as your template:
- Distinctive: line 47
Before writing code, confirm:
- Very specific: line 68
Add an input + output interface.
- Very specific: line 89
Add the new types to the existing import type { … } from './types.js' block.
- Very specific: line 90
If you call a new low-level primitive, add it to the import { … } from '../gemini/dist/index.js' block (gemini25Flash, gemini31FlashImage, …
- Very specific: line 191
If tsc errors, fix types — do not ship a workflow that doesn't compile.
- Very specific: line 247
All primitives return { success, data, error } with data.cost.totalCost.
“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Create a Custom Workflow
Add a new reusable, agent-callable function to the workflow library
(workflows/index.ts). Every workflow takes a typed input and returns a
WorkflowResult<T> — it owns validation, retry, file saving, and cost reporting so
agents never rewrite that boilerplate.
Full reference:
workflows/CREATING_WORKFLOWS.md. This skill is the actionable, step-by-step version. Read the reference once before starting if you are unsure of the conventions.
When This Skill Activates
- "Create / add a new workflow"
- "Make a reusable function for generating X"
- "I keep rewriting this prompt+save code — turn it into a workflow"
- "Compose generateImage + generateVoiceover into one call"
STEP 1: Understand the Existing Library
Always do this first so the new function matches the house style and reuses helpers.
# See the 15 existing workflows + the Quick Reference table
sed -n '1,60p' workflows/WORKFLOWS.md
grep -n "export async function" workflows/index.tsRead one similar existing function end-to-end as your template:
- Single asset (prompt → one file): read
generateSingleImage - Audio: read
generateVoiceoverorgenerateMusicTrack - Multi-item loop (partial failure): read
generateCarousel - Composite (calls other workflows): see the worked example in
CREATING_WORKFLOWS.md
STEP 2: Ask the User the 4 Questions
Before writing code, confirm:
- What does it produce? (image / video / audio / text / a bundle of several)
- What inputs does the agent provide? (a raw
prompt? structured fields? atopicthe function expands itself?) - Where does the output go? (single
outputPath, or anoutputDirfor many files) - Build on what? A low-level gemini call, or compose existing workflows?
Map the answer to an input style:
| Input style | Use when | Example |
| Raw prompt | Agent writes the full prompt | generateSingleImage |
| Structured fields | Function templates the prompt from parts | generateSpeakingVideo |
| Auto-planning | Function calls gemini25Flash to write content itself | generateCarousel |
| Composite | Chain existing workflows | generateSocialBundle (in the guide) |
STEP 3: Define Types in workflows/types.ts
Add an input + output interface. Reuse the shared unions at the top of the file
(AspectRatio, ImageSize, VideoQuality, VoiceName, Platform, CostInfo) — do not
invent new string unions.
export interface <Name>Input {
prompt: string; // or topic / script / structured fields
outputPath: string; // or outputDir for multi-file
// ...optional params with sensible defaults
}
export interface <Name>Output {
// path(s) to what was created
cost: CostInfo; // REQUIRED on every output
}STEP 4: Write the Function in workflows/index.ts
- Add the new types to the existing
import type { … } from './types.js'block. - If you call a new low-level primitive, add it to the
import { … } from '../gemini/dist/index.js'block (gemini25Flash,gemini31FlashImage,generateVideo,textToSpeech,multiSpeakerTTS,generateMusic). - Append the function at the bottom with a numbered banner, following the 7-part skeleton:
// =============================================================================
// WORKFLOW <N>: <NAME>
// =============================================================================
/**
* <one-line purpose>
* Use for: <concrete use cases>
*/
export async function <name>(
input: <Name>Input
): Promise<WorkflowResult<<Name>Output>> {
// 1. VALIDATE — fail before spending tokens
if (!input.prompt?.trim()) {
return createErrorResult(WorkflowErrorCodes.INVALID_INPUT, 'Prompt is required');
}
if (!input.outputPath) {
return createErrorResult(WorkflowErrorCodes.INVALID_INPUT, 'Output path is required');
}
try {
// 2. PREPARE
ensureDir(path.dirname(input.outputPath));
// 3. GENERATE (always inside withRetry)
const result = await withRetry(
() => /* gemini primitive OR another workflow */,
{ maxRetries: 3 },
'<Name> generation'
);
// 4. CHECK
if (!result.success) {
return createErrorResult(
getErrorCode(new Error(result.error?.message)),
result.error?.message || '<Name> failed'
);
}
// 5. SAVE (wrap the write)
try {
fs.writeFileSync(input.outputPath, /* result bytes */);
} catch (writeError) {
return createErrorResult(
WorkflowErrorCodes.FILE_WRITE_ERROR,
`Failed to save: ${writeError instanceof Error ? writeError.message : 'Unknown error'}`
);
}
// 6. RETURN with cost
return {
success: true,
data: {
/* path(s) */,
cost: {
totalCost: result.data.cost.totalCost,
breakdown: { /* label */: result.data.cost.totalCost },
},
},
};
} catch (error) {
// 7. CATCH-ALL — never throw to the caller
const code = getErrorCode(error);
const message = error instanceof Error ? error.message : 'Unknown error';
console.error(`[Workflow] <name> failed: ${message}`);
return createErrorResult(code, message);
}
}Reuse these internal helpers (they live in index.ts, that's why the function goes
there): withRetry, ensureDir, createErrorResult, getErrorCode, validateImageFile,
getMimeType, getVeoModel, toVideoAspectRatio, sleep.
For multi-item loops (slides, clips): don't abort on first failure — collect successes,
track failures, return success: true with error.code = PARTIAL_FAILURE. Copy the loop in
generateCarousel.
STEP 5: Build
cd workflows && npm run buildtsc must compile clean (the fix-paths step rewrites the gemini import for dist/). Then
verify the export exists:
node --input-type=module -e "import('./dist/index.js').then(m=>console.log(typeof m.<name>))"
# expect: functionIf tsc errors, fix types — do not ship a workflow that doesn't compile.
STEP 6: Wire It Up So Agents Use It
A workflow nobody calls is dead code. Do both:
- Add a row to the Quick Reference table in
workflows/WORKFLOWS.md. - Point a skill/agent at it — find the relevant
SKILL.md(inskills/orworkflows/*-content/) or agent (agents/*.md) and replace any inline generation code with a call to the new function:
```typescript
import { <name> } from '../../../workflows/dist/index.js';
const result = await <name>({ /* inputs */ });
if (result.success) console.log('Saved:', /* path */, '— $' + result.data.cost.totalCost);
else console.error(result.error.code, result.error.message);
```STEP 7: Confirm With a Checklist
[ ] Input + Output interfaces in types.ts (reused shared unions)
[ ] Function follows the 7-part skeleton
[ ] Every API call wrapped in withRetry()
[ ] Never throws — all paths return WorkflowResult
[ ] Output includes cost: CostInfo
[ ] `cd workflows && npm run build` compiles clean
[ ] Export verified at runtime
[ ] A SKILL.md / agent now calls it
[ ] Added to WORKFLOWS.md Quick Reference tableReport to the user: the function name, its signature, what it builds on, and the file(s) you wired it into.
Composable Primitives (what to build on)
| Primitive | Produces | Import from |
gemini25Flash({ systemPrompt, userPrompt, imageInput? }) | text | ../gemini/dist/index.js |
gemini31FlashImage({ userPrompt, imageInput?, config }) | image | ../gemini/dist/index.js |
generateVideo({ model, prompt, referenceImage?, config }) | video | ../gemini/dist/index.js |
textToSpeech(text, voiceName, voiceSettings?) | audio | ../gemini/dist/index.js |
multiSpeakerTTS(text, speakers[]) | audio | ../gemini/dist/index.js |
generateMusic({ model, prompt, config }) | audio | ../gemini/dist/index.js |
| any existing workflow | varies | same file (compose directly) |
All primitives return { success, data, error } with data.cost.totalCost.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

