What problem does it solve?
Code node scripting in n8n is easy to misuse without consistent patterns for data access, return formats, and webhook handling. This Skill guides developers to write reliable JavaScript within Code nodes using $input.all(), $input.first(), and $input.item, with built-ins like $helpers.httpRequest and DateTime to build maintainable workflows.
Core Features & Use Cases
- Pattern-driven data access: use $input.all(), $input.first(), and $input.item to process batches or per-item logic.
- Reliable return formats: ensure outputs are an array of objects with a json property (e.g., [{json: {...}}]).
- Webhook-safe data handling: access webhook payloads under .body and guard against missing fields.
- Built-in utilities: leverage $helpers.httpRequest for API calls and DateTime/Luxon for date/time operations.
- Use cases: data transformation, API integrations, webhook-driven automations, and per-item validations in both Run All and Run Per Item modes.
Quick Start
- Get items through const items = $input.all();
- Transform and return with a map: return items.map(i => ({json: {...i.json, processed: true}}));
- If needed, perform API calls via await $helpers.httpRequest({method: 'GET', url: 'https://example.com'});
Note: Use plain JavaScript; avoid n8n expression syntax in Code nodes.