n8n-code-javascript

Write n8n Code node JavaScript using $input/$json conventions and returning {json: ...} arrays.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you write correct, reliable JavaScript for n8n Code nodes so your workflows transform data accurately without breaking item formatting or webhook handling.

Core Features & Use Cases

  • n8n Code node fundamentals: Clear guidance on returning results in the required [{ json: ... }] structure and using $input patterns correctly.
  • Webhook and node data handling: Correctly access webhook payloads via .body and combine outputs from other nodes with $node.
  • Production-grade patterns: Practical approaches for aggregation, filtering, batching/loop semantics, accumulating results across iterations, and avoiding common runtime mistakes.
  • Built-in tools & utilities: Use $helpers.httpRequest() for HTTP calls, DateTime (Luxon) for date logic, and $jmespath() for JSON querying.

Quick Start

Write JavaScript for an n8n Code node that aggregates all incoming items, safely handles missing fields, and returns an array of objects in the required json wrapper format.

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 return data from an n8n Code node correctly, you must structure your JavaScript output as an array of objects using the required `[{ json: ... }]` format. This ensures downstream nodes can parse the transformed items reliably without workflow errors.

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

You can access webhook body data inside an n8n Code node by referencing the payload via `.body` on the input item. Combine this with `$input` and `$node` conventions to properly shape webhook payloads and merge data from previous workflow nodes.

Can I use Luxon DateTime and $helpers.httpRequest in n8n workflow automation?

Yes, you can use Luxon `DateTime` for date logic and `$helpers.httpRequest()` for HTTP calls inside n8n Code nodes. You can also use `$jmespath()` for JSON querying to perform complex data transformation within your workflow automation.

What is the best way to aggregate and filter items in an n8n Code node?

The best way to aggregate and filter items in an n8n Code node is to apply production-grade JavaScript patterns using `$input` conventions. This approach handles batching, loop semantics, and accumulates results across iterations while safely managing missing fields.

Why does my n8n Code node fail when transforming multiple items?

An n8n Code node often fails when transforming multiple items if the JavaScript does not follow n8n-specific safety rules or return results in the required array structure. Avoid common runtime mistakes by using `$json` patterns and wrapping output objects correctly.