Skip to content
MCP Servers
Skill

/n8n-expression-syntax

Validate n8n expression syntax and fix common errors. Use when writing n8n expressions, using {{}} syntax, accessing $json/$node variables, troubleshooting expression errors, mapping data between nodes, or referencing webhook data in workflows. Use this skill whenever

From plugin
n8n-mcp
23k15 skills8 agents

Claude Code

$ npx -y skills add czlonkowski/n8n-mcp --skill n8n-expression-syntax --agent claude-code

SKILL.md

n8n-expression-syntax.SKILL.md
name: n8n-expression-syntax
description: Validate n8n expression syntax and fix common errors. Use when writing n8n expressions, using {{}} syntax, accessing $json/$node variables, troubleshooting expression errors, mapping data between nodes, or referencing webhook data in workflows. Use this skill whenever configuring node fields that reference data from previous nodes โ€” expressions are how n8n passes data between nodes, and getting the syntax wrong is the most common source of workflow errors. Also use when asked whether a complex expression hurts performance.

n8n Expression Syntax

Expert guide for writing correct n8n expressions in workflows.

---

Expression Format

All dynamic content in n8n uses **double curly braces**:

{{expression}}

**Examples**:

โœ… {{$json.email}}
โœ… {{$json.body.name}}
โœ… {{$node["HTTP Request"].json.data}}
โŒ $json.email  (no braces - treated as literal text)
โŒ {$json.email}  (single braces - invalid)

---

Core Variables

$json - Current Node Output

Access data from the current node:

{{$json.fieldName}}
{{$json['field with spaces']}}
{{$json.nested.property}}
{{$json.items[0].name}}

$node - Reference Other Nodes

Access data from any previous node:

{{$node["Node Name"].json.fieldName}}
{{$node["HTTP Request"].json.data}}
{{$node["Webhook"].json.body.email}}

**Important**:

  • Node names **must** be in quotes
  • Node names are **case-sensitive**
  • Must match exact node name from workflow

$now - Current Timestamp

Access current date/time:

{{$now}}
{{$now.toFormat('yyyy-MM-dd')}}
{{$now.toFormat('HH:mm:ss')}}
{{$now.plus({days: 7})}}

$env - Environment Variables

Access environment variables:

{{$env.API_KEY}}
{{$env.DATABASE_URL}}

**Warning**: Some n8n instances have `N8N_BLOCK_ENV_ACCESS_IN_NODE` enabled, which blocks `$env` access entirely. If `$env` returns errors, use alternative approaches:

  • Store values in credentials instead
  • Use n8n Variables (`$vars`, below) when the instance's license includes them
  • Use a Set node with manually entered values
  • Pass values through webhook query parameters

$vars - n8n Variables

Read instance variables set in the n8n UI or with `n8n_manage_variables`:

{{$vars.API_BASE_URL}}/users
{{$vars.SLACK_CHANNEL}}

Values are always strings and read-only at runtime. A missing variable resolves to `undefined` without an error (`{{$vars.API_BASE_URL}}/users` becomes `undefined/users`), so confirm the key with `n8n_manage_variables` (`list`) before using it. Variables need an n8n license that includes them (not the free Community edition). A project variable is visible only to workflows in that project. Variables are visible to every user in their scope, so keep secrets in credentials.

---

๐Ÿšจ CRITICAL: Webhook Data Structure

**Most Common Mistake**: Webhook data is **NOT** at the root!

Webhook Node Output Structure

{
  "headers": {...},
  "params": {...},
  "query": {...},
  "body": {           // โš ๏ธ USER DATA IS HERE!
    "name": "John",
    "email": "john@example.com",
    "message": "Hello"
  }
}

Correct Webhook Data Access

โŒ WRONG: {{$json.name}}
โŒ WRONG: {{$json.email}}

โœ… CORRECT: {{$json.body.name}}
โœ… CORRECT: {{$json.body.email}}
โœ… CORRECT: {{$json.body.message}}

**Why**: Webhook node wraps incoming data under `.body` property to preserve headers, params, and query parameters.

---

Common Patterns

Access Nested Fields

// Simple nesting
{{$json.user.email}}

// Array access
{{$json.data[0].name}}
{{$json.items[0].id}}

// Bracket notation for spaces
{{$json['field name']}}
{{$json['user data']['first name']}}

Reference Other Nodes

// Node without spaces
{{$node["Set"].json.value}}

// Node with spaces (common!)
{{$node["HTTP Request"].json.data}}
{{$node["Respond to Webhook"].json.message}}

// Webhook node
{{$node["Webhook"].json.body.email}}

Combine Variables

// Concatenation (automatic)
Hello {{$json.body.name}}!

// In URLs
https://api.example.com/users/{{$json.body.user_id}}

// In object properties
{
  "name": "={{$json.body.name}}",
  "email": "={{$json.body.email}}"
}

---

When NOT to Use Expressions

โŒ Code Nodes

Code nodes use **direct JavaScript access**, NOT expressions!

// โŒ WRONG in Code node
const email = '={{$json.email}}';
const name = '{{$json.body.name}}';

// โœ… CORRECT in Code node
const email = $json.email;
const name = $json.body.name;

// Or using Code node API
const email = $input.item.json.email;
const allItems = $input.all();

โŒ Webhook Paths

// โŒ WRONG
path: "{{$json.user_id}}/webhook"

// โœ… CORRECT
path: "user-webhook"  // Static paths only

โŒ Credential Fields

// โŒ WRONG
apiKey: "={{$env.API_KEY}}"

// โœ… CORRECT
Use n8n credential system, not expressions

---

The transform gatekeeper

Before you add a node โ€” or write any code โ€” to transform data, walk this order and stop at the first that fits:

1. **The service's own node** does it in its own fields: a CRM node's field slots, the Slack node's Blocks field, a Data Table insert's per-column slots. HTTP Request only when no node covers the operation. 2. **A native node for the job.** Filter, IF / Switch, Summarize, Aggregate, Split Out, Merge, Compare Datasets, Remove Duplicates, Sort + Limit, Date & Time, XML / HTML / Extract From File, HTTP Request pagination, Crypto. The job-to-node table in `using-n8n-mcp-skills` maps jobs to nodes; their configs are in `n8n-node-configuration` โ†’ NATIVE_NODES.md. 3. **A short expression** (`{{ ... }}`) inside that node's field. Property access, method chains (`.map().filter().join()`), a ternary, string building, Luxon date math, the helper functions below โ€” "take A, produce B" in one expression, without intermediate variables.

  • **Query
Read more
@czlonkowski
Ships withn8n-mcp

n8n-MCP is an open-source MCP server that lets Claude, ChatGPT, Cursor, and other AI assistants operate n8n: read failed executions, edit workflows in place, validate and test them, manage credentials, and build new workflows.

23k15 skills8 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
23.3k
Star history of czlonkowski/n8n-mcp on GitHub, a chart by star-history.com

Other skills on n8n-mcp.

n8n-agents

n8n-agents

Design n8n AI agents the right way. Use when building or editing any @n8n/n8n-nodes-langchain.* AI node โ€” an AI Agent, LLM chain,โ€ฆ

@czlonkowski@czlonkowskiInstall Skill
n8n-binary-and-data

n8n-binary-and-data

Handle files and binary data in n8n correctly. Use when working with files, images, PDFs, attachments, uploads or downloads,โ€ฆ

@czlonkowski@czlonkowskiInstall Skill
n8n-code-javascript

n8n-code-javascript

Write JavaScript code in n8n Code nodes. Use when writing JavaScript in n8n, using $input/$json/$node syntax, making HTTPโ€ฆ

@czlonkowski@czlonkowskiInstall Skill
n8n-code-python

n8n-code-python

Write Python code in n8n Code nodes. Use when writing Python in n8n, using _input/_json/_node syntax, working with standardโ€ฆ

@czlonkowski@czlonkowskiInstall Skill
n8n-code-tool

n8n-code-tool

Write JavaScript or Python for the n8n Custom Code Tool (@n8n/n8n-nodes-langchain.toolCode) โ€” the AI-agent-callable tool, NOT theโ€ฆ

@czlonkowski@czlonkowskiInstall Skill
n8n-error-handling

n8n-error-handling

Wire n8n error handling so failures are loud, structured, and recoverable. Use when building any webhook/API workflow, aโ€ฆ

@czlonkowski@czlonkowskiInstall Skill

More skills from other plugins.

gitnexus-cli

gitnexus-cli

Use when the user needs to run GitNexus CLI commands like analyze/index a repo, check status, clean the index, generate a wiki,โ€ฆ

@abhigyanpatwari@abhigyanpatwariInstall Skill
fastmcp-client-cli

fastmcp-client-cli

Query and invoke tools on MCP servers using fastmcp list and fastmcp call. Use when you need to discover what tools a serverโ€ฆ

fastmcp3d29k
@prefecthq@prefecthqInstall Skill
post-to-xhs

post-to-xhs

ๅฐ็บขไนฆๅ†…ๅฎนๅ‘ๅธƒๆŠ€่ƒฝใ€‚ๆ”ฏๆŒไธค็งๅ‘ๅธƒๆจกๅผ๏ผš(1) ไธŠไผ ๅ›พๆ–‡ๆจกๅผ - ๅ›พ็‰‡+็Ÿญๆ–‡๏ผ›(2) ๅ†™้•ฟๆ–‡ๆจกๅผ - ้•ฟ็ฏ‡ๆ–‡็ซ +ๆŽ’็‰ˆๆจกๆฟใ€‚ ๆ”ฏๆŒไธค็ง่พ“ๅ…ฅๆ–นๅผ๏ผš็”จๆˆทๆไพ›ๅฎŒๆ•ดๅ†…ๅฎนๅ’Œๅ›พ็‰‡/ๅ›พ็‰‡URL๏ผŒ็›ดๆŽฅๅ‘ๅธƒ๏ผ›ๆˆ–ๆไพ›็ฝ‘้กตURL๏ผŒ่‡ชๅŠจๆๅ–ๅ†…ๅฎนๅ’Œๅ›พ็‰‡ใ€‚โ€ฆ

@xpzouying@xpzouyingInstall Skill
chatgpt-app-builder

chatgpt-app-builder

Build, modify, debug, migrate, review, or verify TypeScript MCP servers and MCP Apps with mcp-use. Use for tools, resources,โ€ฆ

mcp-use6d11k
@mcp-use@mcp-useInstall Skill

Questions about n8n-expression-syntax.

Which coding agents can use n8n-expression-syntax?
n8n-expression-syntax installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.