abbibo/N8N-Workflow-Builder-Agent-skills-N8N / skills/04-code-nodes-javascript-python
n8n-code-nodes-javascript-python
VerifiedBest practices for writing JavaScript and Python in n8n Code nodes, data access methods, and return contracts.
| File | Kind | Size |
|---|---|---|
| JAVASCRIPT_PATTERNS.md | markdown | 606 B |
| SKILL.md | skill md | 593 B |
JAVASCRIPT_PATTERNS.md
View on GitHub# N8N JavaScript Code Node Best Practices
## Data Access Syntax
- In `runOnceForAllItems`:
- Input: `$input.all()` -> returns `Array<{ json: Object, binary?: Object }>`
- Previous Nodes: `$('Node Name').all()` or `$('Node Name').first().json`
- Output contract: Must return `Array<{ json: Object }>`
- In `runOnceForEachItem`:
- Input: `$input.item` -> returns `{ json: Object }`
- Output contract: Must return `{ json: Object }` or `$input.item`
## Error Handling
Always wrap `JSON.parse` or external string manipulations in a `try / catch` block to avoid unhandled runtime crashes (Rule 72).
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |