Supports two execution modes: \"Run Once for All Items\" (recommended for 95% of use cases) and \"Run Once for Each Item\" for specialized per-item logic
Access data via $input.all() , $input.first() , or $input.item ; always return array format [{json: {...}}]
Built-in helpers include $helpers.httpRequest() for HTTP calls, DateTime (Luxon) for date operations, and $jmespath() for JSON qu
Confirm successful installation by checking the skill directory location:
.cursor/skills/n8n-code-javascript
Restart Cursor to activate n8n-code-javascript. Access via /n8n-code-javascript in your agent's command palette.
β
Security Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
The Code node offers two execution modes. Choose based on your use case:
Run Once for All Items (Recommended - Default)
Use this mode for: 95% of use cases
How it works: Code executes once regardless of input count
Data access: $input.all() or items array
Best for: Aggregation, filtering, batch processing, transformations, API calls with all data
Performance: Faster for multiple items (single execution)
// Example: Calculate total from all itemsconst allItems = $input.all();const total = allItems.reduce((sum, item)=> sum +(item.json.amount||0),0);return[{json:{ total,count: allItems.length,average: total / allItems.length}}];
When to use:
β Comparing items across the dataset
β Calculating totals, averages, or statistics
β Sorting or ranking items
β Deduplication
β Building aggregated reports
β Combining data from multiple items
Run Once for Each Item
Use this mode for: Specialized cases only
How it works: Code executes separately for each input item
Data access: $input.item or $item
Best for: Item-specific logic, independent operations, per-item validation
Performance: Slower for large datasets (multiple executions)
// Example: Add processing timestamp to each itemconst item = $input.item;return[{json:{...item.json,processed:true,processedAt:newDate().toISOString()}}];
When to use:
β Each item needs independent API call
β Per-item validation with different error handling
β Item-specific transformations based on item properties
β When items must be processed separately for business logic
Decision Shortcut:
Need to look at multiple items? β Use "All Items" mode
Each item completely independent? β Use "Each Item" mode
Not sure? β Use "All Items" mode (you can always loop inside)
Data Access Patterns
Pattern 1: $input.all() - Most Common
Use when: Processing arrays, batch operations, aggregations
// Get all items from previous nodeconst allItems = $input.all();// Filter, map, reduce as neededconst valid = allItems.filter(item=> item.json.status==='active');const mapped = valid.map(item=>({json:{id: item.json.id,name: item.json.name}}));return mapped;
Pattern 2: $input.first() - Very Common
Use when: Working with single objects, API responses, first-in-first-out
// Get first item onlyconst firstItem = $input.first();const data = firstItem.json;return[{json:{result:processData(data),processedAt:newDate().toISOString()}}];
Pattern 3: $input.item - Each Item Mode Only
Use when: In "Run Once for Each Item" mode
// Current item in loop (Each Item mode only)const currentItem = $input.item;return[{json:{...currentItem.json,itemProcessed:true}}];
Pattern 4: $node - Reference Other Nodes
Use when: Need data from specific nodes in workflow
// Get output from specific nodeconst webhookData = $node["Webhook"].json;const httpData = $node["HTTP Request"].json;return[{json:{combined:{webhook: webhookData,api: httpData
}}}];
MOST COMMON MISTAKE: Webhook data is nested under .body
// β WRONG - Will return undefinedconst name = $json.name;const email = $json.email;// β CORRECT - Webhook data is under .bodyconst name = $json.body.name;const email = $json.body.email;// Or with $inputconst webhookData = $input.first().json.body;const name = webhookData.name;
Why: Webhook node wraps all request data under body property. This includes POST data, query parameters, and JSON payloads.
CRITICAL RULE: Always return array of objects with json property
Correct Return Formats
// β Single resultreturn[{json:{field1: value1,field2: value2
}}];// β Multiple results
Implementation Guide
Prerequisites
βΊClaude Desktop or compatible AI client with skill support
βΊClear understanding of task or problem to solve
βΊWillingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Steps
1Install skill using provided installation command
2Test with simple use case relevant to your work
3Evaluate output quality and relevance
4Iterate on prompts to improve results
5Integrate into regular workflow if valuable
Common Pitfalls
β Expecting perfect results without iteration
β Not providing enough context in prompts
β Using skill for tasks outside its intended scope
β Accepting outputs without review and validation
Best Practices
β Do
+Start with clear, specific prompts
+Provide relevant context and constraints
+Review and refine all outputs before using
+Iterate to improve output quality
+Document successful prompt patterns
β Don't
βDon't use without understanding skill limitations
βDon't skip validation of outputs
βDon't share sensitive information in prompts
βDon't expect skill to replace human judgment
π‘ Pro Tips
β Be specific about desired format and style
β Ask for multiple options to choose from
β Request explanations to understand reasoning
β Combine AI efficiency with human expertise
When to Use This
β Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
β Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path
1Familiarize yourself with skill capabilities and limitations
2Start with low-risk, non-critical tasks
3Progress to more complex and valuable use cases
4Build expertise through regular use and experimentation