n8n-code-javascript

Implement robust JavaScript in n8n Code nodes for data transformations and API calls.

4|1|Updated Feb 8, 2026
One-click install
npx skills add https://github.com/yuchenbigpen1/normies --skill n8n-code-javascript-yuchenbigpen1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: n8n-code-javascript
Source: https://github.com/yuchenbigpen1/normies/tree/main/packages/shared/assets/workspace-template/skills/n8n-code-javascript
Command: npx skills add https://github.com/yuchenbigpen1/normies --skill n8n-code-javascript-yuchenbigpen1

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing robust, maintainable JavaScript inside n8n Code nodes is challenging due to mode selection, data access patterns, and strict return format requirements; this guide provides practical, production-ready patterns to safely transform data, call APIs, validate inputs, and manage webhook payloads.

Core Features & Use Cases

  • Guidance on choosing between "Run Once for All Items" vs "Run Once for Each Item" and how to access input data with $input.all(), $input.first(), and $input.item.
  • Safe data handling for webhook payloads where data is often nested under body, with built-in helpers like $helpers.httpRequest, DateTime, and $jmespath for transformations.
  • Production patterns for data aggregation, transformation, validation, and error prevention to build reliable automation workflows.

Quick Start

Open a Code node, choose Run Once for All Items, access input data with $input.all() or $input.first() or $input.item, and return an array of objects with the json property.

Frequently Asked Questions about n8n-code-javascript

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

FAQPage Schema
How do I access input data in n8n Code nodes using JavaScript?

To access input data in n8n Code nodes, use $input.all() for all items, $input.first() for the initial item, or $input.item when using Run Once for Each Item mode.

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

Run Once for All Items processes the entire input array in a single execution, while Run Once for Each Item executes the JavaScript code individually for every input item.

How do I handle webhook payloads in n8n JavaScript Code nodes?

Handle webhook payloads in n8n JavaScript Code nodes by accessing nested data under the body object and using built-in helpers like $helpers.httpRequest for API calls and transformations.

Can I use Luxon DateTime and JMESPath in n8n Code node JavaScript?

Yes, you can use Luxon DateTime and $jmespath in n8n Code node JavaScript to perform date manipulations and query JSON data structures for complex workflow transformations.

What is the correct return format for JavaScript in n8n Code nodes?

The correct return format for JavaScript in n8n Code nodes is an array of objects where each object contains a json property, ensuring downstream nodes properly receive the transformed data.

Why does my n8n Code node JavaScript throw an error when transforming data?

n8n Code node JavaScript throws errors during data transformation when return formats are invalid, input access methods mismatch the execution mode, or nested webhook data is accessed incorrectly.