Command Palette

Search for a command to run...

Назад к скиллам
скилл № 56577

n8n-expressions-official

Use when writing or reviewing n8n expressions (`{{...}}` syntax), `$json` / `$node` references, Luxon date code, or expression errors. Triggers on `{{}}`…

БесплатноБез исполняемых скриптов
n8n-ioот n8n-io★ 644 звезды на GitHub

Установить n8n-expressions-official в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

n8n Expressions

n8n's expression language is JavaScript embedded in {{...}} blocks. They run synchronously, on a single item at a time ($json), with access to upstream nodes ($('Name')), Luxon for dates, and most of native JS.

Non-negotiable

Reference data by node name, not $json. Use $('Node Name').item.json.field (or .first().json.field). $json works but breaks when any node clears item context (Aggregate, Code with Run for All, branching merges) or a refactor adds an intermediate. Failures are silent, and downstream gets the wrong data with no error. Node-name references are stable.

Strong defaults

  • No Set nodes whose only purpose is to feed a single downstream field. Inline the expression at the consumer. Set earns its place when 2+ consumers read the same derived value, the derivation is non-trivial, or the Set is a sub-workflow's final return-shaper. See "The Set-node antipattern" below.
  • Luxon for dates, not the DateTime node. Date math, formatting, and parsing all work in expressions: {{ DateTime.now().minus({ days: 7 }).toISO() }}. The DateTime node is more visible on the canvas for beginner human users, but avoid it unless the user specifically asks for it.
  • Expressions over extra nodes generally. Build the email body in the email node's body field, and compute the URL in the HTTP Request's URL field. Reach for an extra node when the transform is reused or the primary purpose of a section.
  • Multi-line expressions are indented and commented. When an expression spans more than one line, format it like real code. Most n8n users are not coders, so explain the code with concise inline comments

Why reference by node name ($('Name').item.json.x) over $json.x

$json means "the current item flowing into this node." Fine when the node is directly downstream of one source and nothing has cleared the item context (some nodes do: Aggregate, Code with Run for All, branching merges).

It breaks when:

  • You insert a node between source and consumer (the consumer was reading $json.x from a node 3 steps back, and now the new intermediate node is what $json refers to).
  • A node clears the context (Aggregate, certain merges, Code nodes that don't preserve shape).
  • Branches converge via Merge. $json is whichever branch fired last, not deterministic.

$('Get User').item.json.id is unambiguous. Always the named node's first-item JSON, regardless of what's between.

The exception that makes the rule:

When branches converge and you need a stable reference point, insert a NoOp node at the convergence. Name it descriptively (e.g., Combine Inputs). Downstream nodes reference it by name.

Branch A ──┐
           ├─→ [NoOp: Combine Inputs] ──→ Downstream nodes use $('Combine Inputs').item.json.x
Branch B ──┘

NoOp survives refactors: inserting a transform between Combine Inputs and the consumer doesn't break the $('Combine Inputs') reference.

This pattern is required when downstream nodes need data from a node whose context gets cleared by an intermediate operation.

If the branches produce different shapes, use a Set node instead of NoOp. NoOp passes through whatever shape arrived, so downstream still has to know which branch fired. A Set node normalizes both branches into one shape, and downstream reads one set of fields:

// Set node: "Normalize Inputs"
name: `={{ $('Lookup by Email').item.json.name || $('Lookup by ID').item.json.full_name }}`
email: `={{ $('Lookup by Email').item.json.email || $('Lookup by ID').item.json.contact_email }}`

Downstream nodes reference $('Normalize Inputs').item.json.name regardless of which branch produced it.

The Set-node antipattern

The pattern AI agents often produce:

Webhook → Set: { customer_id: $json.body.customer_id, amount: $json.body.amount }
       → Postgres: WHERE id = {{ $json.customer_id }}
       → Email: Total is {{ $json.amount }}

The Set node does nothing useful. Each downstream node could read from the webhook directly:

Webhook → Postgres: WHERE id = {{ $('Webhook').item.json.body.customer_id }}
       → Email: Total is {{ $('Webhook').item.json.body.amount }}

The Set node only earns its place if:

  • The same derived value is used by multiple downstream consumers (derivation non-trivial).
  • The derivation is logic-heavy and a name aids readability.
  • Multiple branches need the same shape, and a shared upstream reference is cleaner.
  • It's the final node of a sub-workflow, shaping the return contract. Explicit exception: the "single consumer" is every caller, so the Set is the API boundary. Optional but encouraged for sub-workflows, and sometimes required when the prior node carries noise fields. See n8n-subworkflows-official.
  • You need to drop fields from the item by setting Include Other Fields: false. Set is the cleanest way to whitelist an output shape. This is the underlying mechanism behind the sub-workflow r
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл n8n-expressions-official?

Use when writing or reviewing n8n expressions (`{{...}}` syntax), `$json` / `$node` references, Luxon date code, or expression errors. Triggers on `{{}}`, `$json`, `$node`, `$input`, `DateTime`, `Luxon`, "expression error", "evaluating", "format date", "transform field", or any node-parameter assignment.

Как установить скилл n8n-expressions-official?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл n8n-expressions-official запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить n8n-expressions-official с