n8n-code-javascript

Write and validate JavaScript code in n8n Code nodes.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/filipesf/dotfiles --skill n8n-code-javascript-filipesf
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: n8n-code-javascript
Source: https://github.com/filipesf/dotfiles/tree/main/agents/skills/n8n/n8n-code-javascript
Command: npx skills add https://github.com/filipesf/dotfiles --skill n8n-code-javascript-filipesf

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Write JavaScript directly in n8n Code nodes to perform complex data transformations, API calls, and data handling without leaving your workflow.

Core Features & Use Cases

  • Mode selection: Run your code once for all input items or once per item.
  • Data access: Use $input.all(), $input.first(), and $input.item with $json and $node references.
  • Built-ins & Use Cases: Leverage $helpers.httpRequest(), DateTime (Luxon), and $jmespath() for robust data processing.
  • Reliability & debugging: Learn common error prevention patterns and safe null checks, with practical examples.
  • Use Case: Build batch transformations, enrich results, and perform API interactions inside a single Code node.

Quick Start

Start with a simple example: read all input items, add a processed timestamp, and return the transformed items as [{json: {...}}].

Frequently Asked Questions about n8n-code-javascript

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write JavaScript in n8n Code nodes for data transformation?

Writing JavaScript in n8n Code nodes requires returning an array of objects where each has a json property. You access data using $input patterns like $input.all() or $input.first() to perform complex data transformations directly within your workflow.

What is the difference between Run Once for All Items and Run Once for Each Item in n8n?

Run Once for All Items processes all incoming data in a single execution batch, while Run Once for Each Item executes your JavaScript code individually for every item. Choose the first for batch transformations and the second for isolated item processing.

How do I access webhook data inside an n8n Code node?

Webhook data inside an n8n Code node is accessed under the .body property of the incoming item. You must implement safe null checks when parsing this data to ensure your automation code remains production-ready and avoids execution errors.

Can I use Luxon DateTime and $jmespath inside n8n automation workflows?

Yes, you can use Luxon DateTime and $jmespath inside n8n Code nodes. These built-ins allow you to handle complex date formatting and query JSON data structures efficiently without relying on external scripts or additional nodes.

How do I make HTTP requests and perform API interactions within an n8n Code node?

You make HTTP requests inside an n8n Code node by leveraging the $helpers.httpRequest() function. This allows you to perform API interactions, fetch external data, and enrich your workflow results within a single JavaScript execution block.

Why does my n8n Code node return a data structure validation error?

An n8n Code node returns a validation error when your JavaScript output lacks the correct return structure. You must return an array of objects, ensuring each object specifically contains a json property, to pass data successfully to the next node.