/tray-workflows:tray-patternsfrom tray-workflows
Guides building Tray.io workflows with step-by-step mutations, version_id chaining, trigger configuration (including scheduled daily with day_of_week), callable workflows, and manual error handling patterns.
Ships in tray-workflows. 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.
None: SKILL.md is the whole skill.
Consult this when building workflows or debugging structure issues.
Workflows are built step-by-step, not as monolithic JSON:
create_workflow(project_id, workflow_name, trigger={...})
→ workflow_id + version_id
add_workflow_steps(workflow_id, version_id, steps=[{...}, {...}, ...])
→ new version_id
update_workflow_steps(workflow_id, new_version_id, steps=[{step_name, properties, ...}, ...])
→ newer version_id
CRITICAL: Version ID chaining — Every mutating tool returns a version_id. You MUST pass it to the next call. Stale version_ids cause API errors (which include the latest version_id for recovery).
For the canonical trigger connector table (names, versions, which triggers need public_url), see /tray-workflows:tray-connectors. The one trigger whose structure is worth codifying here is the scheduled daily operation — it has the richest required-field shape.
daily operation{
"public_url": {"type": "jsonpath", "value": "$.env.public_url"},
"hour": {"type": "string", "value": "9"},
"minute": {"type": "string", "value": "0"},
"tz": {"type": "string", "value": "Europe/London"},
"day_of_week": {
"type": "object",
"value": {
"monday": {"type": "boolean", "value": true},
"tuesday": {"type": "boolean", "value": true},
"wednesday": {"type": "boolean", "value": true},
"thursday": {"type": "boolean", "value": true},
"friday": {"type": "boolean", "value": true},
"saturday": {"type": "boolean", "value": true},
"sunday": {"type": "boolean", "value": true}
}
}
}
day_of_week must be explicit — always set all 7 days. Do not rely on defaults.
Trigger output uses zero-indexed month and day_of_week — January is 0, December is 11; Monday is 0, Sunday is 6. Branches that compare the trigger's day/month output against a literal day name will silently route wrong on production runs (the validator can't catch it because the jsonpaths are valid). For any date arithmetic prefer the Date Time Helper's Get Date Property operation over parsing the trigger payload directly.
When you call get_workflow (default view: "structure"), the returned JSON contains a structure array (the tree) and a steps index (per-step {name, connector, version, operation, title, auth_uuid}, no properties). Use view: "step" with step_names: [...] to fetch the full {name, properties, metadata} for specific steps. Understanding this structure helps when debugging or inspecting workflows.
Step execution order is determined by array position. Do NOT use "next" keys — they cause validation failure.
{"name": "script-1", "type": "normal", "content": {}}
{
"name": "boolean-condition-1",
"type": "branch",
"content": {
"true": [{"name": "script-1", "type": "normal", "content": {}}],
"false": [{"name": "terminate-1", "type": "normal", "content": {}}]
}
}
Two-step process:
Step 1 — Enable error handling on the step using error_handling: "manual" on the step entry passed to add_workflow_steps or update_workflow_steps. This creates a branch with empty paths:
{"name": "slack-1", "type": "branch", "content": {"error": [], "success": []}}
Step 2 — Move steps into the error/success paths using update_workflow_structure. Example: moving trigger-reply-1 into the error path:
{"name": "slack-1", "type": "branch", "content": {
"error": [{"name": "trigger-reply-1", "type": "normal", "content": {}}],
"success": []
}}
Steps inside error run when the step fails. Steps inside success run when it succeeds. Steps after the branch in the top-level array run regardless of which path was taken.
Inside an error path, reference the failure via $.errors.<failed-step-name>.<field>. Tray exposes the failed step's error context under $.errors, keyed by the step name that errored. The fields available under $.errors.<failed-step> mirror the failed step's output schema (in Tray's snake_case naming) — for an http-client failure, that's $.errors.http-client-1.message, $.errors.http-client-1.status_code, $.errors.http-client-1.headers, $.errors.http-client-1.response. The bare form $.errors.message does NOT resolve at runtime — Tray treats errors as a namespace and needs the failing step's name as the next segment. This is how Slack/email/log steps inside an error branch pull the actual error message; otherwise the alert renders blank.
_loop wrapper){
"name": "loop-1",
"type": "loop",
"content": {
"_loop": [
{"name": "script-1", "type": "normal", "content": {}},
{"name": "boolean-condition-1", "type": "branch", "content": {"true": [], "false": []}}
]
}
}
Common mistake: Using a direct array for loop content instead of {"_loop": [...]}.
Create in this order:
Store each workflow_id returned by create_workflow — needed for call-workflow steps.
Build jsonpaths from the actual output schema of the referenced step:
$.steps.<step-name>.<path-from-step-output-schema>
$.steps.loop-1.value.<field> — current loop iteration item
$.steps.call-workflow-1.response.<field> — callable workflow response
$.env.<variable> — environment variable
Field names with spaces or special characters use bracket-quoted segments. Plain dot syntax breaks on whitespace, hyphens, or non-ASCII — for those, switch to ['<key>'] notation. Examples: $.steps.trigger.body['Primary User Email'], $.steps.script-1.result['user-id'], $['My Variable']. Mix freely with dot syntax across a path. The same rule applies inside brace-interpolated strings: "text": {"type": "string", "value": "Hi {$.steps.trigger.body['First Name']}"}.
Every step-output jsonpath starts with $.steps.<step-name>. — including the trigger, which is always referenced as $.steps.trigger.<field>. Writing $.trigger.body.type (missing the .steps. prefix) builds and validates cleanly but resolves to undefined at runtime — every branch short-circuits silently. Top-level segments after $. are always one of: steps, env, config. Never write $.trigger.…, $.body.…, $.<connector>.…, etc. The build-time validator hard-rejects these (jsonpath_invalid_root).
Trigger envelopes come from outputSchema.properties. For the trigger step specifically, the segment immediately after $.steps.trigger. MUST be one of the keys declared in the trigger operation's outputSchema.properties. Confirmed envelopes: webhook → body, form-trigger → result, callable-trigger → data, agent-tool-trigger → tool_input / static_data. The validator rejects unknown envelope keys with "available keys: …" — do not flatten ($.steps.trigger.<field>) and do not invent new envelope keys. See /tray-workflows:tray-connectors for the canonical trigger table.
Different step types have different output shapes. Always check the referenced step's output structure rather than assuming a universal pattern. The call_connector tool response may wrap data differently than the workflow runtime — verify the runtime shape.
Use get_workflow to fetch current live workflow state. Default view: "structure" returns the tree + step index without properties — cheap and usually enough. Use view: "step" with step_names: [...] to fetch full {properties, metadata} for specific steps before editing.
To modify a step's properties, use update_workflow_steps with the complete properties object on the step entry (it replaces, not merges). Pass multiple entries to fix several steps in one round-trip.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub trayio/tray-plugins --plugin tray-workflows5 skills in this plugin
/build-workflowBuild or modify Tray workflows. Use this skill whenever the user asks to create, build, or modify a workflow — including requests like "build a workflow that...", "create a workflow to...", "set up an integration between...", "automate X", or "modify the workflow that...".
Examples of when this skill MUST be loaded:
- "Build a workflow that syncs Salesforce leads to Slack"
- "Create a scheduled job that sends a daily email report"
- "Set up an integration between HubSpot and Google Sheets"
- "Modify the existing lead scoring workflow to add error handling"
- "I have a Workato recipe — can you recreate it in Tray?"
This skill is the entry point for ALL workflow creation and modification. Load it BEFORE making any create_workflow, add_workflow_steps, or update_workflow_steps calls.
/research-connectorSystematic process for researching unknown Tray connectors via DDL discovery/tray-connectorsLoad when adding workflow steps, picking a trigger, or wrapping step properties — covers core connector names and versions (including the non-obvious `noop`/`scheduled`/`callable-trigger` trigger names), the type-wrapper format, connector-name-only step naming, and common jsonpath shapes (loop `value`, callable `response`)./tray-gotchasLoad when debugging a Tray workflow error or working with known-weird surfaces — `raw_http_request` input format, `has_dynamic_output` rules, `trigger-reply`'s empty inputSchema, callable workflow sync/async pairing, jsonpath output-shape differences across step types, scheduled-trigger `day_of_week` explicit-keys rule, Salesforce custom (`*__c`) field picklist values, and stale `version_id` recovery.Other plugins' skills for the same job