Skip to content
Back to skills

Flow Builder

ASecurity

Build, edit or debug an OpenAlgo Flow workflow - the no-code node graph at /flow. Use when asked to create a workflow, wire a webhook or TradingView alert to an order, add a node, port a strategy into Flow, or work out why a workflow imported but did nothing. Produces a workflow JSON that is validated against the real importer before it is handed over.

  • 52 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 7, 2026
developmentpythongobashsqlnodetestingapi

Works with

  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 24, 2026

npx -y skills add marketcalls/openalgo-desktop --skill flow-builder --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Flow Builder?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Flow Builder
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/marketcalls-flow-builder/badge)](https://www.skillsdirectory.com/skills/marketcalls-flow-builder)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: flow-builder
description: Build, edit or debug an OpenAlgo Flow workflow - the no-code node graph at /flow. Use when asked to create a workflow, wire a webhook or TradingView alert to an order, add a node, port a strategy into Flow, or work out why a workflow imported but did nothing. Produces a workflow JSON that is validated against the real importer before it is handed over.
---

# Building an OpenAlgo Flow workflow

A workflow is a JSON graph: `nodes` (what happens) plus `edges` (in what order).
It is imported at `/flow`, or written straight into `flow_workflows`.

## Desktop: where this differs from the web skill

This skill is the web repository's `flow-builder` skill, carried over for
OpenAlgo Desktop. The desktop runs Flow natively, with no Python, and imports,
stores and exports the web's workflow JSON unchanged, so the shape, the node
table and the traps below apply as written. What differs:

- **Validating.** There is no Python here, so `validate.py` is not carried.
  Its two layers (the importer's own validator, then the unread-key and
  dangling-reference warnings) run as a test against the desktop's validator,
  from `src-tauri`:
  `FLOW_WORKFLOW=/absolute/path/workflow.json cargo test --locked --lib flow_builder::check_the_workflow_file -- --ignored --nocapture`.
  It prints the same `ERROR` and `WARNING` lines and the same verdict, and
  fails when the workflow would not import. Its list of built-in variables is
  the executor's, so `{{session_date}}`, `{{weekday_num}}`, `{{quarter}}`,
  `{{week_of_year}}` and `{{day_of_year}}` are not reported as dangling (the
  web's script reports them). In the app, the Agent validates with
  `validate_flow` and saves with `save_flow`.
- **The long form is a page of this skill.** `docs/prompt/flow-import-format.md`
  is served as `reference/flow-import-format.md`, so a reader that cannot open
  the repository reads it with the skill's reference tool.
- **The reference is pinned, not generated.** `generate_reference.py` and
  `coverage.py` are not carried. `reference/nodes.md` is the web's page, byte
  for byte, and tests (`agent::skills::flow_builder`) pin it to the web's text
  and to the desktop's validator (node types, required fields, vocabularies)
  and check every node type is listed, fielded and explained in the long
  form, as `coverage.py` does.
- **Addresses.** The webhook is served by the app itself: `127.0.0.1:5000` by
  default (development builds use 5500, and the port can be changed in the
  app), or the public tunnel address the editor shows when the tunnel is on.
  Every webhook needs its secret.
- **Reading a run.** The tables have the web's names, in `openalgo.db` in the
  app data folder (macOS `~/Library/Application Support/com.openalgo.desktop`,
  Windows `%APPDATA%\com.openalgo.desktop`, Linux
  `${XDG_DATA_HOME:-~/.local/share}/com.openalgo.desktop`); open it
  read-only. `settings.analyze_mode` is the app's analyzer mode switch.
- **No `.env`.** The history cache and the other web settings are fixed at the
  web's defaults.
- **`unsubscribe` with `all`** releases only this workflow's own streams (the
  web's call cleared every stream of the instance, the ones sandbox mode fills
  orders from included), and the wording is the desktop's: sandbox mode and
  analyzer mode.

## The one rule

**Validate before you hand anything over.**

```bash
cd src-tauri && FLOW_WORKFLOW=/absolute/path/workflow.json \
  cargo test --locked --lib flow_builder::check_the_workflow_file -- --ignored --nocapture
```

It calls the importer's own `validate_workflow`, so it cannot disagree with what
the server accepts, and then adds the checks the importer deliberately skips.
Those matter more than they sound: **Flow ignores a `data` key nothing reads.**
Write `strikeOffset` when the field is `offset` and the workflow imports
cleanly, runs successfully, and silently uses ATM. Nothing in the run says so.

Exit 0 means it imports. Warnings mean it imports and then misbehaves - treat
them as errors unless you know why.

## Workflow

1. **Read `reference/nodes.md`.** All 63 node types, their required fields, and
   every `data` key each one actually reads. Generated from the validator and
   the executor, so it cannot drift.
2. **Pick the trigger.** Exactly one, and it is the execution root:
   `start` (schedule), `webhookTrigger` (external POST), `priceAlert`,
   `orderUpdateTrigger`. A second trigger is rejected at import.
3. **Wire the graph.** Every edge names `source` and `target` node ids. An edge
   leaving a condition node must also set `sourceHandle` to pick the TRUE or
   FALSE branch.
4. **Validate. Fix. Re-validate.**
5. **Import** at `/flow`, or `POST /flow/api/workflows/import`.

For the full field-by-field contract, `docs/prompt/flow-import-format.md` is the
long form. This skill is the short path plus the check.

## The shape

```json
{
  "name": "Webhook long entry",
  "nodes": [
    { "id": "node_1", "type": "webhookTrigger",
      "position": { "x": 0, "y": 0 }, "data": { "label": "TV alert" } },
    { "id": "node_2", "type": "placeOrder",
      "position": { "x": 0, "y": 120 },
      "data": { "symbol": "{{webhook.symbol}}", "exchange": "NSE",
                "action": "{{webhook.action}}", "quantity": "{{webhook.quantity}}",
                "product": "MIS", "priceType": "MARKET",
                "outputVariable": "orderResult" } }
  ],
  "edges": [
    { "id": "e1", "source": "node_1", "target": "node_2", "type": "default" }
  ]
}
```

## Values from outside: `{{webhook.*}}`

The webhook body is exposed as `{{webhook.<key>}}`. Nested paths and array
indexing both work: `{{webhook.legs[0].qty}}`.

**Every field on an order node takes a reference** - not only `symbol`. The
editor shows a dropdown for `exchange` and a BUY/SELL pair for `action`, but the
stored value is a string either way, so `"exchange": "{{webhook.exchange}}"` is
valid. The same is true of `quantity`, `product`, `priceType`, `price`,
`triggerPrice`, `offset`, `optionType` and `expiryType`.

A field holding **exactly one whole token** keeps its type, so
`"quantity": "{{webhook.quantity}}"` against `{"quantity": 10}` arrives as the
number `10`.

Enumerated fields are case-insensitive, which matters because TradingView sends
whatever the chart carries: `"action": "buy"` is accepted. `symbol` is
upper-cased on order nodes for the same reason.

**An unresolved reference on an order field fails the node.** It does not fall
back to a default. That is deliberate: a webhook omitting `quantity` used to
place a real order for 1 unit. If a value is genuinely optional, use a literal or
branch on a condition node first.

## Traps

**A key nothing reads is ignored, not rejected.** The single most common way a
workflow "works" and does the wrong thing. `validate.py` catches it.

**`source` is not the price field.** On `indicator`, `barOffset` and
`priorPeriodOhlc`, `source` selects the data source (`api` or `db`). The price
field is `sourceField`. Passing `close` to `source` fails with a history error
naming neither.

**Options expiry has two forms.** `expiryType` takes a relative type
(`current_week`, `next_week`, `current_month`, `next_month`) **or** a `DDMMMYY`
date such as `28OCT25`, used as given. `expiryDate` is the same explicit date
under its own key and wins when both are set.

**The `webhookTrigger` carries no instrument.** It has only a `label`. Symbol and
exchange come from the request.

**A failed read is not a `False`.** `priceCondition`, `positionCheck` and
`fundCheck` error rather than answering when the broker call fails, so they take
neither branch. Do not write a graph that relies on the FALSE branch firing when
data is unavailable - it will not.

**A gate waits for `inputCount`, not for the wires.** Configure three inputs and
wire two and the gate errors rather than evaluating on part of the condition.

**`timeWindow` may cross midnight.** `22:00` to `02:00` spans midnight rather
than being empty, so an overnight MCX or crypto guard works as written.

**`unsubscribe` needs a symbol** unless `streamType` is `all`. With `all` it
releases every stream this workflow's own subscribe nodes opened, and nothing
else: another workflow's streams, and the ones sandbox mode fills pending SL and
LIMIT orders from, stay open.

**Subscriptions end with the workflow.** Deactivating or deleting it releases
everything its subscribe nodes opened, so no cleanup node is needed for that.

**A condition evaluates once per run**, like a gate. A diamond that reaches one
condition by two paths fires its branch once, not twice.

**`waitUntil` is capped at 30 minutes.** A run whose Delay and Wait Until steps
add up to more than 10 seconds is answered at once (`accepted`) and finishes in
the background, so the wait never holds the triggering request. Anything longer
than 30 minutes belongs on a `start` schedule trigger.

**A schedule is clock-aligned and market-hours gated.** `interval` fires on the
clock (HH:MM:02, not activation time + 60s), and the `start` node carries
`marketHoursOnly` (the editor writes `true`, but an imported JSON that omits
the key defaults to **false** and runs around the clock, so set it explicitly),
`marketHoursStart` (09:15), `marketHoursEnd`
(15:15) and `marketHoursExchange` (NSE). The window narrows the exchange's
session; it never reopens a holiday.

**A 1-minute strategy reads a cached history.** The indicator node reuses a
fetch for 30 seconds, which is half a one-minute candle, so a 1m condition can
act on bars up to 30 seconds old. The desktop has no `.env`, so the 30 seconds
is fixed.

**Read a closed bar, not a forming one.** `{{ind.latest.*}}` is the bar still
being built and repaints within the period. `{{ind.previous.*}}` is the last
closed bar. With `offsetBars: 2`, `{{ind.at_offset.*}}` is the bar before that,
so one node gives both bars a flip test needs.

**A tuple indicator returns `out0`, `out1`, ...** not `value`. Supertrend gives
`out0` (the line) and `out1` (direction), and its direction is inverted from the
usual convention: **-1 is the uptrend**, +1 the downtrend. Verify an
indicator's encoding before trading it.

**Conditions need `sourceHandle`.** An edge leaving `priceCondition`,
`timeCondition`, `timeWindow`, `positionCheck`, `fundCheck` or `varCondition`
must say which branch it is.

**Gates wait for every input.** `andGate` and `orGate` fire once, after all wired
inputs have been evaluated.

## Testing a workflow without the editor

Trigger it over HTTP, exactly as an alert would, and read the run back:

```bash
curl -X POST http://127.0.0.1:5000/flow/webhook/<token> \
  -H "Content-Type: application/json" \
  -d '{"secret":"<secret>","symbol":"RELIANCE","action":"BUY","quantity":1}'
```

```sql
SELECT id, status, logs FROM flow_workflow_executions ORDER BY id DESC LIMIT 1;
```

The log lines are the evidence: they name the values each node actually used, so
a field that silently kept its default shows up as a mismatch against the
payload you sent. **Check `settings.analyze_mode` first** - `1` is analyzer
mode, which routes orders to sandbox mode, `0` sends them to a live broker.

## Files

| Path | |
|---|---|
| `flow_builder::check_the_workflow_file` (test, `src-tauri`) | the gate; wraps the importer's own validator |
| `reference/nodes.md` | all 63 node types, the web's page, pinned by tests |
| `agent::skills::flow_builder` (tests) | fail if a node type is undocumented or the page drifts |
| `docs/prompt/flow-import-format.md` | the long-form contract (`reference/flow-import-format.md` here) |

Files in this skill

  • SKILL.md11.3 KB
  • reference/nodes.md6.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.