n8n-code-javascript

Write robust JavaScript in n8n Code nodes with safe data access and correct return formats.

3|1|Updated Jan 14, 2026
One-click install
npx skills add https://github.com/echoleesong/claude-skills-plugin --skill n8n-code-javascript-echoleesong
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: n8n-code-javascript
Source: https://github.com/echoleesong/claude-skills-plugin/tree/main/skills/n8n-code-javascript
Command: npx skills add https://github.com/echoleesong/claude-skills-plugin --skill n8n-code-javascript-echoleesong

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides clear, battle-tested guidance to write robust JavaScript inside n8n Code nodes, including safe data access patterns, correct return formats, and effective use of built-in helpers.

Core Features & Use Cases

  • Mode guidance: Run Once for All Items vs Run Once for Each Item, with practical trade-offs for batching and per-item processing.
  • Data access and integration: Learn to use $input.all(), $input.first(), $input.item, $node, and $json safely, including handling webhook data under .body.
  • Built-ins and patterns: Leverage $helpers.httpRequest(), DateTime (Luxon), and $jmespath() for API calls, date handling, and JSON queries, plus production-tested patterns for transforming, validating, and aggregating data.
  • Reliability and safety: Enforce the [{json: ...}] return shape, guard against nulls, and implement robust error handling and testing guidance.

Quick Start

Process all input items with $input.all(), perform your transformations, and return an array of results in the [{json: {...}}] structure.

Frequently Asked Questions about n8n-code-javascript

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

FAQPage Schema
How do I return data from an n8n Code node without breaking the workflow?

To safely process items in an n8n Code node, use $input.all() for batch processing or $input.item for individual iteration. Your choice between Run Once for All Items and Run Once for Each Item dictates data access and impacts workflow performance.

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

To access webhook payload data inside an n8n Code node, reference the .body property of the incoming item. This safely exposes HTTP request payloads passed from external triggers for JavaScript transformation.

What is the correct way to make HTTP requests from an n8n Code node?

Make HTTP requests from an n8n Code node using the built-in $helpers.httpRequest() method. This function handles external API calls securely from JavaScript without requiring external library imports.

Can I use Luxon DateTime for date manipulation in n8n JavaScript?

Yes, you can use Luxon DateTime in n8n JavaScript for date manipulation. The environment natively supports Luxon, allowing you to parse, format, and transform dates without importing external dependencies.

Why does my n8n Code node fail when processing empty or null data fields?

n8n Code nodes fail on null data when JavaScript directly accesses undefined properties. Prevent this by applying strict null safety guards and using $input.* methods to validate data presence before property access.