n8n-code-javascript

Write JavaScript in n8n Code nodes using $input.all() and $node patterns.

Updated Feb 26, 2026
One-click install
npx skills add https://github.com/pessini/aria --skill n8n-code-javascript-pessini
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: n8n-code-javascript
Source: https://github.com/pessini/aria/tree/main/backend/agents/n8n_agent/skills/n8n-code-javascript
Command: npx skills add https://github.com/pessini/aria --skill n8n-code-javascript-pessini

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill eliminates the confusion and common errors encountered when writing JavaScript code within n8n's Code nodes, enabling users to confidently build complex workflow logic.

Core Features & Use Cases

  • Data Access Mastery: Learn to use $input.all(), $input.first(), $input.item, and $node correctly.
  • Error Prevention: Avoid the top 5 most common Code node errors, including return format issues, syntax mistakes, and null-check failures.
  • Production Patterns: Implement 10 proven JavaScript patterns for data aggregation, transformation, filtering, and reporting.
  • Built-in Functions: Leverage $helpers.httpRequest(), DateTime (Luxon), $jmespath(), and more.
  • Use Case: Automatically process webhook data, transform complex API responses, aggregate data from multiple sources, and handle errors gracefully within your n8n workflows.

Quick Start

Use the n8n-code-javascript skill to write a JavaScript function that takes an array of user objects and returns only the active users, ensuring correct return 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 an array of objects from an n8n Code node?

To return an array of objects from an n8n Code node, you must format your JavaScript output as an array of JSON objects. Using correct return formats prevents the most common Code node errors related to data formatting.

What is the best way to access webhook data in n8n JavaScript?

Access webhook data in n8n JavaScript by using specific data access patterns like `$input.all()` or `$input.first()`. These methods ensure you correctly capture and process incoming payload structures within your Code node.

Why does my n8n Code node throw a null-check failure error?

An n8n Code node throws a null-check failure when JavaScript attempts to process undefined data fields. Implementing proper error handling and validating data existence before transformation prevents these null-check failures.

Can I use Luxon DateTime and JMESPath inside n8n Code nodes?

Yes, you can use Luxon DateTime and JMESPath inside n8n Code nodes. The environment provides built-in functions like `$jmespath()` and DateTime to help with data transformation and filtering directly within your JavaScript logic.

How do I aggregate data from multiple sources in an n8n workflow?

Aggregate data from multiple sources in an n8n workflow by applying proven JavaScript patterns for data transformation. Use `$input.all()` to collect items and merge API responses into a unified output array.