n8n-code-python
Skill by czlonkowski
Writes native Python for n8n Code nodes, covering the two input variables, blocked imports, sandbox limits and return shapes. Built for users who explicitly want Python in n8n workflows.
Install n8n-code-python
Built from the published package, never by AI.
git clone --depth 1 https://github.com/czlonkowski/n8n-mcp /tmp/n8n-mcp && mkdir -p ~/.claude/skills && cp -r /tmp/n8n-mcp/data/skills/n8n-code-python ~/.claude/skills/n8n-code-pythonRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/czlonkowski/n8n-mcp /tmp/n8n-mcp && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/n8n-mcp/data/skills/n8n-code-python ~/.gemini/antigravity-cli/skills/n8n-code-pythonAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
This agent skill guides an AI assistant when it writes Python for n8n Code nodes that use the native Python runner (language pythonNative, n8n 2.x). It explains the two available variables: _items in Run Once for All Items mode and _item in Run Once for Each Item mode. It also notes that older helpers such as _input, _json and _node raise NameError.
The skill covers imports, which are blocked by default, sandbox limits, accepted return shapes, and how errors interact with onError. It states that JavaScript is the default for Code nodes and that Python should be used when the user explicitly asks for it or needs standard library features. Python for the AI-agent Custom Code Tool should use the n8n-code-tool skill instead.
Written from the project's SKILL.md and checked against it.
What it can do
- Python Code node patternsQuick start code for Run Once for All Items and Run Once for Each Item modes.
- Input variable guidanceExplains _items, _item and dict-only access in native Python Code nodes.
- Legacy migration tableMaps old Pyodide helpers such as _input and _jmespath to native equivalents.
- Import checksExplains the empty default import allowlist and how to confirm a module is allowed.
- Sandbox limitsLists denied builtins, classes, dunder access and global statements that fail.
- Return shape referenceDescribes which return shapes work in each mode and how values are converted.
- Error handling notesExplains how runtime and static failures behave with onError continue modes.
- Failure troubleshootingMaps messages such as NameError and Python runner unavailable to likely causes.
What you need
- n8n 2.x with the native Python task runner
- Self-hosted instance to allowlist imports
- Python 3 on self-hosted instances
Try asking
- Write an n8n Python Code node that keeps only items where active is true.
- Migrate this old Pyodide Code node to native Python for n8n 2.x.
- Why does my n8n Python Code node say imports are disallowed?
Good to know
- Imports are blocked by default and not available on n8n Cloud.
- Some return shape behaviours are undocumented and may change in later releases.
- Validation misses many Python mistakes, so a test execution is needed.
- Each Python Code node costs roughly 0.4 s, which is slower than JavaScript.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: data/skills/n8n-code-python/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
COMMON_PATTERNS.md8 KB -
README.md3 KB -
SKILL.md11 KB
Alternatives to n8n-code-python
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
n8n-code-python: common questions
Should I use Python or JavaScript in n8n Code nodes?
The skill says JavaScript is recommended for most use cases and is the default. Use Python when the user explicitly asks for it or needs standard library features such as regex, hashlib or statistics.
Why does my old Python Code node fail with NameError?
Since n8n 2.0 the Pyodide Python (Beta) was removed. Helpers such as _input, _json, _node and _now raise NameError in native Python.
Can I use import json in a native Python Code node?
Not by default. Every import is checked against an allowlist that is empty by default, and on n8n Cloud no imports are allowed.
How do I install n8n-code-python?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is n8n-code-python free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is n8n-code-python safe to use?
It scores 94 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to n8n-code-python?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
