n8n Code Tool is a skill for Claude that covers the Custom Code Tool node (toolCode) an AI agent invokes. It looks like the workflow Code node but has a different contract: the input arrives as query (or _query in Python) and the result must be a string.
The skill covers unstructured input with a JSON string, structured input through specifyInputSchema, tool names and descriptions, the helpers missing from the sandbox, the common errors with their fixes and when a sub-workflow tool or HTTP Request Tool fits better.
What You Get
- A side-by-side table of the Code node and the Custom Code Tool
- Minimal JavaScript and Python examples for query and _query
- Both input modes: a JSON string in unstructured mode and a validated object in structured mode
- Fixes for Wrong output type returned, No execution data available and the object-returned-as-response error
- A table of helpers the Code Tool sandbox does not have
- A decision list for Code Tool, toolWorkflow and HTTP Request Tool
Common Use Cases
- Adding a deterministic calculator or formatter to an AI agent
- Fixing an agent that never calls its code tool
- Switching a tool to a typed input schema so the model stops sending free text
- Moving a tool that needs an API call or $fromAI into a sub-workflow tool
What Makes It Unique
It focuses on one node that is easy to confuse with the Code node and lists each place where the two differ. It gives error messages with causes, tells Claude to write error text for the model to read on retry, and states the rule that wanting $fromAI means choosing a sub-workflow tool.
Under The Hood
The skill is instructions and two reference markdown files, with no scripts. It tells Claude to inspect the toolCode node and validate configuration through the n8n-mcp tools against your n8n server. The code it teaches runs in a narrow sandbox with pure computation only, with no web requests, workflow items or stored state.