n8n JavaScript Code Node Guide
Write reliable, efficient JavaScript for n8n Code nodes.
The document explicitly restricts authentication helpers, environment access, and require(), and recommends credentialed HTTP Request nodes, showing some least-privilege and data-flow awareness. However, it still presents arbitrary HTTP requests, manually propagated tokens, DELETE operations, and persistent static-data examples without user confirmation, sensitive-data redaction, external-effect warnings, or rollback guidance. Publisher identity is unverified, so points are deducted.
It covers execution modes, return shapes, common errors, abnormal inputs, and sandbox restrictions, making the happy path plausible. However, node-reference guidance is internally inconsistent, several examples assume unstated input schemas, empty-input and failure handling are incomplete, and key paths cannot be reproduced from a static read. The score stays within the static-review cap.
The audience, Code-node scenarios, Custom Code Tool exclusion, and alternatives using native nodes are clearly described. However, the trigger is overly broad, version and instance-configuration boundaries are not sufficiently defined, there is no evidence of Chinese-language support, and compatibility across n8n versions is not established, so points are deducted.
The documentation provides a quick start, topical layering, related files, checklists, examples, and limitation notes, with MIT license metadata. It lacks a clear maintainer, versioning policy, changelog, update path, and verifiable provenance; some referenced materials are incomplete in the supplied evidence, so points are deducted.
The skill supplies many directly adaptable JavaScript, data-access, performance, and error-handling patterns for common Code-node tasks. However, several examples depend on undeclared schemas or have potentially problematic runtime semantics, and there is no statically verifiable execution output or test evidence. It therefore receives only partial credit.
The supplied material includes concrete code, error messages, configuration names, and version-specific assertions, providing limited auditability. Claims such as “production-tested” and measured performance lack committed tests, CI coverage, or independent corroboration, and static review cannot reproduce them, so the score is low.
- Do not place arbitrary HTTP requests, manually supplied Authorization tokens, DELETE operations, or $getWorkflowStaticData examples into production without reviewing data flow, credential scope, external effects, and recovery.
- n8n versions, task runners, and instance environment variables can change API availability; validate helpers, return shapes, node references, and allowlist settings on the target instance.
- Some examples are internally inconsistent or assume unstated input schemas; the “production-tested” and performance claims were not verified by this review.
What does this skill do, and when should you use it?
This skill provides focused guidance for writing JavaScript in n8n Code nodes, including data access, transformations, execution modes, and troubleshooting. It covers All Items versus Each Item execution, webhook payload structure, return formats, HTTP requests, date handling, and JMESPath queries. It also addresses batching loops, cross-iteration data, pairedItem, and production failure patterns. It fits users implementing non-trivial n8n logic, while simple mappings, basic filtering, and HTTP-only tasks are better served by native nodes.
Reads data through $input.all(), $input.first(), $input.item, and named node references; produces n8n-compatible JSON item arrays; explains use of this.helpers.httpRequest(), DateTime, $jmespath(), and workflow static data; guides selection between All Items and Each Item modes; covers aggregation, filtering, parsing, transformation, batching, loop accumulation, and structured error returns; diagnoses $json.body webhook nesting, invalid return values, sandbox restrictions, and pairedItem issues.
- An n8n developer needs to aggregate, sort, deduplicate, or calculate statistics across multiple input items.
- A workflow builder needs to parse webhook requests and correctly read fields nested under $json.body.
- A user needs custom data transformations, business rules, or multi-step conditional logic in a Code node.
- A user is troubleshooting return formats, execution modes, loop accumulation, or large-dataset performance.
- A developer needs a simple unauthenticated HTTP request or date, JSON-structure, and text processing inside n8n.
What are this skill's strengths and limitations?
- Covers common n8n Code node data-access, return-format, and error patterns.
- Explains when to use All Items versus Each Item and why their performance differs.
- Documents production gotchas involving SplitInBatches, cross-iteration accumulation, and pairedItem.
- Includes 10 production patterns plus input validation, error handling, and early-filtering guidance.
- It targets the regular n8n Code node, not the AI Agent Custom Code Tool runtime.
- Complex authenticated, paginated, or retrying HTTP calls should generally use an HTTP Request node or another workflow design.
- require(), $env, and some authentication helpers depend on n8n instance configuration or sandbox restrictions.
- The source does not provide independent test results for this skill across platforms.
How do you install this skill?
This skill is distributed in the czlonkowski/n8n-skills collection. For Claude Code, run /plugin install czlonkowski/n8n-skills. For manual installation, run git clone https://github.com/czlonkowski/n8n-skills.git, then copy n8n-skills/skills/* to ~/.claude/skills/. The source also requires an installed and configured n8n-mcp MCP server and .mcp.json. For Claude.ai, download and upload the n8n-code-javascript skill folder; separate installation steps for other platforms are not specified.
How do you use this skill?
After installation, ask a targeted prompt such as “How do I access webhook data in an n8n Code node?” or “Write JavaScript for Run Once for All Items mode that aggregates all input amounts.” For an AI Agent Custom Code Tool, do not use this skill; use the n8n-code-tool skill because it has a different runtime contract.
How does this skill compare with similar options?
The source recommends Set/Edit Fields for simple field mapping, Filter for basic filtering, IF or Switch for simple conditionals, and HTTP Request for HTTP-only tasks. These cases may not require a Code node.