SKILL.md
Writing Scripts
A script is a JavaScript function that runs at a specific hook point in the Celigo data pipeline. Scripts handle logic that expressions, filters, and visual mappings cannot -- complex conditionals, cross-record calculations, API calls within the pipeline, and custom routing.
Concerns when writing a script:
- Choosing the right hook point -- which function type matches what you're trying to accomplish
- Input/output contracts -- what
optionscontains and what the function must return (array length rules are strict) - Expression alternative -- filter, transform, and output filter have expression-based alternatives that don't require a script; prefer expressions when possible
- Available modules -- scripts can
importthree built-in modules:integrator-api(call Celigo APIs),dayjs(date/time manipulation), andsjcl(Stanford JavaScript Crypto Library for hashing/encryption) - One script, many functions -- a single script resource can contain multiple functions, each wired independently to different hook points
Used across flows, APIs, and tools.
Diagnosing a script is read-only. Editing it, rewiring it, and running a flow to test it all write to the account or to the connected systems, and an edit to a shared script reaches every hook that names it -- make those changes when the user asked for them, not as part of explaining a failure. A question about why something fails or how to fix it asks for the cause and the change you propose; make the change once the user says to.