n8n-builder
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese[H1][N8N-BUILDER]
[H1][N8N-BUILDER]
<br>Dictum: Schema compliance enables n8n import without runtime validation errors.
Generate valid n8n workflow JSON.
Tasks:
- Read schema.md — Root structure, settings
- Read nodes.md — Node definition, typeVersion
- Read connections.md — Graph topology, AI types
- (dynamic values) Read expressions.md — Variables, functions
- (specific nodes) Read integrations.md — Node parameters
- Generate JSON — Apply template from workflow.template.md
- Validate — Run
uv run .claude/skills/n8n-builder/scripts/validate-workflow.py
[REFERENCE]: index.md — File listing.
<br>准则: 遵循架构规范可确保n8n导入时无运行时验证错误。
生成有效的n8n工作流JSON。
任务:
- 阅读 schema.md — 根结构、设置项
- 阅读 nodes.md — 节点定义、typeVersion
- 阅读 connections.md — 图拓扑、AI类型
- (动态值)阅读 expressions.md — 变量、函数
- (特定节点)阅读 integrations.md — 节点参数
- 生成JSON — 应用 workflow.template.md 中的模板
- 验证 — 运行
uv run .claude/skills/n8n-builder/scripts/validate-workflow.py
[参考文献]: index.md — 文件列表。
[0][N8N_2.0]
[0][N8N_2.0]
<br>Dictum: Breaking changes invalidate pre-2025 patterns.
Breaking Changes (December 2025):
- — PostgreSQL required; MySQL/MariaDB support dropped.
Database - —
Pythonremoved; use"language": "python"with task runners."pythonNative" - —
SecurityandExecuteCommanddisabled by default.LocalFileTrigger - — Environment variable access blocked in Code nodes (
Code Isolation).N8N_BLOCK_ENV_ACCESS_IN_NODE=true - — Agent type selection removed (v1.82+); all agents are Tools Agent.
Agent Type
<br>准则: 重大变更会导致2025年前的模式失效。
重大变更(2025年12月):
- — 要求使用PostgreSQL;已移除对MySQL/MariaDB的支持。
Database - — 已移除
Python;需搭配任务运行器使用"language": "python"。"pythonNative" - —
Security和ExecuteCommand默认禁用。LocalFileTrigger - — Code节点中禁止访问环境变量(
Code Isolation)。N8N_BLOCK_ENV_ACCESS_IN_NODE=true - — 已移除Agent类型选择(v1.82+);所有Agent均为Tools Agent。
Agent Type
[1][SCHEMA]
[1][SCHEMA]
<br>Dictum: Root structure enables n8n parser recognition and execution.
Guidance:
- — Require
AI Workflowsin settings; async node ordering fails without.executionOrder: "v1" - — Credential IDs and errorWorkflow UUIDs are instance-specific; expect reassignment post-import.
Portability - — Include empty objects (
Optional Fields) over omission; prevents import edge cases."pinData": {} - — Use
Sub-Workflow Typingschema on trigger nodes to validate caller payloads before execution.workflowInputs - — Keep under 12MB; large payloads slow editor rendering and cannot contain binary data.
pinData Limits
Best-Practices:
- [ALWAYS] Set on generation; activation is a deployment decision.
"active": false - [NEVER] Hardcode credential IDs; use placeholder names for cross-instance transfer.
<br>准则: 根结构确保n8n解析器可识别并执行工作流。
指导说明:
- — 需在设置中指定
AI工作流;否则异步节点排序会失败。executionOrder: "v1" - — 凭据ID和错误工作流UUID为实例专属;导入后需重新分配。
可移植性 - — 应包含空对象(如
可选字段)而非省略;避免导入时出现边缘情况。"pinData": {} - — 在触发节点上使用
子工作流类型架构,可在执行前验证调用方负载。workflowInputs - — 大小需保持在12MB以下;大负载会拖慢编辑器渲染速度,且不能包含二进制数据。
pinData限制
最佳实践:
- [始终] 生成时设置;激活属于部署决策。
"active": false - [切勿] 硬编码凭据ID;使用占位符名称以实现跨实例迁移。
[2][NODES]
[2][NODES]
<br>Dictum: Unique identity enables deterministic cross-node references.
Guidance:
- — n8n auto-renames duplicates (Set→Set1); breaks
Name Collisionsexpressions silently.$('NodeName') - — typeVersion must match target n8n instance; newer versions may lack backward compatibility.
Version Matching - — Use
Error Strategyfor fault-tolerant pipelines; default stops execution.onError: "continueErrorOutput" - — Use
Node Documentationfield for inline documentation;notesdisplays on canvas.notesInFlow: true
Best-Practices:
- [ALWAYS] Generate UUID per node before building connections; connections reference node.name.
- [ALWAYS] Space nodes 200px horizontal, 150px vertical for canvas readability.
<br>准则: 唯一标识确保节点间引用的确定性。
指导说明:
- — n8n会自动重命名重复节点(如Set→Set1);这会导致
名称冲突表达式静默失效。$('NodeName') - — typeVersion必须与目标n8n实例匹配;新版本可能不兼容旧版本。
版本匹配 - — 对于容错管道,使用
错误策略;默认设置会终止执行。onError: "continueErrorOutput" - — 使用
节点文档字段添加内联文档;设置notes可在画布上显示。notesInFlow: true
最佳实践:
- [始终] 在构建连接前为每个节点生成UUID;连接会引用node.name。
- [始终] 将节点水平间隔200px、垂直间隔150px,以提升画布可读性。
[3][CONNECTIONS]
[3][CONNECTIONS]
<br>Dictum: Connection types enable workflow mode distinction at parse time.
Guidance:
- — AI nodes require specialized types (
AI vs Main,ai_tool);ai_languageModelcauses silent tool invisibility.main - — Single output to multiple nodes executes in parallel; order within array is non-deterministic.
Fan-out - — Array index maps to output port; IF node: index 0 = true branch, index 1 = false branch.
Multi-output - — Agent accepts exactly one
Single Modelconnection; multiple models conflict silently.ai_languageModel - —
Memory Scopepersists within single trigger execution only; no cross-session persistence.ai_memory
Best-Practices:
- [ALWAYS] Match connection key AND property; mismatches cause silent failures.
type - [NEVER] Connect AI tools via type; agent cannot discover them.
main - [NEVER] Connect multiple language models to single agent; use Model Selector node for dynamic selection.
<br>准则: 连接类型可在解析阶段区分工作流模式。
指导说明:
- — AI节点需使用专用类型(
AI与主流程、ai_tool);使用ai_languageModel类型会导致工具静默不可见。main - — 单个输出连接到多个节点时会并行执行;数组内的顺序是非确定性的。
扇出 - — 数组索引对应输出端口;IF节点:索引0 = 真分支,索引1 = 假分支。
多输出 - — Agent仅接受一个
单一模型连接;多个模型会静默冲突。ai_languageModel - —
内存范围仅在单次触发执行内持久化;无跨会话持久化。ai_memory
最佳实践:
- [始终] 匹配连接键和属性;不匹配会导致静默失败。
type - [切勿] 通过类型连接AI工具;Agent无法发现这些工具。
main - [切勿] 为单个Agent连接多个语言模型;使用Model Selector节点进行动态选择。
[4][EXPRESSIONS]
[4][EXPRESSIONS]
<br>Dictum: Dynamic evaluation eliminates hardcoded parameters.
Guidance:
- — Prefix
Static vs Dynamicsignals evaluation; without it, value is literal string including=.{{ }} - — Test mode pins lack execution context;
Pinned Datafails, use.itemor.first()instead..all()[0] - — IIFE pattern
Complex Logicenables multi-statement evaluation.{{(function(){ return ... })()}} - —
Scope Confusionaccesses current node input only; use$jsonfor other nodes.$('NodeName').item.json
Best-Practices:
- [ALWAYS] Use for cross-node data;
$('NodeName')only accesses current node input.$json - [ALWAYS] Escape quotes in JSON strings or use template literals to prevent invalid JSON.
- [NEVER] Assume works in all contexts; pinned data testing requires explicit accessors.
.item
<br>准则: 动态评估可消除硬编码参数。
指导说明:
- — 前缀
静态与动态表示需要评估;无此前缀时,值为包含=的字面字符串。{{ }} - — 测试模式下的固定数据缺乏执行上下文;
固定数据会失效,需改用.item或.first()。.all()[0] - — IIFE模式
复杂逻辑支持多语句评估。{{(function(){ return ... })()}} - —
作用域混淆仅访问当前节点的输入;访问其他节点需使用$json。$('NodeName').item.json
最佳实践:
- [始终] 使用访问跨节点数据;
$('NodeName')仅用于访问当前节点输入。$json - [始终] 转义JSON字符串中的引号或使用模板字面量,以避免无效JSON。
- [切勿] 假设在所有上下文都有效;固定数据测试需要显式访问器。
.item
[5][INTEGRATIONS]
[5][INTEGRATIONS]
<br>Dictum: Node type selection determines integration capability.
Guidance:
- — Webhook for external calls, scheduleTrigger for periodic; choose based on initiation source.
Trigger Selection - — Sub-workflow tools require
AI Tool Visibilityparameter; agent uses it for tool selection reasoning.description - — Use
Code Languagefor Python;"pythonNative"is deprecated."python" - — Use
Error Propagationnode for controlled failures; triggers designated error workflow.stopAndError - — MCP nodes enable cross-agent interoperability; Guardrails nodes enforce AI output safety.
2025 Features - —
Output ParserjsonSchema must be static; expressions in schema are ignored silently.outputParserStructured - — Use
Batch Processingfor large datasets to prevent memory exhaustion; process in chunks.splitInBatches
Best-Practices:
- [ALWAYS] Set for webhook→response patterns; ensures output reaches caller.
responseMode: "lastNode" - [ALWAYS] Include on HTTP nodes used as AI tools; undocumented tools are invisible to agent.
description - [ALWAYS] Include unique per workflow to prevent path collisions across workflows.
webhookId
<br>准则: 节点类型选择决定集成能力。
指导说明:
- — 外部调用使用Webhook,周期性任务使用scheduleTrigger;根据触发源选择。
触发选择 - — 子工作流工具需包含
AI工具可见性参数;Agent会使用该参数进行工具选择推理。description - — Python需使用
代码语言;"pythonNative"已弃用。"python" - — 使用
错误传播节点实现可控失败;触发指定的错误工作流。stopAndError - — MCP节点支持跨Agent互操作性;Guardrails节点可强制AI输出安全。
2025新特性 - —
输出解析器的jsonSchema必须是静态的;架构中的表达式会被静默忽略。outputParserStructured - — 处理大型数据集时使用
批量处理以避免内存耗尽;分块处理数据。splitInBatches
最佳实践:
- [始终] 对于webhook→响应模式,设置;确保输出能返回给调用方。
responseMode: "lastNode" - [始终] 作为AI工具使用的HTTP节点需包含;未文档化的工具对Agent不可见。
description - [始终] 为每个工作流设置唯一的,以避免跨工作流的路径冲突。
webhookId
[6][RAG]
[6][RAG]
<br>Dictum: RAG pipelines ground LLM responses in domain-specific knowledge.
Guidance:
- — Simple for development; PGVector/Pinecone/Qdrant for production persistence.
Vector Store Selection - — Same embedding model required for insert and query; mismatch causes semantic drift.
Embedding Consistency - — Recursive Character splitter recommended; splits Markdown/HTML/code before character fallback.
Chunk Strategy - — Only agents support memory; chains are stateless single-turn processors.
Memory vs Chains - — MultiQuery for complex questions; Contextual Compression for noise reduction.
Retriever Modes
Best-Practices:
- [ALWAYS] Match embedding model between document insert and query operations.
- [ALWAYS] Use connection type for memory nodes;
ai_memorysilently fails.main - [NEVER] Use Simple Vector Store in production; data lost on restart, global user access.
<br>准则: RAG管道让大语言模型的响应基于领域专属知识。
指导说明:
- — 开发阶段使用Simple;生产环境持久化使用PGVector/Pinecone/Qdrant。
向量存储选择 - — 插入和查询需使用相同的嵌入模型;不匹配会导致语义漂移。
嵌入一致性 - — 推荐使用Recursive Character拆分器;先拆分Markdown/HTML/代码,再回退到字符拆分。
分块策略 - — 仅Agent支持内存;链是无状态的单轮处理器。
内存与链 - — 复杂问题使用MultiQuery;降噪使用Contextual Compression。
检索器模式
最佳实践:
- [始终] 文档插入和查询操作使用相同的嵌入模型。
- [始终] 为内存节点使用连接类型;
ai_memory类型会静默失败。main - [切勿] 在生产环境使用Simple Vector Store;重启后数据丢失,且所有用户均可访问。
[7][VALIDATION]
[7][VALIDATION]
<br>Dictum: Pre-export validation prevents n8n import failures.
Script:
bash
uv run .claude/skills/n8n-builder/scripts/validate-workflow.py workflow.json
uv run .claude/skills/n8n-builder/scripts/validate-workflow.py workflow.json --strictChecks (12 automated):
- — name, nodes, connections present
root_required - /
node_id_unique— no duplicatesnode_name_unique - — valid UUID format
node_id_uuid - — connection targets reference existing nodes
conn_targets_exist - — AI connection key matches type property
conn_ai_type_match - — LangChain workflows require
settings_exec_order_aiexecutionOrder: "v1" - /
settings_caller_policy— enum value validationnode_on_error
Guidance:
- — Use POST then PUT pattern; single POST may ignore settings due to API bug.
API Deployment - —
Performancetriggers DB I/O per node; disable for high-throughput (>1000 RPM).saveExecutionProgress: true - — Strip
Source Controlwhen sharing; credential files contain stubs only, not secrets.instanceId
<br>准则: 导出前验证可避免n8n导入失败。
脚本:
bash
uv run .claude/skills/n8n-builder/scripts/validate-workflow.py workflow.json
uv run .claude/skills/n8n-builder/scripts/validate-workflow.py workflow.json --strict检查项(12项自动化检查):
- — 存在name、nodes、connections
root_required - /
node_id_unique— 无重复项node_name_unique - — 格式为有效UUID
node_id_uuid - — 连接目标引用存在的节点
conn_targets_exist - — AI连接键与type属性匹配
conn_ai_type_match - — LangChain工作流需设置
settings_exec_order_aiexecutionOrder: "v1" - /
settings_caller_policy— 枚举值验证node_on_error
指导说明:
- — 使用POST后接PUT的模式;单次POST可能因API bug导致设置被忽略。
API部署 - —
性能会在每个节点触发数据库I/O;高吞吐量场景(>1000 RPM)需禁用。saveExecutionProgress: true - — 分享时需移除
版本控制;凭据文件仅包含存根,不包含密钥。instanceId