Skip to content
SkillModel-led5,349 tokens in use

n8n Code JavaScript

A guide to writing JavaScript in n8n Code nodes: a gate that checks native nodes first, data access, return format, webhook body, sandbox limits and loop pitfalls.

6,686 stars on the repository MIT Licenseczlonkowski/n8n-skills · skills/n8n-code-javascript
/plugin install czlonkowski/n8n-skills
View source

Install command as written in the repository's README

Skill label

measured from its files

What installing n8n Code JavaScript costs

254tokens idle
5,349tokens in use
32,189tokens, up to

Idle is what sits in context while the skill is installed. In use is its instructions, loaded when it runs. Up to adds the files its instructions link. Counts are approximate, made offline with cl100k_base.

Model dependence Model-led

Script-ledMixedModel-led

Mostly instructions, so how well it works depends on the model that follows them.

This describes the skill's structure, how much of it is scripts. It does not say how well it works.

Touches

Nothing detected: no shell, network, file writes, git or credentials in its files.

Declared tags come from the skill's frontmatter; detected ones from its scripts, its code blocks and the commands it names in inline code. This is detected, not audited.

How it scores

Quality

How well the skill is written, counted from its own files: its frontmatter, its steps, examples, stated output and constraints, its size and whether every file it ships is one it names.How we score it →
Excellent
  • Frontmatter12/15
  • Structure25/25
  • Examples15/15
  • Output15/15
  • Size11/15
  • Resources12/15

Security

Starts at 100 and loses points for each thing in the skill's files that a reader should look at first.How we score it →
Excellent

No findings.

Repository health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
Good
  • Development activity88
  • Maintenance92
  • Community60
  • Maturity36
  • Momentum40

n8n Code JavaScript is a skill for Claude that covers writing, reviewing and debugging JavaScript in an n8n Code node. It opens with a gate: check for a native node, then a short expression, and only then write code for a closed list of jobs such as recursion, state across runs or heavy all-items work.

It then covers the two execution modes and their cost, the four ways to read upstream data, the return shape n8n expects, the webhook body nesting, the sandbox rules and the production traps around loops and pairedItem.

What You Get

  • A three-step gate: native node, short expression, then the closed list of jobs that justify code
  • A guide to Run Once for All Items versus Each Item, with the per-item cost it adds
  • Data access patterns for $input.all(), first(), item and named nodes
  • The return format n8n accepts, and the primitive or null returns that fail
  • Notes on this.helpers.httpRequest, Luxon, JMESPath, blocked helpers and allowlisted modules
  • Reference files for data access, ten production patterns, errors and built-in functions

Common Use Cases

  • Fixing a Code node that returns undefined for webhook fields
  • Deciding whether a transform needs code or a Summarize, Sort or Remove Duplicates node
  • Writing a running total or recursive flatten that no native node covers
  • Accumulating results across SplitInBatches loop iterations
  • Speeding up a slow Code node that runs once per item

What Makes It Unique

It is written around n8n’s task-runner sandbox: the bare $helpers global is undefined, authenticated helpers are denied and $env can be blocked. It also holds a measured cost table for per-item execution and pushes Claude to a native node first, leaving a Why Code note on each Code node that stays. It sends Custom Code Tool work to a separate skill with a different contract.

Under The Hood

The skill is instructions and four reference markdown files, with no scripts. It tells Claude to look up the Code node and validate its configuration through the n8n-mcp tools, which call your n8n server. The code it teaches runs inside n8n’s sandboxed task runner, where it can read workflow items, call this.helpers.httpRequest for unauthenticated web requests and keep data between runs with workflow static data.

Join founders building with open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on SubstackJoin 750+ subscribers