n8n-code-javascript

n8n-code-javascript is a skill for Claude Code, Codex from neurawork-git/n8n-autopilot. It costs 63 tokens per session (1,571 once invoked), scanned A, original, MIT.

A guide for writing JavaScript in n8n Code nodes, which are workflow steps that run custom code. It covers n8n's input and output format and common built-in helpers.

In plain words
What is it for?
Use it to transform workflow data, make HTTP requests, work with dates, troubleshoot Code node errors, and decide when a built-in n8n node is more suitable.
Why use it?
It helps prevent common Code node mistakes, such as reading webhook data from the wrong place or returning data in an invalid format.

Skill for Claude CodeCodex

Part of the n8n-autopilot plugin — 24 skills, 12 agents, 4 hooks shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/neurawork-git/n8n-autopilot/n8n-code-javascript
Any agent
npx skills add neurawork-git/n8n-autopilot --skill n8n-code-javascript
Clone the repo
git clone --depth 1 https://github.com/neurawork-git/n8n-autopilot

Made for: Claude Code, Codex.

Or install n8n-autopilot, the plugin that ships this one along with the rest of its 24 skills, 12 agents, 4 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for n8n-code-javascript

README.md
[![agentmods](https://agentmods.dev/badge/skills/neurawork-git/n8n-autopilot/n8n-code-javascript.svg)](https://agentmods.dev/skills/neurawork-git/n8n-autopilot/n8n-code-javascript)
Your own site
<a href="https://agentmods.dev/skills/neurawork-git/n8n-autopilot/n8n-code-javascript"><img src="https://agentmods.dev/badge/skills/neurawork-git/n8n-autopilot/n8n-code-javascript.svg" alt="Measured on agentmods" height="20"></a>
Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,571 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00063 $0.01571
Opus 5 $0.00032 $0.00785
Sonnet 5 $0.00013 $0.00314
Haiku 4.5 $0.00006 $0.00157

Measured 4d ago against content hash 3fa2574c1d6e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

n8n-code-javascript scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/n8n-code-javascript/SKILL.md · 232 lines

How it starts

The opening of the file, as written. The whole thing — 232 lines — stays where its author put it; the contents beside it link to each section on GitHub.

JavaScript Code Node

Expert guidance for writing JavaScript code in n8n Code nodes.


Quick Start

// Basic template for Code nodes
const items = $input.all();

// Process data
const processed = items.map(item => ({
  json: {
    ...item.json,
    processed: true,
    timestamp: new Date().toISOString()
  }
}));

return processed;

Essential Rules

  1. Choose "Run Once for All Items" mode (recommended for most use cases)
  2. Access data: $input.all(), $input.first(), or $input.item
  3. CRITICAL: Must return [{json: {...}}] format
  4. CRITICAL: Webhook data is under $json.body (not $json directly)
  5. Built-ins available: $helpers.httpRequest(), DateTime (Luxon), $jmespath()

When NOT to use a Code node (native-first)

Reach for a native node before writing JavaScript — Code nodes are harder to read, review, and they run V8 in-process (OOM risk on large data, see below). In a real production audit, Code nodes outnumbered native conditional nodes ~2.5:1 — much of it avoidable:

If you are doing… Use this native node, NOT Code
Branching on a condition IF (2 branches) / Switch (n branches)
Dropping items by a rule Filter
Setting / renaming / mapping fields Set (Edit Fields)
Merging / combining streams Merge
Aggregating into one item Aggregate / Summarize
Looping over large batches Loop Over Items (SplitInBatches)

Memory / OOM (real production incident): a Code node that loads or iterates a large dataset — especially a full DB result set (>~10k rows), binary, or file contents — can spike the V8 heap (~3 GB cap) and crash the n8n pod (OOM). For large data: page/limit at the source, process in SplitInBatches, or push the work into the database/native node instead of materializing it all in JS.

Use a Code node when the logic genuinely has no native equivalent (custom parsing, multi-field computation, shaping a bespoke payload).

Read the full file on GitHub · 232 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 232 lines · 63 tokens per session scan A 3fa2574c1d6e

Subscribe to this mod's changes

n8n-code-javascript is a skill published in the GitHub repository neurawork-git/n8n-autopilot (18 stars, last pushed 1mo ago), licensed MIT. It adds 63 tokens to every session and 1,571 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

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…

czlonkowski/n8n-skills · 156 tokens

n8n-mcp-tools-expert

Expert guide for using n8n-mcp MCP tools effectively. Use when searching for nodes, validating configurations, accessing templates, managing workflows, organizing workflows into folders, managing credentials, auditing instance security, or using any n8n-mcp tool. Provides tool selection guidance, parameter formats…

czlonkowski/n8n-skills · 135 tokens

n8n-subworkflows

Build reusable, composable n8n sub-workflows. Use when extracting shared logic, building anything multi-step or reused across workflows, or any workflow over 10 nodes — and whenever the user mentions sub-workflows, Execute Workflow, reuse, shared/common logic, modular workflows, "Define Below" inputs…

czlonkowski/n8n-skills · 121 tokens

n8n-validation-expert

Interpret validation errors and guide fixing them. Use when encountering validation errors, validation warnings, false positives, operator structure issues, or need help understanding validation results. Also use when asking about validation profiles, error types, the validation loop process, or auto-fix capabilities.…

czlonkowski/n8n-skills · 91 tokens

n8n-workflow-patterns

Proven workflow architectural patterns from real n8n workflows. Use when building new workflows, designing workflow structure, choosing workflow patterns, planning workflow architecture, or asking about webhook processing, HTTP API integration, database operations, AI agent workflows, batch processing, or scheduled…

czlonkowski/n8n-skills · 144 tokens

n8n-binary-and-data

Handle files and binary data in n8n correctly. Use when working with files, images, PDFs, attachments, uploads or downloads, base64, vision/multimodal input, or when an AI agent needs a file as tool input or output — and whenever the user mentions $binary, binaryPropertyName, "read the PDF", "attach the file", "send…

czlonkowski/n8n-skills · 135 tokens