Now inviting automation leaders: publish your playbook as a skill, under your own name. Publish yours →
Automation Skills
Contributors/Taqi Molavi/n8n code nodes
Workflow building

n8n code nodes

Use when considering a Code node, writing JavaScript/Python in n8n, fixing Code return shape errors, or deciding between expression, Edit Fields, and Code.

ByTaqi MolaviTaqi MolaviAI-native SEO strategist @ InTen digital marketing agency
name:
n8n-code-nodes
description:
Use when considering a Code node, writing JavaScript/Python in n8n, fixing Code return shape errors, or deciding between expression, Edit Fields, and Code.

n8n Code Nodes

Author: Taghi Molavi

Decision tree

  1. Can an expression on the consumer node do it? → do that.
  2. Can Edit Fields + arrow function cover it? → prefer that.
  3. Need multi-source aggregation, npm-less algorithms, or complex branching on items? → Code.
  4. Need external libs / long-running jobs? → sub-workflow, custom node, or external service — not giant Code.

Default language: JavaScript. Use Python only if user insists or ecosystem requires it.

Return contract (JS)

Code must return items in n8n shape:

return items.map(item => ({
  json: { ...item.json, score: 1 },
  pairedItem: item.pairedItem, // preserve when possible
}));

Or:

return [{ json: { ok: true, count: items.length } }];

Common breaks

  • Returning raw objects/arrays without { json: ... }
  • Forgetting to handle empty items
  • Mutating shared state across runs
  • Trying to require disallowed modules
  • Hiding secrets in code

Run once for all items vs per item

  • Per item: simpler expressions pairing
  • All items: aggregation, dedup, sort — then output one or many

Pair with

  • n8n-expressions for lighter transforms
  • n8n-debugging when Code "fails silently" (often empty return)

More in this playbook

Delivery Itay GuttmanItay Guttman + 1CEO @ engini.ai

Safe to turn on

Use this skill when an agent or person is about to create, change or enable an automation inside someone else's account or a shared environment: "create this workflow", "build it in the customer's account", "turn it on", "go live", "deploy this automation". Produces a proposal the human approves, an automation created in the off state, and a short list of what only the human can finish.

Workflow buildingMIT Romuald CzłonkowskiRomuald CzłonkowskiFounder @ AiAdvisors

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, Text Classifier, or Information Extractor — and whenever the user mentions AI agents, LLM with tools, tool calling, $fromAI, system prompts, agent memory, sessionId, structured/JSON output, output parser, RAG, vector store, a chat assistant/bot, or human-in-the-loop review. Covers Agent-vs-chain-vs-classifier choice, the model/memory/tools/outputParser slots, tool names/descriptions as prompt, structured output with autoFix, memory, RAG, human review, and chat topologies.

Workflow buildingMIT Romuald CzłonkowskiRomuald CzłonkowskiFounder @ AiAdvisors

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, Text Classifier, or Information Extractor — and whenever the user mentions AI agents, LLM with tools, tool calling, $fromAI, system prompts, agent memory, sessionId, structured/JSON output, output parser, RAG, vector store, a chat assistant/bot, or human-in-the-loop review. Covers Agent-vs-chain-vs-classifier choice, the model/memory/tools/outputParser slots, tool names/descriptions as prompt, structured output with autoFix, memory, RAG, human review, and chat topologies.

Publish your skill

Copy this prompt into Claude Code, Codex or any agent. It walks you through your first skill in about 20 minutes, with you as the author.

Click to copy.