Skip to content
Skillpedia
General coding48k Β· #5268

n8n-code-javascript

What it does

This guide helps you write JavaScript code within n8n, an automation tool. It's useful for more complicated programming tasks that other n8n tools can't handle.

When to use it

  • βœ“When you need to perform complex calculations or apply custom business logic.
  • βœ“When processing API responses with complicated structures.
  • βœ“To group data from different sources in an advanced way.

Skill link

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/n8n-code-javascript/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/n8n-code-javascript/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œHow can I use JavaScript in n8n to transform input data?”

5 new skills a week. 1 minute to read.

How it works

n8n allows you to write your own JavaScript code to manipulate data. It provides special tools to access information from previous steps and make requests to other services.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

JavaScript Code Node

Expert guidance for writing JavaScript code in n8n Code nodes.


Detailed Guide

Read the detailed guide before executing this skill. It retains the complete procedure and reference material. Treat its safety, prerequisites, and validation requirements as mandatory. For focused work, load the relevant sections; for end-to-end work, read the guide completely.

When to Use Code Node

Use Code node when:

  • βœ… Complex transformations requiring multiple steps
  • βœ… Custom calculations or business logic
  • βœ… Recursive operations
  • βœ… API response parsing with complex structure
  • βœ… Multi-step conditionals
  • βœ… Data aggregation across items

Consider other nodes when:

  • ❌ Simple field mapping β†’ Use Set node
  • ❌ Basic filtering β†’ Use Filter node
  • ❌ Simple conditionals β†’ Use IF or Switch node
  • ❌ HTTP requests only β†’ Use HTTP Request node

Code node excels at: Complex logic that would require chaining many simple nodes


Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
FAQ

When should I use the Code node instead of other nodes?

Use the Code node for complex multi-step transformations, custom calculations, recursive logic, parsing complex API responses, multi-step conditionals, or data aggregation. For simpler tasks like field mapping or basic filtering, use nodes like 'Set', 'Filter', or 'IF'.

What are '$input', '$json', '$node', and '$helpers'?

These are special shortcuts n8n provides so your JavaScript code can easily access input data, information from previous nodes, and useful functions for making requests or working with dates.

Does this guide replace the need to test my code?

No. This guide offers guidance, but you still need to validate and test your code in your specific environment to ensure it works correctly and securely.

Details

Original description by the author

Write JavaScript code in n8n Code nodes. Use when writing JavaScript in n8n, using $input/$json/$node syntax, making HTTP requests with $helpers, working with dates using DateTime, troubleshooting Code node errors, or choosing between Code node modes.

repo: sickn33/agentic-awesome-skills

Popularity

GitHub stars
48k
Ranking position
#5268
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills