[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7F3KP1Y8Y2WPEPKB5J5D50T":3,"skill-same:01M7F3KP1Y8Y2WPEPKB5J5D50T":59},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":29,"updatedAt":30,"install":31,"resources":44},"01M7F3KP1Y8Y2WPEPKB5J5D50T","n8n-expression-syntax",null,"Validate n8n expression syntax and fix common errors. Use when writing n8n expressions, using {{}} syntax, accessing $json\u002F$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.","26BB\u002Fagent-fleet-os","26BB","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F113676969?v=4","01M7F3AVX9MTTAHCYTANRGEE52","Bhushan Vijay Bhosale","01M7F3AVY15DJBX1CE4H25P52T",0,"MIT","https:\u002F\u002Fgithub.com\u002F26BB\u002Fagent-fleet-os\u002Fblob\u002Fmain\u002FN8N agent\u002Fplaybooks\u002Fn8n-expression-syntax\u002FSKILL.md",[],[],"2026-11-16 10:05:34",false,"---\nname: n8n-expression-syntax\ndescription: Validate n8n expression syntax and fix common errors. Use when writing n8n expressions, using {{}} syntax, accessing $json\u002F$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.\n---\n\n# n8n Expression Syntax\n\nExpert guide for writing correct n8n expressions in workflows.\n\n---\n\n## Expression Format\n\nAll dynamic content in n8n uses **double curly braces**:\n\n```\n{{expression}}\n```\n\n**Examples**:\n```\n✅ {{$json.email}}\n✅ {{$json.body.name}}\n✅ {{$node[\"HTTP Request\"].json.data}}\n❌ $json.email  (no braces - treated as literal text)\n❌ {$json.email}  (single braces - invalid)\n```\n\n---\n\n## Core Variables\n\n### $json - Current Node Output\n\nAccess data from the current node:\n\n```javascript\n{{$json.fieldName}}\n{{$json['field with spaces']}}\n{{$json.nested.property}}\n{{$json.items[0].name}}\n```\n\n### $node - Reference Other Nodes\n\nAccess data from any previous node:\n\n```javascript\n{{$node[\"Node Name\"].json.fieldName}}\n{{$node[\"HTTP Request\"].json.data}}\n{{$node[\"Webhook\"].json.body.email}}\n```\n\n**Important**:\n- Node names **must** be in quotes\n- Node names are **case-sensitive**\n- Must match exact node name from workflow\n\n### $now - Current Timestamp\n\nAccess current date\u002Ftime:\n\n```javascript\n{{$now}}\n{{$now.toFormat('yyyy-MM-dd')}}\n{{$now.toFormat('HH:mm:ss')}}\n{{$now.plus({days: 7})}}\n```\n\n### $env - Environment Variables\n\nAccess environment variables:\n\n```javascript\n{{$env.API_KEY}}\n{{$env.DATABASE_URL}}\n```\n\n**Warning**: Some n8n instances have `N8N_BLOCK_ENV_ACCESS_IN_NODE` enabled, which blocks `$env` access entirely. If `$env` returns errors, use alternative approaches:\n- Store values in credentials instead\n- Use a Set node with manually entered values\n- Pass values through webhook query parameters\n\n---\n\n## 🚨 CRITICAL: Webhook Data Structure\n\n**Most Common Mistake**: Webhook data is **NOT** at the root!\n\n### Webhook Node Output Structure\n\n```javascript\n{\n  \"headers\": {...},\n  \"params\": {...},\n  \"query\": {...},\n  \"body\": {           \u002F\u002F ⚠️ USER DATA IS HERE!\n    \"name\": \"John\",\n    \"email\": \"john@example.com\",\n    \"message\": \"Hello\"\n  }\n}\n```\n\n### Correct Webhook Data Access\n\n```javascript\n❌ WRONG: {{$json.name}}\n❌ WRONG: {{$json.email}}\n\n✅ CORRECT: {{$json.body.name}}\n✅ CORRECT: {{$json.body.email}}\n✅ CORRECT: {{$json.body.message}}\n```\n\n**Why**: Webhook node wraps incoming data under `.body` property to preserve headers, params, and query parameters.\n\n---\n\n## Common Patterns\n\n### Access Nested Fields\n\n```javascript\n\u002F\u002F Simple nesting\n{{$json.user.email}}\n\n\u002F\u002F Array access\n{{$json.data[0].name}}\n{{$json.items[0].id}}\n\n\u002F\u002F Bracket notation for spaces\n{{$json['field name']}}\n{{$json['user data']['first name']}}\n```\n\n### Reference Other Nodes\n\n```javascript\n\u002F\u002F Node without spaces\n{{$node[\"Set\"].json.value}}\n\n\u002F\u002F Node with spaces (common!)\n{{$node[\"HTTP Request\"].json.data}}\n{{$node[\"Respond to Webhook\"].json.message}}\n\n\u002F\u002F Webhook node\n{{$node[\"Webhook\"].json.body.email}}\n```\n\n### Combine Variables\n\n```javascript\n\u002F\u002F Concatenation (automatic)\nHello {{$json.body.name}}!\n\n\u002F\u002F In URLs\nhttps:\u002F\u002Fapi.example.com\u002Fusers\u002F{{$json.body.user_id}}\n\n\u002F\u002F In object properties\n{\n  \"name\": \"={{$json.body.name}}\",\n  \"email\": \"={{$json.body.email}}\"\n}\n```\n\n---\n\n## When NOT to Use Expressions\n\n### ❌ Code Nodes\n\nCode nodes use **direct JavaScript access**, NOT expressions!\n\n```javascript\n\u002F\u002F ❌ WRONG in Code node\nconst email = '={{$json.email}}';\nconst name = '{{$json.body.name}}';\n\n\u002F\u002F ✅ CORRECT in Code node\nconst email = $json.email;\nconst name = $json.body.name;\n\n\u002F\u002F Or using Code node API\nconst email = $input.item.json.email;\nconst allItems = $input.all();\n```\n\n### ❌ Webhook Paths\n\n```javascript\n\u002F\u002F ❌ WRONG\npath: \"{{$json.user_id}}\u002Fwebhook\"\n\n\u002F\u002F ✅ CORRECT\npath: \"user-webhook\"  \u002F\u002F Static paths only\n```\n\n### ❌ Credential Fields\n\n```javascript\n\u002F\u002F ❌ WRONG\napiKey: \"={{$env.API_KEY}}\"\n\n\u002F\u002F ✅ CORRECT\nUse n8n credential system, not expressions\n```\n\n---\n\n## The transform gatekeeper\n\nBefore you add any node — or write any code — to transform data, walk this order and stop at the first that fits:\n\n1. **Expression** (`{{ ... }}`) in the consuming field. Property access, method chains (`.map().filter().join()`), ternaries, string building, Luxon date math — if it's \"take A, produce B\" without intermediate variables, it's an expression. This covers most \"just transform this\" cases.\n2. **Arrow-function IIFE inside an Edit Fields field.** When the logic needs intermediate variables, branching, or comments but still operates on one item, wrap it in an immediately-invoked arrow function right in the field value:\n\n   ```\n   ={{ (() => {\n       const items = $json.line_items;\n       const subtotal = items.reduce((sum, it) => sum + it.price * it.qty, 0);\n       const tax = subtotal * 0.08;\n       return (subtotal + tax).toFixed(2);\n   })() }}\n   ```\n\n   The outer `(...)` brackets the function; the trailing `()` invokes it. Drop either and n8n refuses to run. Inside you get the full expression scope (`$json`, `$('Node')`, `$now`, Luxon) plus `const`\u002F`let`, `if`\u002F`switch`, `try`\u002F`catch`, and regex. No `require`, no `await`.\n3. **Code node — last resort.** Only when you need multi-item aggregation across the whole dataset (`$input.all()`), an allowlisted library, or async work.\n\n**Why the order matters.** It's not style — it's readability and performance. The Code node runs in a sandboxed VM with per-invocation setup and value marshaling — a cold-start cost that can reach 500–1000ms before your logic runs. (It amortizes on warm, high-item-count runs, so treat this as the common-case cost, not a universal constant.) The same logic in an expression or Edit Fields IIFE runs in-process in single-digit milliseconds and skips the sandbox entirely. For pure single-item shaping that's a large gap with no functional difference, and it compounds on hot paths like per-request webhooks. The expression also stays visible in the field that uses it, instead of hiding in an upstream node someone has to open to understand. Reach past a stage only when the input or scope genuinely demands it.\n\n## The Set-node antipattern and branch convergence\n\n### Delete Set nodes that feed one consumer\n\nA Set \u002F Edit Fields node whose only job is to extract a value and hand it to **one** downstream node is dead weight. Inline its expression at the consumer instead.\n\n```\n❌  Webhook → Set { customer_id: {{ $json.body.customer_id }} } → Postgres: WHERE id = {{ $json.customer_id }}\n\n✅  Webhook → Postgres: WHERE id = {{ $('Webhook').item.json.body.customer_id }}\n```\n\nThe Set node adds a hop, more canvas clutter, and a refactor hazard, while doing nothing the consumer couldn't do itself. To remove it cleanly with `n8n_update_partial_workflow`: rewire the connection (`removeConnection` from the Set's source-and-target, `addConnection` straight from source to consumer), `patchNodeField` the consumer's expression to reference the original source by node name, then `removeNode` the Set.\n\n**Quick test:** count how many downstream nodes reference each field the Set produces.\n- **0 or 1** → delete, inline at the consumer.\n- **2+** → it may earn its place.\n\n**Legitimate exceptions** — keep the Set when:\n- **2+ consumers** read the same derived value and the derivation is non-trivial (a name aids readability and you compute it once).\n- **It's a sub-workflow's final Return node**, shaping the output contract. Here the \"single consumer\" is every caller, so the Set *is* the API boundary — and with `Include Other Fields: false` it whitelists the output shape so internal scratch fields don't leak.\n- **You're renaming or whitelisting fields** and want that visible in one place rather than spread across consumer expressions.\n\n### Branch convergence: anchor with a NoOp\n\nWhen branches converge (after IF\u002FSwitch\u002FMerge), `$json` becomes \"whichever branch fired last\" — non-deterministic, and a silent source of wrong data. Insert a **NoOp** node at the convergence, name it descriptively (`Combine Inputs`), and have downstream nodes reference it by name:\n\n```\nBranch A ──┐\n           ├─→ [NoOp: Combine Inputs] ──→ downstream uses $('Combine Inputs').item.json.x\nBranch B ──┘\n```\n\nThe NoOp survives refactors: inserting a transform later between it and the consumer doesn't break the `$('Combine Inputs')` reference. (If the branches produce *different* shapes, use a Set node instead of a NoOp to normalize both into one shape — see the exceptions above.)\n\nMore broadly in branchy flows, **prefer `$('Node').item.json.x` over deep `$json.x`.** `$json` breaks the moment an intermediate node is inserted or a node clears item context (Aggregate, Code with Run for All, branching merges); the failure is silent and downstream gets the wrong data with no error. A node-name reference is unambiguous regardless of what sits between source and consumer.\n\n---\n\n## Validation Rules\n\n### 1. Always Use {{}}\n\nExpressions **must** be wrapped in double curly braces.\n\n```javascript\n❌ $json.field\n✅ {{$json.field}}\n```\n\n### 2. Use Quotes for Spaces and Special Characters\n\nField or node names with spaces, diacritics, or special characters require **bracket notation**:\n\n```javascript\n❌ {{$json.field name}}\n✅ {{$json['field name']}}\n\n❌ {{$node.HTTP Request.json}}\n✅ {{$node[\"HTTP Request\"].json}}\n\n\u002F\u002F Bracket notation is mandatory for keys with special characters\n✅ {{$json['Gross Price w\u002Fo shipment']}}\n✅ {{$json['Cena brutto zł']}}\n```\n\n### 3. Match Exact Node Names\n\nNode references are **case-sensitive**:\n\n```javascript\n❌ {{$node[\"http request\"].json}}  \u002F\u002F lowercase\n❌ {{$node[\"Http Request\"].json}}  \u002F\u002F wrong case\n✅ {{$node[\"HTTP Request\"].json}}  \u002F\u002F exact match\n```\n\n### 4. No Nested {{}}\n\nDon't double-wrap expressions:\n\n```javascript\n❌ {{{$json.field}}}\n✅ {{$json.field}}\n```\n\n---\n\n## Common Mistakes\n\nFor complete error catalog with fixes, see [COMMON_MISTAKES.md](COMMON_MISTAKES.md)\n\n### Quick Fixes\n\n| Mistake | Fix |\n|---------|-----|\n| `$json.field` | `{{$json.field}}` |\n| `{{$json.field name}}` | `{{$json['field name']}}` |\n| `{{$node.HTTP Request}}` | `{{$node[\"HTTP Request\"]}}` |\n| `{{{$json.field}}}` | `{{$json.field}}` |\n| `{{$json.name}}` (webhook) | `{{$json.body.name}}` |\n| `'={{$json.email}}'` (Code node) | `$json.email` |\n\n---\n\n## Working Examples\n\nFor real workflow examples, see [EXAMPLES.md](EXAMPLES.md)\n\n### Example 1: Webhook to Slack\n\n**Webhook receives**:\n```json\n{\n  \"body\": {\n    \"name\": \"John Doe\",\n    \"email\": \"john@example.com\",\n    \"message\": \"Hello!\"\n  }\n}\n```\n\n**In Slack node text field**:\n```\nNew form submission!\n\nName: {{$json.body.name}}\nEmail: {{$json.body.email}}\nMessage: {{$json.body.message}}\n```\n\n### Example 2: HTTP Request to Email\n\n**HTTP Request returns**:\n```json\n{\n  \"data\": {\n    \"items\": [\n      {\"name\": \"Product 1\", \"price\": 29.99}\n    ]\n  }\n}\n```\n\n**In Email node** (reference HTTP Request):\n```\nProduct: {{$node[\"HTTP Request\"].json.data.items[0].name}}\nPrice: ${{$node[\"HTTP Request\"].json.data.items[0].price}}\n```\n\n### Example 3: Format Timestamp\n\n```javascript\n\u002F\u002F Current date\n{{$now.toFormat('yyyy-MM-dd')}}\n\u002F\u002F Result: 2025-10-20\n\n\u002F\u002F Time\n{{$now.toFormat('HH:mm:ss')}}\n\u002F\u002F Result: 14:30:45\n\n\u002F\u002F Full datetime\n{{$now.toFormat('yyyy-MM-dd HH:mm')}}\n\u002F\u002F Result: 2025-10-20 14:30\n```\n\n---\n\n## Data Type Handling\n\n### Arrays\n\n```javascript\n\u002F\u002F First item\n{{$json.users[0].email}}\n\n\u002F\u002F Array length\n{{$json.users.length}}\n\n\u002F\u002F Last item\n{{$json.users[$json.users.length - 1].name}}\n```\n\n### Objects\n\n```javascript\n\u002F\u002F Dot notation (no spaces)\n{{$json.user.email}}\n\n\u002F\u002F Bracket notation (with spaces or dynamic)\n{{$json['user data'].email}}\n```\n\n### Strings\n\n```javascript\n\u002F\u002F Concatenation (automatic)\nHello {{$json.name}}!\n\n\u002F\u002F String methods\n{{$json.email.toLowerCase()}}\n{{$json.name.toUpperCase()}}\n```\n\n### Numbers\n\n```javascript\n\u002F\u002F Direct use\n{{$json.price}}\n\n\u002F\u002F Math operations\n{{$json.price * 1.1}}  \u002F\u002F Add 10%\n{{$json.quantity + 5}}\n```\n\n---\n\n## Advanced Patterns\n\n### Conditional Content\n\n```javascript\n\u002F\u002F Ternary operator\n{{$json.status === 'active' ? 'Active User' : 'Inactive User'}}\n\n\u002F\u002F Default values\n{{$json.email || 'no-email@example.com'}}\n```\n\n### Date Manipulation\n\n```javascript\n\u002F\u002F Add days\n{{$now.plus({days: 7}).toFormat('yyyy-MM-dd')}}\n\n\u002F\u002F Subtract hours\n{{$now.minus({hours: 24}).toISO()}}\n\n\u002F\u002F Set specific date\n{{DateTime.fromISO('2025-12-25').toFormat('MMMM dd, yyyy')}}\n```\n\n### String Manipulation\n\n```javascript\n\u002F\u002F Substring\n{{$json.email.substring(0, 5)}}\n\n\u002F\u002F Replace\n{{$json.message.replace('old', 'new')}}\n\n\u002F\u002F Split and join\n{{$json.tags.split(',').join(', ')}}\n```\n\n---\n\n## Performance: expression complexity is (almost) free\n\nA common worry is that a complex `{{ }}` is slow. It isn't — what costs is *how many times* n8n evaluates an expression, not how elaborate each one is.\n\nMeasured on an n8n 2.x instance, an elaborate expression (`sqrt`, `split`, `reduce`, arithmetic) costs the same per item as a trivial `{{ $json.x > 50 }}` — roughly **~0.2 ms\u002Fitem either way**, because ~90% of that is n8n building the per-item evaluation context, not running your expression.\n\nWhat this means in practice:\n\n- **Don't break a working expression into a chain of nodes for \"speed.\"** Each extra node re-evaluates per item and re-copies all items; one node with one richer expression beats three nodes with simple ones.\n- **An expression (~0.2 ms\u002Fitem) is ~3× cheaper than a Code node in \"Run Once for Each Item\" mode** (~0.6 ms\u002Fitem) for the same per-item check — but a Code node in \"Run Once for All Items\" mode is cheaper still (~0.02 ms\u002Fitem), because it crosses the per-item boundary once instead of N times.\n- This only bites at **thousands of items**; below that it's sub-100 ms. The **n8n Code JavaScript** skill has the full per-item-boundary model.\n\n---\n\n## Debugging Expressions\n\n### Test in Expression Editor\n\n1. Click field with expression\n2. Open expression editor (click \"fx\" icon)\n3. See live preview of result\n4. Check for errors highlighted in red\n\n### Common Error Messages\n\n**\"Cannot read property 'X' of undefined\"**\n→ Parent object doesn't exist\n→ Check your data path\n\n**\"X is not a function\"**\n→ Trying to call method on non-function\n→ Check variable type\n\n**Expression shows as literal text**\n→ Missing {{ }}\n→ Add curly braces\n\n---\n\n## Expression Helpers\n\n### Available Methods\n\n**String**:\n- `.toLowerCase()`, `.toUpperCase()`\n- `.trim()`, `.replace()`, `.substring()`\n- `.split()`, `.includes()`\n\n**Array**:\n- `.length`, `.map()`, `.filter()`\n- `.find()`, `.join()`, `.slice()`\n\n**DateTime** (Luxon):\n- `.toFormat()`, `.toISO()`, `.toLocal()`\n- `.plus()`, `.minus()`, `.set()`\n\n**Number**:\n- `.toFixed()`, `.toString()`\n- Math operations: `+`, `-`, `*`, `\u002F`, `%`\n\n---\n\n## Best Practices\n\n### ✅ Do\n\n- Always use {{ }} for dynamic content\n- Use bracket notation for field names with spaces\n- Reference webhook data from `.body`\n- Use $node for data from other nodes\n- Test expressions in expression editor\n\n### ❌ Don't\n\n- Don't use expressions in Code nodes\n- Don't forget quotes around node names with spaces\n- Don't double-wrap with extra {{ }}\n- Don't assume webhook data is at root (it's under .body!)\n- Don't use expressions in webhook paths or credentials\n\n---\n\n## Related Skills\n\n- **n8n MCP Tools Expert**: Learn how to validate expressions using MCP tools\n- **n8n Workflow Patterns**: See expressions in real workflow examples\n- **n8n Node Configuration**: Understand when expressions are needed\n\n---\n\n## Summary\n\n**Essential Rules**:\n1. Wrap expressions in {{ }}\n2. Webhook data is under `.body`\n3. No {{ }} in Code nodes\n4. Quote node names with spaces\n5. Node names are case-sensitive\n\n**Most Common Mistakes**:\n- Missing {{ }} → Add braces\n- `{{$json.name}}` in webhooks → Use `{{$json.body.name}}`\n- `{{$json.email}}` in Code → Use `$json.email`\n- `{{$node.HTTP Request}}` → Use `{{$node[\"HTTP Request\"]}}`\n\nFor more details, see:\n- [COMMON_MISTAKES.md](COMMON_MISTAKES.md) - Complete error catalog\n- [EXAMPLES.md](EXAMPLES.md) - Real workflow examples\n\n---\n\n**Need Help?** Reference the n8n expression documentation or use n8n-mcp validation tools to check your expressions.\n","# n8n Expression Syntax\n\nExpert guide for writing correct n8n expressions in workflows.\n\n---\n\n## Expression Format\n\nAll dynamic content in n8n uses **double curly braces**:\n\n```\n{{expression}}\n```\n\n**Examples**:\n```\n✅ {{$json.email}}\n✅ {{$json.body.name}}\n✅ {{$node[\"HTTP Request\"].json.data}}\n❌ $json.email  (no braces - treated as literal text)\n❌ {$json.email}  (single braces - invalid)\n```\n\n---\n\n## Core Variables\n\n### $json - Current Node Output\n\nAccess data from the current node:\n\n```javascript\n{{$json.fieldName}}\n{{$json['field with spaces']}}\n{{$json.nested.property}}\n{{$json.items[0].name}}\n```\n\n### $node - Reference Other Nodes\n\nAccess data from any previous node:\n\n```javascript\n{{$node[\"Node Name\"].json.fieldName}}\n{{$node[\"HTTP Request\"].json.data}}\n{{$node[\"Webhook\"].json.body.email}}\n```\n\n**Important**:\n- Node names **must** be in quotes\n- Node names are **case-sensitive**\n- Must match exact node name from workflow\n\n### $now - Current Timestamp\n\nAccess current date\u002Ftime:\n\n```javascript\n{{$now}}\n{{$now.toFormat('yyyy-MM-dd')}}\n{{$now.toFormat('HH:mm:ss')}}\n{{$now.plus({days: 7})}}\n```\n\n### $env - Environment Variables\n\nAccess environment variables:\n\n```javascript\n{{$env.API_KEY}}\n{{$env.DATABASE_URL}}\n```\n\n**Warning**: Some n8n instances have `N8N_BLOCK_ENV_ACCESS_IN_NODE` enabled, which blocks `$env` access entirely. If `$env` returns errors, use alternative approaches:\n- Store values in credentials instead\n- Use a Set node with manually entered values\n- Pass values through webhook query parameters\n\n---\n\n## 🚨 CRITICAL: Webhook Data Structure\n\n**Most Common Mistake**: Webhook data is **NOT** at the root!\n\n### Webhook Node Output Structure\n\n```javascript\n{\n  \"headers\": {...},\n  \"params\": {...},\n  \"query\": {...},\n  \"body\": {           \u002F\u002F ⚠️ USER DATA IS HERE!\n    \"name\": \"John\",\n    \"email\": \"john@example.com\",\n    \"message\": \"Hello\"\n  }\n}\n```\n\n### Correct Webhook Data Access\n\n```javascript\n❌ WRONG: {{$json.name}}\n❌ WRONG: {{$json.email}}\n\n✅ CORRECT: {{$json.body.name}}\n✅ CORRECT: {{$json.body.email}}\n✅ CORRECT: {{$json.body.message}}\n```\n\n**Why**: Webhook node wraps incoming data under `.body` property to preserve headers, params, and query parameters.\n\n---\n\n## Common Patterns\n\n### Access Nested Fields\n\n```javascript\n\u002F\u002F Simple nesting\n{{$json.user.email}}\n\n\u002F\u002F Array access\n{{$json.data[0].name}}\n{{$json.items[0].id}}\n\n\u002F\u002F Bracket notation for spaces\n{{$json['field name']}}\n{{$json['user data']['first name']}}\n```\n\n### Reference Other Nodes\n\n```javascript\n\u002F\u002F Node without spaces\n{{$node[\"Set\"].json.value}}\n\n\u002F\u002F Node with spaces (common!)\n{{$node[\"HTTP Request\"].json.data}}\n{{$node[\"Respond to Webhook\"].json.message}}\n\n\u002F\u002F Webhook node\n{{$node[\"Webhook\"].json.body.email}}\n```\n\n### Combine Variables\n\n```javascript\n\u002F\u002F Concatenation (automatic)\nHello {{$json.body.name}}!\n\n\u002F\u002F In URLs\nhttps:\u002F\u002Fapi.example.com\u002Fusers\u002F{{$json.body.user_id}}\n\n\u002F\u002F In object properties\n{\n  \"name\": \"={{$json.body.name}}\",\n  \"email\": \"={{$json.body.email}}\"\n}\n```\n\n---\n\n## When NOT to Use Expressions\n\n### ❌ Code Nodes\n\nCode nodes use **direct JavaScript access**, NOT expressions!\n\n```javascript\n\u002F\u002F ❌ WRONG in Code node\nconst email = '={{$json.email}}';\nconst name = '{{$json.body.name}}';\n\n\u002F\u002F ✅ CORRECT in Code node\nconst email = $json.email;\nconst name = $json.body.name;\n\n\u002F\u002F Or using Code node API\nconst email = $input.item.json.email;\nconst allItems = $input.all();\n```\n\n### ❌ Webhook Paths\n\n```javascript\n\u002F\u002F ❌ WRONG\npath: \"{{$json.user_id}}\u002Fwebhook\"\n\n\u002F\u002F ✅ CORRECT\npath: \"user-webhook\"  \u002F\u002F Static paths only\n```\n\n### ❌ Credential Fields\n\n```javascript\n\u002F\u002F ❌ WRONG\napiKey: \"={{$env.API_KEY}}\"\n\n\u002F\u002F ✅ CORRECT\nUse n8n credential system, not expressions\n```\n\n---\n\n## The transform gatekeeper\n\nBefore you add any node — or write any code — to transform data, walk this order and stop at the first that fits:\n\n1. **Expression** (`{{ ... }}`) in the consuming field. Property access, method chains (`.map().filter().join()`), ternaries, string building, Luxon date math — if it's \"take A, produce B\" without intermediate variables, it's an expression. This covers most \"just transform this\" cases.\n2. **Arrow-function IIFE inside an Edit Fields field.** When the logic needs intermediate variables, branching, or comments but still operates on one item, wrap it in an immediately-invoked arrow function right in the field value:\n\n   ```\n   ={{ (() => {\n       const items = $json.line_items;\n       const subtotal = items.reduce((sum, it) => sum + it.price * it.qty, 0);\n       const tax = subtotal * 0.08;\n       return (subtotal + tax).toFixed(2);\n   })() }}\n   ```\n\n   The outer `(...)` brackets the function; the trailing `()` invokes it. Drop either and n8n refuses to run. Inside you get the full expression scope (`$json`, `$('Node')`, `$now`, Luxon) plus `const`\u002F`let`, `if`\u002F`switch`, `try`\u002F`catch`, and regex. No `require`, no `await`.\n3. **Code node — last resort.** Only when you need multi-item aggregation across the whole dataset (`$input.all()`), an allowlisted library, or async work.\n\n**Why the order matters.** It's not style — it's readability and performance. The Code node runs in a sandboxed VM with per-invocation setup and value marshaling — a cold-start cost that can reach 500–1000ms before your logic runs. (It amortizes on warm, high-item-count runs, so treat this as the common-case cost, not a universal constant.) The same logic in an expression or Edit Fields IIFE runs in-process in single-digit milliseconds and skips the sandbox entirely. For pure single-item shaping that's a large gap with no functional difference, and it compounds on hot paths like per-request webhooks. The expression also stays visible in the field that uses it, instead of hiding in an upstream node someone has to open to understand. Reach past a stage only when the input or scope genuinely demands it.\n\n## The Set-node antipattern and branch convergence\n\n### Delete Set nodes that feed one consumer\n\nA Set \u002F Edit Fields node whose only job is to extract a value and hand it to **one** downstream node is dead weight. Inline its expression at the consumer instead.\n\n```\n❌  Webhook → Set { customer_id: {{ $json.body.customer_id }} } → Postgres: WHERE id = {{ $json.customer_id }}\n\n✅  Webhook → Postgres: WHERE id = {{ $('Webhook').item.json.body.customer_id }}\n```\n\nThe Set node adds a hop, more canvas clutter, and a refactor hazard, while doing nothing the consumer couldn't do itself. To remove it cleanly with `n8n_update_partial_workflow`: rewire the connection (`removeConnection` from the Set's source-and-target, `addConnection` straight from source to consumer), `patchNodeField` the consumer's expression to reference the original source by node name, then `removeNode` the Set.\n\n**Quick test:** count how many downstream nodes reference each field the Set produces.\n- **0 or 1** → delete, inline at the consumer.\n- **2+** → it may earn its place.\n\n**Legitimate exceptions** — keep the Set when:\n- **2+ consumers** read the same derived value and the derivation is non-trivial (a name aids readability and you compute it once).\n- **It's a sub-workflow's final Return node**, shaping the output contract. Here the \"single consumer\" is every caller, so the Set *is* the API boundary — and with `Include Other Fields: false` it whitelists the output shape so internal scratch fields don't leak.\n- **You're renaming or whitelisting fields** and want that visible in one place rather than spread across consumer expressions.\n\n### Branch convergence: anchor with a NoOp\n\nWhen branches converge (after IF\u002FSwitch\u002FMerge), `$json` becomes \"whichever branch fired last\" — non-deterministic, and a silent source of wrong data. Insert a **NoOp** node at the convergence, name it descriptively (`Combine Inputs`), and have downstream nodes reference it by name:\n\n```\nBranch A ──┐\n           ├─→ [NoOp: Combine Inputs] ──→ downstream uses $('Combine Inputs').item.json.x\nBranch B ──┘\n```\n\nThe NoOp survives refactors: inserting a transform later between it and the consumer doesn't break the `$('Combine Inputs')` reference. (If the branches produce *different* shapes, use a Set node instead of a NoOp to normalize both into one shape — see the exceptions above.)\n\nMore broadly in branchy flows, **prefer `$('Node').item.json.x` over deep `$json.x`.** `$json` breaks the moment an intermediate node is inserted or a node clears item context (Aggregate, Code with Run for All, branching merges); the failure is silent and downstream gets the wrong data with no error. A node-name reference is unambiguous regardless of what sits between source and consumer.\n\n---\n\n## Validation Rules\n\n### 1. Always Use {{}}\n\nExpressions **must** be wrapped in double curly braces.\n\n```javascript\n❌ $json.field\n✅ {{$json.field}}\n```\n\n### 2. Use Quotes for Spaces and Special Characters\n\nField or node names with spaces, diacritics, or special characters require **bracket notation**:\n\n```javascript\n❌ {{$json.field name}}\n✅ {{$json['field name']}}\n\n❌ {{$node.HTTP Request.json}}\n✅ {{$node[\"HTTP Request\"].json}}\n\n\u002F\u002F Bracket notation is mandatory for keys with special characters\n✅ {{$json['Gross Price w\u002Fo shipment']}}\n✅ {{$json['Cena brutto zł']}}\n```\n\n### 3. Match Exact Node Names\n\nNode references are **case-sensitive**:\n\n```javascript\n❌ {{$node[\"http request\"].json}}  \u002F\u002F lowercase\n❌ {{$node[\"Http Request\"].json}}  \u002F\u002F wrong case\n✅ {{$node[\"HTTP Request\"].json}}  \u002F\u002F exact match\n```\n\n### 4. No Nested {{}}\n\nDon't double-wrap expressions:\n\n```javascript\n❌ {{{$json.field}}}\n✅ {{$json.field}}\n```\n\n---\n\n## Common Mistakes\n\nFor complete error catalog with fixes, see [COMMON_MISTAKES.md](COMMON_MISTAKES.md)\n\n### Quick Fixes\n\n| Mistake | Fix |\n|---------|-----|\n| `$json.field` | `{{$json.field}}` |\n| `{{$json.field name}}` | `{{$json['field name']}}` |\n| `{{$node.HTTP Request}}` | `{{$node[\"HTTP Request\"]}}` |\n| `{{{$json.field}}}` | `{{$json.field}}` |\n| `{{$json.name}}` (webhook) | `{{$json.body.name}}` |\n| `'={{$json.email}}'` (Code node) | `$json.email` |\n\n---\n\n## Working Examples\n\nFor real workflow examples, see [EXAMPLES.md](EXAMPLES.md)\n\n### Example 1: Webhook to Slack\n\n**Webhook receives**:\n```json\n{\n  \"body\": {\n    \"name\": \"John Doe\",\n    \"email\": \"john@example.com\",\n    \"message\": \"Hello!\"\n  }\n}\n```\n\n**In Slack node text field**:\n```\nNew form submission!\n\nName: {{$json.body.name}}\nEmail: {{$json.body.email}}\nMessage: {{$json.body.message}}\n```\n\n### Example 2: HTTP Request to Email\n\n**HTTP Request returns**:\n```json\n{\n  \"data\": {\n    \"items\": [\n      {\"name\": \"Product 1\", \"price\": 29.99}\n    ]\n  }\n}\n```\n\n**In Email node** (reference HTTP Request):\n```\nProduct: {{$node[\"HTTP Request\"].json.data.items[0].name}}\nPrice: ${{$node[\"HTTP Request\"].json.data.items[0].price}}\n```\n\n### Example 3: Format Timestamp\n\n```javascript\n\u002F\u002F Current date\n{{$now.toFormat('yyyy-MM-dd')}}\n\u002F\u002F Result: 2025-10-20\n\n\u002F\u002F Time\n{{$now.toFormat('HH:mm:ss')}}\n\u002F\u002F Result: 14:30:45\n\n\u002F\u002F Full datetime\n{{$now.toFormat('yyyy-MM-dd HH:mm')}}\n\u002F\u002F Result: 2025-10-20 14:30\n```\n\n---\n\n## Data Type Handling\n\n### Arrays\n\n```javascript\n\u002F\u002F First item\n{{$json.users[0].email}}\n\n\u002F\u002F Array length\n{{$json.users.length}}\n\n\u002F\u002F Last item\n{{$json.users[$json.users.length - 1].name}}\n```\n\n### Objects\n\n```javascript\n\u002F\u002F Dot notation (no spaces)\n{{$json.user.email}}\n\n\u002F\u002F Bracket notation (with spaces or dynamic)\n{{$json['user data'].email}}\n```\n\n### Strings\n\n```javascript\n\u002F\u002F Concatenation (automatic)\nHello {{$json.name}}!\n\n\u002F\u002F String methods\n{{$json.email.toLowerCase()}}\n{{$json.name.toUpperCase()}}\n```\n\n### Numbers\n\n```javascript\n\u002F\u002F Direct use\n{{$json.price}}\n\n\u002F\u002F Math operations\n{{$json.price * 1.1}}  \u002F\u002F Add 10%\n{{$json.quantity + 5}}\n```\n\n---\n\n## Advanced Patterns\n\n### Conditional Content\n\n```javascript\n\u002F\u002F Ternary operator\n{{$json.status === 'active' ? 'Active User' : 'Inactive User'}}\n\n\u002F\u002F Default values\n{{$json.email || 'no-email@example.com'}}\n```\n\n### Date Manipulation\n\n```javascript\n\u002F\u002F Add days\n{{$now.plus({days: 7}).toFormat('yyyy-MM-dd')}}\n\n\u002F\u002F Subtract hours\n{{$now.minus({hours: 24}).toISO()}}\n\n\u002F\u002F Set specific date\n{{DateTime.fromISO('2025-12-25').toFormat('MMMM dd, yyyy')}}\n```\n\n### String Manipulation\n\n```javascript\n\u002F\u002F Substring\n{{$json.email.substring(0, 5)}}\n\n\u002F\u002F Replace\n{{$json.message.replace('old', 'new')}}\n\n\u002F\u002F Split and join\n{{$json.tags.split(',').join(', ')}}\n```\n\n---\n\n## Performance: expression complexity is (almost) free\n\nA common worry is that a complex `{{ }}` is slow. It isn't — what costs is *how many times* n8n evaluates an expression, not how elaborate each one is.\n\nMeasured on an n8n 2.x instance, an elaborate expression (`sqrt`, `split`, `reduce`, arithmetic) costs the same per item as a trivial `{{ $json.x > 50 }}` — roughly **~0.2 ms\u002Fitem either way**, because ~90% of that is n8n building the per-item evaluation context, not running your expression.\n\nWhat this means in practice:\n\n- **Don't break a working expression into a chain of nodes for \"speed.\"** Each extra node re-evaluates per item and re-copies all items; one node with one richer expression beats three nodes with simple ones.\n- **An expression (~0.2 ms\u002Fitem) is ~3× cheaper than a Code node in \"Run Once for Each Item\" mode** (~0.6 ms\u002Fitem) for the same per-item check — but a Code node in \"Run Once for All Items\" mode is cheaper still (~0.02 ms\u002Fitem), because it crosses the per-item boundary once instead of N times.\n- This only bites at **thousands of items**; below that it's sub-100 ms. The **n8n Code JavaScript** skill has the full per-item-boundary model.\n\n---\n\n## Debugging Expressions\n\n### Test in Expression Editor\n\n1. Click field with expression\n2. Open expression editor (click \"fx\" icon)\n3. See live preview of result\n4. Check for errors highlighted in red\n\n### Common Error Messages\n\n**\"Cannot read property 'X' of undefined\"**\n→ Parent object doesn't exist\n→ Check your data path\n\n**\"X is not a function\"**\n→ Trying to call method on non-function\n→ Check variable type\n\n**Expression shows as literal text**\n→ Missing {{ }}\n→ Add curly braces\n\n---\n\n## Expression Helpers\n\n### Available Methods\n\n**String**:\n- `.toLowerCase()`, `.toUpperCase()`\n- `.trim()`, `.replace()`, `.substring()`\n- `.split()`, `.includes()`\n\n**Array**:\n- `.length`, `.map()`, `.filter()`\n- `.find()`, `.join()`, `.slice()`\n\n**DateTime** (Luxon):\n- `.toFormat()`, `.toISO()`, `.toLocal()`\n- `.plus()`, `.minus()`, `.set()`\n\n**Number**:\n- `.toFixed()`, `.toString()`\n- Math operations: `+`, `-`, `*`, `\u002F`, `%`\n\n---\n\n## Best Practices\n\n### ✅ Do\n\n- Always use {{ }} for dynamic content\n- Use bracket notation for field names with spaces\n- Reference webhook data from `.body`\n- Use $node for data from other nodes\n- Test expressions in expression editor\n\n### ❌ Don't\n\n- Don't use expressions in Code nodes\n- Don't forget quotes around node names with spaces\n- Don't double-wrap with extra {{ }}\n- Don't assume webhook data is at root (it's under .body!)\n- Don't use expressions in webhook paths or credentials\n\n---\n\n## Related Skills\n\n- **n8n MCP Tools Expert**: Learn how to validate expressions using MCP tools\n- **n8n Workflow Patterns**: See expressions in real workflow examples\n- **n8n Node Configuration**: Understand when expressions are needed\n\n---\n\n## Summary\n\n**Essential Rules**:\n1. Wrap expressions in {{ }}\n2. Webhook data is under `.body`\n3. No {{ }} in Code nodes\n4. Quote node names with spaces\n5. Node names are case-sensitive\n\n**Most Common Mistakes**:\n- Missing {{ }} → Add braces\n- `{{$json.name}}` in webhooks → Use `{{$json.body.name}}`\n- `{{$json.email}}` in Code → Use `$json.email`\n- `{{$node.HTTP Request}}` → Use `{{$node[\"HTTP Request\"]}}`\n\nFor more details, see:\n- [COMMON_MISTAKES.md](COMMON_MISTAKES.md) - Complete error catalog\n- [EXAMPLES.md](EXAMPLES.md) - Real workflow examples\n\n---\n\n**Need Help?** Reference the n8n expression documentation or use n8n-mcp validation tools to check your expressions.\n",{"name":5,"description":7},"main","98985c16dc8df1bbd7dcd1bc698cd997a093e751","N8N agent\u002Fplaybooks\u002Fn8n-expression-syntax","https:\u002F\u002Fgithub.com\u002F26BB\u002Fagent-fleet-os","https:\u002F\u002Fgithub.com\u002F26BB","🚀 Aspiring Product Manager | CS @ GS Moze\r\n\r\n🛠️ Building 0→1 products across SaaS & clean-tech\r\n\r\n📊 Turning user feedback & data into shipped features","2026-11-05 13:34:38",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add 26BB\u002Fagent-fleet-os --skill n8n-expression-syntax",{"tool":37,"command":38},"bunx","bunx skills add 26BB\u002Fagent-fleet-os --skill n8n-expression-syntax",{"tool":40,"command":41},"pnpm","pnpm dlx skills add 26BB\u002Fagent-fleet-os --skill n8n-expression-syntax","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002F26BB\u002Fagent-fleet-os\u002Fblob\u002Fmain\u002FN8N agent\u002Fplaybooks\u002Fn8n-expression-syntax\u002FSKILL.md",true,[45,51,55],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"COMMON_MISTAKES.md","REFERENCE","参考文档",9653,"https:\u002F\u002Fgithub.com\u002F26BB\u002Fagent-fleet-os\u002Fblob\u002Fmain\u002FN8N agent\u002Fplaybooks\u002Fn8n-expression-syntax\u002FCOMMON_MISTAKES.md",{"path":52,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":53,"sourceHtmlUrl":54},"EXAMPLES.md",8303,"https:\u002F\u002Fgithub.com\u002F26BB\u002Fagent-fleet-os\u002Fblob\u002Fmain\u002FN8N agent\u002Fplaybooks\u002Fn8n-expression-syntax\u002FEXAMPLES.md",{"path":56,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":57,"sourceHtmlUrl":58},"README.md",2261,"https:\u002F\u002Fgithub.com\u002F26BB\u002Fagent-fleet-os\u002Fblob\u002Fmain\u002FN8N agent\u002Fplaybooks\u002Fn8n-expression-syntax\u002FREADME.md",[60,67,74,81,88,95],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M7F51NQSCRM2PWFMATCV9MEG","taste-design","Semantic Design System Skill for Google Stitch. Generates agent-friendly DESIGN.md files that enforce premium, anti-generic UI standards — strict typography, calibrated color, asymmetric layouts, perpetual micro-motion, and hardware-accelerated performance.","https:\u002F\u002Fgithub.com\u002F26BB\u002Fagent-fleet-os\u002Fblob\u002Fmain\u002Fstitch agent\u002Fplugins\u002Fstitch-utilities\u002Fplaybooks\u002Ftaste-design\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M7F51JGTS9VJ3S9T6VMQWZ08","stitch-loop","Teaches agents to iteratively build websites using Stitch with an autonomous baton-passing loop pattern","https:\u002F\u002Fgithub.com\u002F26BB\u002Fagent-fleet-os\u002Fblob\u002Fmain\u002Fstitch agent\u002Fplugins\u002Fstitch-utilities\u002Fplaybooks\u002Fstitch-loop\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M7F51EZR2XYDWMA3XKWH1HX2","site-md","Analyze a project description or site requirements and synthesize a project constitution into SITE.md for the Stitch Build Loop","https:\u002F\u002Fgithub.com\u002F26BB\u002Fagent-fleet-os\u002Fblob\u002Fmain\u002Fstitch agent\u002Fplugins\u002Fstitch-utilities\u002Fplaybooks\u002Fsite-md\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M7F51BNCMP0GQ7SGP39SZYDP","enhance-prompt","Transforms vague UI ideas into polished, Stitch-optimized prompts. Enhances specificity, adds UI\u002FUX keywords, injects design system context, and structures output for better generation results.","https:\u002F\u002Fgithub.com\u002F26BB\u002Fagent-fleet-os\u002Fblob\u002Fmain\u002Fstitch agent\u002Fplugins\u002Fstitch-utilities\u002Fplaybooks\u002Fenhance-prompt\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M7F518SX707EB3X42B2V7HRA","design-md","Analyze Stitch projects and synthesize a semantic design system into DESIGN.md files","https:\u002F\u002Fgithub.com\u002F26BB\u002Fagent-fleet-os\u002Fblob\u002Fmain\u002Fstitch agent\u002Fplugins\u002Fstitch-utilities\u002Fplaybooks\u002Fdesign-md\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":19},"01M7F5148PVYTA76NR3X0YK8SK","stitch::upload-to-stitch","Upload local assets (images, mockups, extracted HTML, design markdown) to a Stitch project. ALWAYS use this skill when you need to upload visual assets, HTML pages, or design docs to Stitch, particularly when direct MCP tool calls fail or truncate due to base64 token limits.","https:\u002F\u002Fgithub.com\u002F26BB\u002Fagent-fleet-os\u002Fblob\u002Fmain\u002Fstitch agent\u002Fplugins\u002Fstitch-design\u002Fplaybooks\u002Fupload-to-stitch\u002FSKILL.md",[],[]]