n8n-code-javascript

Write reliable JavaScript for n8n Code nodes with correct return formats.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing JavaScript inside n8n Code nodes can be challenging due to strict return formats, data access patterns, and the need to manage webhook payloads and built-in helpers safely.

Core Features & Use Cases

  • Clear guidance on when to use $input.all(), $input.first(), and $input.item for data access.
  • Safe integration of built-ins like $helpers.httpRequest, DateTime (Luxon), and $jmespath for API calls, date handling, and JSON querying.
  • Robust patterns for error prevention, JSON comparison, and data transformation in production workflows.

Quick Start

Process all input items in a single pass and return a standardized array of {json} objects.

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 errors?

To return data from an n8n Code node without errors, you must format your output as an array of objects, specifically structured as [{json: {...}}]. This strict return format is required for n8n workflows to process the JavaScript output correctly.

What is the difference between $input.all() and $input.first() in n8n?

In n8n, $input.all() retrieves every item passing through the workflow for batch processing, while $input.first() retrieves only the initial item. You can also use $input.item for safe per-item processing within Code nodes.

How do I make HTTP requests inside an n8n Code node?

You make HTTP requests inside an n8n Code node by using the built-in helper $helpers.httpRequest. This allows you to execute API calls directly within your JavaScript logic safely, without relying on external modules.

Can I use Luxon DateTime for date transformations in n8n workflows?

Yes, you can use Luxon DateTime for date transformations in n8n workflows. The Code node environment supports the DateTime object natively, enabling robust date handling, formatting, and arithmetic within your JavaScript logic.

Why does my n8n Code node fail when using expression syntax?

Your n8n Code node fails because it runs raw JavaScript, meaning n8n expression syntax like {{ $json.field }} is prohibited. You must access data directly using JavaScript patterns like $input.first().json.field instead.

What is the best way to query JSON data inside an n8n Code node?

The best way to query JSON data inside an n8n Code node is using the built-in $jmespath helper. It allows you to perform complex JSON querying and data extraction directly within your JavaScript code safely.