npx agentspec-cli install 4d193a2e-0cb8-467a-bc9b-90e35aeac2eb --file-type cursor-rules→ .cursor/rules/
---
description: Guidance for writing correct n8n expressions ({{ }} syntax). Use when mapping data between nodes or accessing $json, $node, or $now variables.
globs: **/*.json
---
# n8n Expression Syntax
Expert guide for writing correct n8n expressions in workflows.
## The Rule of Double Braces
All dynamic content in n8n MUST be wrapped in double curly braces:
- ✅ `{{$json.email}}`
- ✅ `{{$json.body.name}}`
- ✅ `{{$node["HTTP Request"].json.data}}`
- ❌ `$json.email` (literal text)
- ❌ `{{$json.email}}` (inside a Code node)
## 🚨 CRITICAL: Webhook Data Structure
**Webhook data is NEVER at the root.** It is always nested under `.body`.
- ❌ WRONG: `{{$json.name}}`
- ✅ CORRECT: `{{$json.body.name}}`
## Referencing Other Nodes
- Node names MUST be in quotes and are case-sensitive.
- ✅ `{{$node["HTTP Request"].json.data}}`
- ❌ `{{$node.HTTP Request.json.data}}` (Missing quotes)
- ❌ `{{$node["http request"].json.data}}` (Wrong case)
## Core Variables
- `$json`: Current node output.
- `$node["Name"]`: Reference a specific node.
- `$now`: Current timestamp (Luxon). Use `{{$now.toFormat('yyyy-MM-dd')}}`.
- `$env`: Environment variables.
## Expressions vs. Code Node
- **Other Nodes**: Use `{{$json.field}}`.
- **Code Nodes**: Use direct JavaScript access `$json.field` or `$input.item.json.field`. **DO NOT** use `{{ }}` in Code nodes.
## Common Fixes
- **Spaces in fields**: Use `{{$json['field name']}}`.
- **Default values**: Use `{{$json.field || 'default'}}`.
- **Simple Logic**: Use ternary `{{$json.status === 'active' ? 'Yes' : 'No'}}`.
Role and Expertise:
You are a proficient software engineer specializing in n8n custom node development with the following expertise:
by AgentHub Crawler
N8n Nodes Sevdesk V2 Configuration
Claude Code project instructions and development guidelines.
by AgentHub Crawler
Core Node.js — Cursor Rules
You are an expert Node.js developer and educator. You write clean, idiomatic JavaScript/TypeScript code that serves as a learning reference. Your code is readable, well-documented, and follows established Node.js conventions.
by AgentHub Crawler
syntax-and-formatting
Sign in to leave a comment.
Cursor IDE rules and conventions for AI-assisted development.
by AgentHub Crawler