- Home
- Skills
- Czlonkowski
- N8n Skills
- N8n Code Python
n8n-code-python_skill
- Shell
2.2k
GitHub Stars
6
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill czlonkowski/n8n-skills --skill n8n-code-python- COMMON_PATTERNS.md18.9 KB
- DATA_ACCESS.md14.7 KB
- ERROR_PATTERNS.md13.6 KB
- README.md9.3 KB
- SKILL.md17.5 KB
- STANDARD_LIBRARY.md17.7 KB
Overview
This skill helps you write Python code inside n8n Code nodes, with practical templates, data access patterns, and error-prevention rules. It focuses on the Python (Beta) and Python (Native) modes, explains standard-library availability, and highlights critical return and webhook behaviors. Use it to produce reliable, n8n-compatible Python snippets and patterns for real workflows.
How this skill works
It inspects common n8n Code node requirements and translates them into concise Python patterns: how to read inputs (_input/_items/_json/_node), how to return data in the required list-of-{'json': ...} format, and which standard library modules are available. It also flags what will break (external imports) and provides mode-specific guidance for Python (Beta) helpers versus Python (Native) pure-Python usage.
When to use it
- When you prefer Python syntax for data transformations or string/regex processing.
- When you need standard library features (datetime, re, hashlib, urllib.parse, statistics).
- When JavaScript helpers are not required and you want simpler Python logic.
- When you must process or aggregate multiple items in one execution using _input.all().
- When you need clear examples for webhook body access and safe dict handling.
Best practices
- Prefer JavaScript for most cases; use Python only when its standard library or developer comfort matters.
- Always return a list of dicts with a 'json' key (or an empty list) to avoid execution failures.
- Use _input.all(), _input.first(), or _input.item according to execution mode; use .get() to avoid KeyError.
- Avoid external libraries; rely on HTTP Request node or JavaScript for network calls.
- Handle None and missing fields explicitly and use list comprehensions for concise transformations.
Example use cases
- Batch-aggregate amounts from multiple items and return totals and averages with _input.all().
- Extract and deduplicate emails from text using re and return a single summary object.
- Validate incoming webhook payloads (access under _json['body']) and annotate errors per item.
- Compute simple statistics (mean, median, stdev) using the statistics module for numeric lists.
- Combine outputs from two nodes via _node['NodeName']['json'] and return a merged result.
FAQ
No. External packages are not available. Use the HTTP Request node for network calls and built-in modules or JavaScript alternatives for complex processing.
What happens if I forget to return data?
The workflow fails or produces no output. Always return a list of {'json': {...}} or an empty list explicitly.
Which Python mode should I choose?
Use Python (Beta) for n8n helpers (_input, _now, _jmespath) and better integration; use Python (Native) only for strict pure-Python needs.