n8n-expression-syntax – skill Viết lách & Nội dung cho agent AI
Kiểm tra cú pháp expression của n8n và sửa các lỗi thường gặp. Dùng khi viết expression n8n, dùng cú pháp {{}}, truy cập biến $json/$node, xử lý lỗi expression hoặc làm việc với dữ liệu webhook trong workflow.
Cài skill n8n-expression-syntax bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/n8n-expression-syntax-1020c.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /n8n-expression-syntax – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/n8n-expression-syntax-1020c.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $n8n-expression-syntax – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/n8n-expression-syntax-1020c.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /n8n-expression-syntax – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/n8n-expression-syntax-1020c.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /n8n-expression-syntax – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
n8n Expression Syntax
Expert guide for writing correct n8n expressions in workflows.
Execution and data scope
EXAMPLES.md and COMMON_MISTAKES.md referenced below/in the guide are not bundled. $json in expression parameters represents the current input item, not a completed current node output; inspect actual execution data and item linking before referencing another node. Code-node APIs differ between per-item and all-items modes. Use credentials for secrets: the guide's $env examples can expose values and may be disabled. Avoid putting secrets/personal webhook data into messages or logs. Encode URL path/query components, guard missing arrays/objects and validate untrusted values before downstream actions. Test expressions with synthetic input; preview success is not authorization to send Slack/email messages.
Detailed Guide
Read [the detailed guide](references/detailed-guide.md) before executing this skill. It retains the complete procedure and reference material. Treat its safety, prerequisites, and validation requirements as mandatory. For focused work, load the relevant sections; for end-to-end work, read the guide completely.
When to Use
- You need to write or debug n8n expressions using
{{ ... }}syntax. - The task involves
$json,$node, webhook payloads, or expression-related workflow errors. - You want syntax-correct dynamic values inside n8n nodes and parameters.
---
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---
Working Examples
For real workflow examples, see EXAMPLES.md
Example 1: Webhook to Slack
Webhook receives:
{
"body": {
"name": "John Doe",
"email": "[email protected]",
"message": "Hello!"
}
}In Slack node text field:
New form submission!
Name: {{$json.body.name}}
Email: {{$json.body.email}}
Message: {{$json.body.message}}Example 2: HTTP Request to Email
HTTP Request returns:
{
"data": {
"items": [
{"name": "Product 1", "price": 29.99}
]
}
}In Email node (reference HTTP Request):
Product: {{$node["HTTP Request"].json.data.items[0].name}}
Price: ${{$node["HTTP Request"].json.data.items[0].price}}Example 3: Format Timestamp
// Current date
{{$now.toFormat('yyyy-MM-dd')}}
// Result: 2025-10-20
// Time
{{$now.toFormat('HH:mm:ss')}}
// Result: 14:30:45
// Full datetime
{{$now.toFormat('yyyy-MM-dd HH:mm')}}
// Result: 2025-10-20 14:30---
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Skill liên quan
- n8n-multi-instance – Chọn, xác minh và chuyển an toàn giữa các instance MCP của n8n trên môi trường…
- neon-postgres-branches – Chọn và tạo đúng loại nhánh Neon để kiểm thử và phát triển. Dùng khi người dùng hỏi về…
- neon-postgres-egress-optimizer – Chẩn đoán và khắc phục lưu lượng egress (truyền dữ liệu mạng) Postgres quá mức trong…
- obsidian-bases – Tạo và chỉnh sửa Obsidian Bases (tệp .base) với view, bộ lọc, công thức và tổng hợp…
- obsidian-clipper-template-creator – Hướng dẫn tạo template cho Obsidian Web Clipper. Dùng khi muốn tạo template clip mới…
- odoo-orm-expert – Nắm vững các mẫu ORM của Odoo: search, browse, create, write, domain filter, computed…
- odoo-performance-tuner – Hướng dẫn chuyên sâu chẩn đoán và khắc phục sự cố hiệu năng Odoo: truy vấn chậm, cấu…
- odoo-upgrade-advisor – Trợ lý nâng cấp phiên bản Odoo từng bước: checklist trước nâng cấp, lộ trình nâng cấp…