> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsa.finance/llms.txt
> Use this file to discover all available pages before exploring further.

# Workflow Authoring Skill

> AI skill for building Corsa no-code compliance workflows — triggers, node trees, AI Copilot blocks, conditions, variables, and deployment.

## Overview

The **corsa-workflow-authoring** skill adds Corsa workflow engine knowledge to your coding tool (Cursor, Claude Code, VS Code, etc.) so it can build, validate, and deploy compliance workflows. It covers the complete node type catalog, trigger configuration, variable interpolation, branch conditions, and the MCP-based workflow-builder interface.

### What It Helps With

* Building a workflow from a natural-language description
* Configuring event-driven and scheduled triggers with the correct filter syntax
* Assembling the node tree (ACTION, RECORD, NOTIFY, BRANCH, AI/Copilot)
* Wiring branch conditions using entity fields or prior node outputs
* Interpolating `{{variables}}` in prompts, messages, and payloads
* Validating and deploying workflows via the workflow-builder MCP tools or REST API

***

## Quick Start

After installing the skill, ask your coding tool questions like:

* *"Build a workflow that triggers when a client's risk rises to HIGH, runs an AI review, and opens an alert if suspicious"*
* *"What triggers are available for individual client events?"*
* *"How do I pass an AI node's output to a downstream branch condition?"*
* *"Create a scheduled workflow that scans dormant clients weekly"*
* *"Fix this validation error: BRANCH\_CHILD\_TYPE"*

***

## What the Skill Knows

### Mental Model

A workflow is **one trigger + a parent→child tree of nodes**. There is no `edges` array — every non-trigger node has a `parentNodeId`. Siblings of the same parent run in parallel; chain sequentially when a later node needs an earlier node's result.

### Triggers

**Event-driven** (`triggerConfig`) — fires when an entity is created or updated. Supported entities: `individual_client`, `corporate_client`, `alert`, `case`, `transaction`. Filters narrow which events fire the workflow (e.g. `"field": "currentRisk.level", "operator": "changed_from_to"`).

**Scheduled** (`scheduleConfig`) — queries `individual_client` or `corporate_client` on an interval (min 5 minutes, max 1 year) and processes matching entities in a batch.

### Node Types

| Type      | Purpose                                                                                                                 |
| --------- | ----------------------------------------------------------------------------------------------------------------------- |
| `TRIGGER` | Root node — the entry point                                                                                             |
| `ACTION`  | Calls a Corsa service: screen client, run risk assessment, send email, call webhook, request documents, periodic review |
| `RECORD`  | Creates or updates a Corsa entity (ALERT create, CASE create, CLIENT/TRANSACTION update)                                |
| `NOTIFY`  | Notifies analysts via in-app, email, or Slack                                                                           |
| `BRANCH`  | Conditional fan-out; child `BRANCH_PATH` nodes hold conditions                                                          |
| `AI`      | AI/Copilot analysis — produces structured output that can gate downstream branches                                      |

### Building Workflows

The skill knows two paths:

1. **MCP workflow-builder tools** (recommended for agents) — incremental mutations with validation feedback (`suggestedFix`, `allowedValues`) after each step
2. **REST API** (`POST /v1/workflow-definitions`) — one-shot submission of a complete definition

### Variable Interpolation

`{{variable}}` placeholders resolve at runtime in NOTIFY messages, ACTION bodies, AI prompts, and RECORD payloads. Key variables: `{{client.name}}`, `{{client.id}}`, `{{entity.<path>}}`, `{{node.<nodeId>.<field>}}`, `{{workflow.instanceId}}`.

***

## Common Mistakes It Prevents

| Mistake                                   | What the skill does                                              |
| ----------------------------------------- | ---------------------------------------------------------------- |
| Using `triggerConfigs` array (old format) | Uses correct single `triggerConfig` object with dot-form `event` |
| Triggering on `workflow.started`          | Not a valid event — explains valid trigger events                |
| Node without `parentNodeId`               | Every non-TRIGGER node requires a parent                         |
| `actionType: "CREATE_ALERT"`              | Guides to use a `RECORD` node for entity mutations               |
| RECORD `CREATE` on CLIENT or TRANSACTION  | Only ALERT and CASE support CREATE                               |
| Scheduling on alerts/cases/transactions   | Only `individual_client`/`corporate_client` are schedulable      |
| Stale `expectedRevision` in MCP           | Always uses the latest `draft.revision` from the prior response  |

***

## Source

<Card title="GitHub Repository" icon="github" href="https://github.com/corsa-labs/corsa-skills/tree/main/corsa-workflow-authoring">
  View the full skill source with the complete node catalog, trigger filter fields, variable catalog, and worked examples.
</Card>
