Skip to content

abbibo/N8N-Workflow-Builder-Agent-skills-N8N

n8n-agent-skill-system

Verified

Primary engineering skill for designing, generating, validating, and delivering complete, importable, production-ready n8n workflows using Antigravity and Agentic IDEs. Implements 131 automated validation rules, comprehensive node catalogs, Luxon DateTime verification, AI agent architectures, and modular subworkflows.

references/code-node-recipes.md

View on GitHub
# N8N Code Node Engineering Recipes (JavaScript & Python)

## 1. JavaScript Code Node Patterns

n8n Code nodes run in two modes:
1. **Run Once for All Items** (`mode: "runOnceForAllItems"`): Receives `$input.all()`, must return array of items: `return [{ json: { ... } }]`.
2. **Run Once for Each Item** (`mode: "runOnceForEachItem"`): Receives `$input.item`, must return single item or object: `return { json: { ... } }` or `return $input.item`.

### Recipe JS-1: Aggregating Items
```javascript
// Mode: Run Once for All Items
const items = $input.all();
const totalRevenue = items.reduce((acc, item) => acc + (item.json.price || 0), 0);
const allIds = items.map(item => item.json.id);

return [{
  json: {
    count: items.length,
    totalRevenue,
    ids: allIds,
    processedAt: new Date().toISOString()
  }
}];
```

### Recipe JS-2: Exploding / Splitting Nested Arrays
```javascript
// Mode: Run Once for All Items
const items = $input.all();
const output = [];

for (const item of items) {
  const lineItems = item.json.line_items || [];
  for (const line of lineItems) {
    output.push({
      json: {
        orderId: item.json.id,
        customer: item.json.customer_name,
        sku: line.sku,
        quantity: line.quantity,
        price: line.price
      }
    });
  }
}

return output;
```

### Recipe JS-3: Safe JSON Parsing
```javascript
// Mode: Run Once for Each Item
let parsed = {};
try {
  parsed = typeof $json.raw_payload === 'string' 
    ? JSON.parse($json.raw_payload) 
    : ($json.raw_payload || {});
} catch (err) {
  parsed = { error: 'INVALID_JSON', raw: $json.raw_payload };
}

return {
  json: {
    ...$json,
    payload: parsed
  }
};
```

## 2. Python Code Node Patterns

In Python mode, n8n executes within a WebAssembly Pyodide sandbox.
- Standard libraries available: `json`, `re`, `datetime`, `math`, `urllib.parse`, `hashlib`, `base64`.
- **No external pip packages** can be installed at runtime.
- Use `_input.all()` to access all items.
- Return must be a list of dictionaries with a `'json'` key.

### Recipe PY-1: Text Normalization and Regex Extraction
```python
# Mode: Run Once for All Items
import re
from datetime import datetime

items = _input.all()
output = []

email_pattern = re.compile(r'[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+')

for item in items:
    data = item.get('json', {})
    text = data.get('raw_text', '')
    emails = email_pattern.findall(text)
    
    output.append({
        'json': {
            'original_id': data.get('id'),
            'found_emails': emails,
            'email_count': len(emails),
            'processed_at': datetime.utcnow().isoformat()
        }
    })

return output
```
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall