n8n-code-javascript

Author and debug JavaScript for n8n Code nodes with return format and null-safety rules.

9|1|Updated Apr 16, 2026
One-click install
npx skills add https://github.com/CarbeneAI/Forge --skill n8n-code-javascript-carbeneai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: n8n-code-javascript
Source: https://github.com/CarbeneAI/Forge/tree/main/.claude/skills/n8n-code-javascript
Command: npx skills add https://github.com/CarbeneAI/Forge --skill n8n-code-javascript-carbeneai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Many n8n users write JavaScript in Code nodes incorrectly or inefficiently, causing runtime errors, malformed outputs, and fragile workflows. This Skill reduces onboarding friction and prevents common mistakes by teaching correct data access patterns, return formats, and safe handling of webhook and API data.

Core Features & Use Cases

  • Mode selection guidance for choosing Run Once for All Items vs Run Once for Each Item and why it matters for performance.
  • Data access patterns ($input.all(), $input.first(), $input.item, $node) with the critical webhook .body gotcha.
  • Built-in helpers & examples: how to use $helpers.httpRequest, DateTime (Luxon), $jmespath, and $getWorkflowStaticData in real workflows.
  • Error prevention: required return format, null-safety checks, unmatched-bracket avoidance, and the top error patterns with fixes.
  • Production patterns: 10 reusable patterns for aggregation, parsing, ranking, Slack formatting, CRM transformation, and release parsing.

Quick Start

Use the n8n-code-javascript guidance to validate a Code node that aggregates webhook payloads, calls an external API with $helpers.httpRequest, and returns a properly formatted array of objects each containing a json property.

Frequently Asked Questions about n8n-code-javascript

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

FAQPage Schema
How do I fix runtime errors in n8n Code nodes when transforming JavaScript data?

n8n Code node runtime errors usually stem from malformed outputs or incorrect data access. You can fix them by applying required return formats, null-safety checks, and proper mode selection for your JavaScript data transformation.

What is the correct return format for n8n Code node JavaScript?

The correct return format for n8n Code node JavaScript requires an array of objects where each object contains a json property. Following this structure prevents malformed outputs and ensures your workflow processes the transformed data without failing.

When should I use Run Once for All Items vs Run Once for Each Item in n8n?

Use Run Once for All Items vs Run Once for Each Item based on your performance needs. Mode selection guidance helps you choose between batch processing and individual item iteration to optimize n8n workflow efficiency and prevent runtime failures.

How do I access webhook body data in n8n Code node JavaScript?

Access webhook body data in n8n Code node JavaScript using specific data access patterns like $input.all(), $input.first(), and $input.item. Watch for the critical webhook .body gotcha to avoid null-safety issues during HTTP request processing.

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

Yes, you can use built-in helpers like Luxon DateTime and $helpers.httpRequest in n8n workflows. These helpers support date/time operations and API calls, with production-ready patterns available for aggregation, parsing, and CRM transformation tasks.

Why does my n8n Code node fail with unmatched brackets and null errors?

n8n Code nodes fail with unmatched brackets and null errors due to incorrect JavaScript syntax and missing null-safety checks. Error prevention guidance provides fixes for top error patterns, ensuring production-ready workflow stability.