ba-n8n-js-code

Write robust JavaScript code in n8n Code nodes with data access patterns.

Updated Apr 12, 2026
One-click install
npx skills add https://github.com/clovernguyen1010-ship-it/Clover_Nguyen --skill ba-n8n-js-code-clovernguyen1010-ship-it
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ba-n8n-js-code
Source: https://github.com/clovernguyen1010-ship-it/Clover_Nguyen/tree/main/.agent/skills/ba-n8n-js-code
Command: npx skills add https://github.com/clovernguyen1010-ship-it/Clover_Nguyen --skill ba-n8n-js-code-clovernguyen1010-ship-it

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Solves writing robust JavaScript code in n8n Code nodes. The guide consolidates mode choices, safe data access, and consistent return formats to reduce common errors and accelerate workflow automation.

Core Features & Use Cases

  • Clear guidance on using data access patterns ($input.all, $input.first, $input.item) and webhook data structure under .body.
  • Demonstrates safe error handling, validation patterns, and productive use of built-ins like $helpers.httpRequest and DateTime (Luxon).
  • Provides production-tested patterns for data transformation, aggregation, and API interactions within n8n Code nodes.

Quick Start

Start by selecting Run Once for All Items, access data with $input.all(), transform it with a map, and return [{json: {...}}].

Frequently Asked Questions about ba-n8n-js-code

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

FAQPage Schema
How do I write JavaScript in n8n Code nodes to transform data?

To write JavaScript in n8n Code nodes, select Run Once for All Items, access data using $input.all(), transform it with a map, and return the result in the format [{json: {...}}].

What is the correct return format for n8n Code nodes?

The correct return format for n8n Code nodes is an array of objects structured as [{json: {...}}]. Using this consistent format prevents workflow errors during data transformation.

How do I access webhook data in n8n Code nodes?

Access webhook data in n8n Code nodes by referencing the payload under the .body property. Use data access patterns like $input.all or $input.first to handle the incoming request safely.

Can I use Luxon DateTime to format dates in n8n Code nodes?

Yes, you can use Luxon DateTime in n8n Code nodes. The environment provides DateTime as a built-in, allowing you to format dates and perform time manipulations within your JavaScript workflow logic.

Does n8n Code node support making HTTP requests with JavaScript?

Yes, n8n Code nodes support making HTTP requests using the built-in $helpers.httpRequest method. This allows you to execute API calls and handle data interactions directly in your custom JavaScript logic.

What is the difference between All Items and Each Item modes in n8n Code nodes?

All Items mode processes the entire input array at once using $input.all, while Each Item mode processes individual items sequentially using $input.item for targeted data transformation.