/genesys-cloud-architect:write-flowfrom genesys-cloud-architect
Writes and deploys Genesys Cloud Architect flows as TypeScript using the Architect Scripting SDK. Guides Claude to produce correct flow code that typechecks and deploys.
Ships in genesys-cloud-architect. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Create Genesys Cloud Architect flows as TypeScript, typecheck them, and deploy them via the deploy_flow MCP tool.
The user's project must have the Architect Scripting SDK installed for type checking:
npm install --save-dev purecloud-flow-scripting-api-sdk-javascript
If the user already has a flow file and just wants to deploy it, skip straight to step 5 — call the deploy_flow MCP tool with the file path. Only fall back to steps 1–4 if deployment fails or the user asks for help writing/fixing the flow.
Ask the user:
Only ask about queue names if the user's description involves queue transfers. Not every flow routes to a queue. When the user does name a queue, confirm it exists with the find_queue MCP tool before writing the flow, and use the exact queue name it returns in the transfer action.
Before writing any flow code, read these reference files from this skill:
references/sdk-patterns.md — core SDK patterns and the buildFlow contractreferences/gotchas.md — SDK quirks that cause silent failuresreferences/action-reference.md — available action typesreferences/expression-reference.md — expression language syntax, functions, operators, data types, and common patterns. Read this whenever the flow involves conditional logic, dynamic text, variable manipulation, date/time calculations, or any setExpression() / expression property usage.references/examples/:
bot-flow.md — bot flow with NLU intent detection, slot filling, and testingdigital-bot-flow.md — digital bot with menu, free-text fallback, and exitinbound-call.md — IVR with menus and queue transfersinbound-email.md — auto-reply and queue transferinbound-message.md — SMS auto-reply and queue transferworkflow.md — callback workflowWrite a TypeScript file in the user's project that exports a buildFlow function:
import type { ArchitectScripting } from "purecloud-flow-scripting-api-sdk-javascript";
export async function buildFlow(scripting: ArchitectScripting): Promise<void> {
const { archFactoryFlows, archFactoryActions } = scripting.factories;
const flow = await archFactoryFlows.createFlowInboundCallAsync(
"Flow Name",
"Flow Description",
);
// Build the flow...
await flow.checkInAsync();
}
Rules:
require() the SDK in the flow fileimport type from the SDK (stripped at runtime)flow.checkInAsync() at the end to save the flowRun the TypeScript compiler against the flow file directly (the user's project may not have a tsconfig.json):
npx tsc --noEmit --strict --moduleResolution bundler --module ES2022 --target ES2022 --allowImportingTsExtensions --skipLibCheck path/to/flow.ts
--skipLibCheck is required because the SDK's own types.d.ts has internal errors (duplicate identifiers, missing type references). Without it, tsc fails on the SDK — not on your flow code.
Fix any errors before deploying.
If the user has named the org they expect to deploy to (e.g. "deploy this to our dev org"), call the org_details MCP tool first and check that the connected org matches. If it doesn't, or you can't tell, stop and tell the user which org the server is connected to (name and shortName) instead of deploying. The server deploys to whichever org its OAuth client belongs to.
Use the deploy_flow MCP tool:
Tool: deploy_flow
Input: { "flowFile": "./path/to/flow.ts" }
The tool spawns an isolated process that:
buildFlow(scripting)The result is structured, not a log dump:
{
"status": "published",
"flowId": "…",
"flowName": "…",
"flowType": "bot",
"flowUrl": "https://apps.…/architect/#/bot/flows/…",
"replacedFlowId": "…",
"validation": { "errors": [], "warnings": [] },
"sdkVersion": "0.71.2",
"durationMs": 12345
}
status is published, checked_in, saved (created but still checked out — the flow file returned without calling checkInAsync/publishAsync) or failed.replacedFlowId is the id of a same-name flow the SDK deleted before creating this one (see "Re-creating Existing Flows" in references/sdk-patterns.md). When it is set, the flow id has changed — use the new flowId everywhere from now on. null means nothing was replaced.validation.errors and validation.warnings come from validateAsync() on the returned flow. Address errors before testing; warnings are usually safe to leave."verbose": true to include it.On failure the result starts with error (the runner's first error) and diagnosis (the SDK's own error lines, which usually name the object and the reason), followed by the same fields and the full log. Read error and diagnosis first; the SDK has three error channels (logging callback, TRACE lines, HTTP errors) and the deploy runner captures all of them into the log.
Bot flows — publish before testing: The deploy_flow tool checks in the flow but does not publish it (the result's status says which happened). To test a bot flow or digital bot flow with the test_bot_flow tool (step 6), the flow must be published first. Replace flow.checkInAsync() with flow.publishAsync() in the buildFlow function — do not call both, because checkInAsync releases the lock and publishAsync will fail with a 409:
return await flow.publishAsync();
After deploying and publishing a bot flow or digital bot flow, test it using the test_bot_flow MCP tool with the flowId from the deploy result (check that status is published first).
Start a session:
Tool: test_bot_flow
Input: { "flowId": "<flow-id-from-deploy>" }
The tool returns the bot's opening messages and a sessionId. Each turn includes nextActionType:
WaitForInput — the bot is waiting for a user messageDisconnect / Exit — the conversation has endedSend a message:
Tool: test_bot_flow
Input: { "sessionId": "<session-id>", "message": "Billing" }
Walk through the flow's conversation paths to verify the bot responds correctly. If the bot behaves unexpectedly, update the flow file, re-deploy, re-publish, and test again.
references/action-reference.md (opens in a new tab)references/examples/bot-flow.md (opens in a new tab)references/examples/digital-bot-flow.md (opens in a new tab)references/examples/inbound-call.md (opens in a new tab)references/examples/inbound-email.md (opens in a new tab)references/examples/inbound-message.md (opens in a new tab)references/examples/workflow.md (opens in a new tab)references/expression-reference.md (opens in a new tab)references/gotchas.md (opens in a new tab)references/sdk-patterns.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub makingchatbots/genesys-cloud-plugins --plugin genesys-cloud-architect5 skills in this plugin
/architect-diagramDraw a deployed Genesys Cloud Architect flow task as an image that looks like the Architect editor's own canvas (numbered action boxes with icons, branch pills under a bus, dashed rejoins, inline loops, "End of Flow" footers), with optional red highlights and tags on the actions being discussed, using the flow_diagram tool. Use when the user asks for a picture, image, screenshot-like diagram or PNG/SVG of a flow or task "like Architect" / "as it looks in the editor", wants a diagram that points at where a flow is broken, wants to show stakeholders where customers drop out or which path a conversation took, or wants a static base image for an animation of customers moving through a flow. For a quick text diagram that renders in GitHub markdown, use the flow-diagram skill (Mermaid) instead./architect-drawioThis skill should be used whenever a Genesys Cloud Architect flow, task, bot or IVR is wanted as a draw.io / diagrams.net diagram, a .drawio file, or "a canvas I can move boxes around" — "push it to draw.io", "open it in drawio", "editable Architect diagram", "make it look like Architect in draw.io" — for a deployed flow, a proposed change, or a fictional flow. Use it even when the user does not say "Architect" if the thing being drawn is a contact-centre flow and the destination is draw.io. It hand-writes draw.io XML that matches the Architect editor's canvas (numbered action boxes with a grey header, branch pills under a bus, dashed empty slots, End of Flow footers), with every box a separate movable shape. For a static PNG/SVG of that look use the architect-diagram skill's flow_diagram tool; for Mermaid in markdown use flow-diagram./flow-diagramThis skill should be used when the user asks to create a diagram, flowchart, flow visualization, dependency tree, architecture map, state machine, or pipeline view — including when they ask for an interactive, explorable, or pan-and-zoom diagram (this skill produces static diagrams and sets that expectation). Common trigger phrases include "visualize", "diagram", "flowchart", "graph", "map out", "show the flow", "draw the dependencies", "create a diagram". Produces Mermaid text; when the user wants an image that looks like the Architect editor's own canvas (a PNG or screenshot-like picture of a deployed flow, with a box highlighted), use the architect-diagram skill and its flow_diagram tool instead./interpret-flow-irUse when interpreting the JSON returned by the flow_ir, flow_action, search_in_flow, find_flow_execution, flow_execution_data or flow_versions tools, or when the user asks about a deployed Genesys Cloud Architect flow, including one named only by flow name (resolve with find_flow first) or a queue named only by queue name (resolve with find_queue first). Covers structural questions ("analyse this flow", "trace the path", "find dead logic", "does it loop"), semantic questions ("what does this decision check", "what does pressing 2 do"), search questions ("which actions reference this queue", "which use Flow.DNIS"), prompt questions ("what does the caller hear here", "what does Prompt.Welcome say"; resolve with get_prompts), execution questions about a real conversation or test run ("what did this conversation do", "why did the customer loop", "did the flow error", "is it working"), and publish-history questions ("when was this flow last published", "which version was live at 09:30", "what changed on the 5th"; resolve with flow_versions). Use it to answer control-flow questions from the IR rather than the raw configuration JSON, to find the actions worth inspecting, to fetch per-action settings the IR omits, and to read one run's execution data against the IR.Other plugins' skills for the same job