n8n-binary-and-data-official
This skill teaches the agent to handle files, images, and binary data in n8n workflows, including the constraints around agent tools where binary cannot cross…
Identity proven by GitHub's verified organisation badge (n8n-io)
- Agents
- Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode, claude.ai and API
- License
- Apache-2.0 (permissive)
- Pin
- 180b841pinned Oct 9, 2026
- Context cost
- about 1,700 tokenswhen the skill loads
- GitHub stars
- 524on n8n-io/skills
- Scripts
- None found
What it does
“Use when handling files, images, attachments, or binary data in n8n, OR when an AI agent needs to take a user-uploaded file as tool input or return a generated file. For Data Tables (schemas, dedup, persistent state), see the separate n8n-data-tables-official skill. Triggers on "file", "image", "PDF", "attachment", "binary", "upload", "download", chat trigger with files, agent tool that needs a file, vision/multimodal, or any handling of non-JSON file data.”
Generated summary from the skill's own text
This skill teaches the agent to handle files, images, and binary data in n8n workflows, including the constraints around agent tools where binary cannot cross boundaries. It covers staging files in storage, passing keys through JSON, keeping binary in context via merge operations, and displaying images in chat surfaces via CDN URLs.
When to use it
- User uploads a file that an agent tool must process
- Agent tool generates a file to return to the user
- Workflow strips binary during JSON transforms and needs to reattach it
- Generated images must display in chat (Slack, Teams, Discord, etc)
When not to
- Working with tabular data storage; use n8n-data-tables-official instead
- Handling only JSON data without files or binary content
Install
These commands install from the publisher's repository and need no account.
skills CLI
npx skills add n8n-io/skills --skill n8n-binary-and-data-officialInstalls from the repository's default branch, which may have changed since the commit we checked.
GitHub CLI 2.90 or later
gh skill install n8n-io/skills n8n-binary-and-data-official@180b8415e3b73f78828cfa01e908e67f89f2a139Installs the commit we checked (180b841).
Copy by hand
Download the folder at 180b841 and put it in .claude/skills/n8n-binary-and-data-official for Claude Code and in .agents/skills/n8n-binary-and-data-official for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.
Copy for your agent
A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.
Prompt
Install the agent skill "n8n-binary-and-data-official" by n8n. Source, pinned to commit 180b8415e3b73f78828cfa01e908e67f89f2a139: https://github.com/n8n-io/skills/tree/180b8415e3b73f78828cfa01e908e67f89f2a139/skills/n8n-binary-and-data-official 1. Download that folder at exactly this commit. Do not use the default branch. 2. Copy every file unchanged, keeping the folder structure, into .claude/skills/n8n-binary-and-data-official/ for Claude Code and .agents/skills/n8n-binary-and-data-official/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist. 3. Do not edit the files, and do not run any script in the folder unless I ask you to. 4. When you are done, list the files you copied and where you put them. Listing and checks: https://www.agentnative.dev/skills/n8n/n8n-binary-and-data-official
SKILL.md at the pin
---
name: n8n-binary-and-data-official
description: Use when handling files, images, attachments, or binary data in n8n, OR when an AI agent needs to take a user-uploaded file as tool input or return a generated file. For Data Tables (schemas, dedup, persistent state), see the separate n8n-data-tables-official skill. Triggers on "file", "image", "PDF", "attachment", "binary", "upload", "download", chat trigger with files, agent tool that needs a file, vision/multimodal, or any handling of non-JSON file data.
---
# n8n Binary and Data
n8n handles two kinds of data: JSON (in `$json`) and binary (in `$binary`), flowing side-by-side. Binary has sharp edges around agent tools, storage, and display contexts (chat surfaces, message rendering).
For tabular storage (Data Tables), see the **`n8n-data-tables-official`** skill.
## Non-negotiables
1. **Binary is in `$binary`, not `$json`.** Don't read file contents from `$json`.
2. **Binary cannot cross the agent tool boundary in either direction.** Tool parameters are JSON only (via `fromAi()`), and tool results are JSON only. Pre-stage binary in storage and pass keys/URLs through JSON. The agent's `passthroughBinaryImages: true` lets the LLM *see* uploaded images for vision, but it does NOT enable tools to receive them. See `references/AGENT_TOOL_BINARY.md`.
## Strong defaults
- **Merge nodes keep binary in context.** When a side computation strips binary, merge it back rather than re-fetching. See `references/MERGE_FOR_CONTEXT.md`.
## Binary basics
In n8n, each item has two slots:
```ts
{
json: { ... }, // your data
binary: { // your files
data: { // 'data' is the typical key; can be any name
data: '<base64>',
mimeType: 'application/pdf',
fileName: 'invoice.pdf',
fileExtension: 'pdf',
},
},
}
```
`$binary.<key>` reads the named property. Most file-handling nodes have a `binaryPropertyName` parameter, the key inside `$binary`.
### Setting binary
File-producing nodes (HTTP Request with binary response, Read Files, etc.) populate `$binary` automatically. To produce binary in a Code node:
```ts
return [{
json: { ... },
binary: {
data: {
data: Buffer.from(content).toString('base64'),
mimeType: 'text/plain',
fileName: 'output.txt',
},
},
}]
```
### Reading binary
```ts
// In a Code node
const buffer = await this.helpers.getBinaryDataBuffer(0, 'data')
const text = buffer.toString('utf-8')
```
Most workflows don't need to read binary directly. Pass it through to consumer nodes (email attachments, file uploads, etc.).
See `references/BINARY_BASICS.md` for more.
## Agent tool gymnastics
Agent tools (sub-workflows wired into a LangChain Agent, or workflows exposed as MCP tools) have a constraint: parameters and results are JSON, not binary. Affects both directions.
**Inbound (user uploads → tool consumes):** the chat trigger gives `files[]`. The agent can have `passthroughBinaryImages: true` for vision, but `fromAi()` can't pass binary to a tool. So:
1. Pre-stage uploaded files: hash a key, upload to private storage.
2. Inject the keys into the agent's system prompt: "Files passed in: [{originalFileName, fileName}]. Use EXACTLY the `fileName` field when calling tools."
3. The tool's `fromAi('imageName', '...', 'string')` receives the key. The sub-workflow downloads from storage.
**Outbound (tool produces → agent returns):** a tool generates a file. It can't return raw binary.
1. Generate binary internally.
2. Upload to storage, get back URL/key.
3. Return JSON: `{ ok: true, file_id: '...', url: '...' }`.
4. The agent embeds the URL in its response, or another tool fetches by key.
For the full pattern including the async-via-webhook variant for long-running tools, see `references/AGENT_TOOL_BINARY.md`.
## Merge for keeping binary in context
A JSON-only operation (Edit Fields, Code, IF) often strips binary from the item. To keep it:
```
[Source with binary] ─┬─→ [Edit Fields: transform JSON] ─┐
│ ├─→ [Merge: by position] ─→ [Email with attachment]
└─────────────────────────────────────┘
```
Merge combines the streams, and binary survives. See `references/MERGE_FOR_CONTEXT.md`.
## CDN requirement for chat surfaces
When a workflow generates an image and the user wants it embedded in a chat message (Slack, Discord, Teams, Telegram, embedded webhook chat, etc.):
- **Binary on the item isn't enough.** Chat surfaces don't read `$binary`; they render messages that reference images by URL (or via platform-specific file upload APIs).
- **The image must live somewhere a URL can fetch.** Upload to a CDN or object store first.
- **The user configures this storage.** Not built into n8n.
Common options span object storage (S3, R2, GCS, Azure Blob, Vercel Blob, Supabase Storage) and drive-style services (Dropbox, Google Drive, OneDrive, Box). Ask the user what they use rather than defaulting to S3.
See `references/CDN_REQUIREMENT.md`.
## Data Tables
For Data Tables, see the **`n8n-data-tables-official`** skill. Distinct surface with its own gotchas (default columns, no foreign keys, no JSON column type, manual-mapping UI quirk).
## Reference files
| File | Read when |
|---|---|
| `references/BINARY_BASICS.md` | First time handling binary, or reading/writing the `$binary` slot |
| `references/AGENT_TOOL_BINARY.md` | Agent tool needs a user-uploaded file, or produces a file (the boundary in either direction) |
| `references/MERGE_FOR_CONTEXT.md` | Binary disappears after a JSON transform and needs to re-attach |
| `references/CDN_REQUIREMENT.md` | Showing images in a chat surface or other places that need URL-referenced images |
## Anti-patterns
| Anti-pattern | What goes wrong | Fix |
|---|---|---|
| Trying to read file content from `$json` | Binary isn't in `$json` | Use `$binary` |
| Building an agent tool that returns binary directly | Tool output is JSON-only, so binary doesn't survive | Upload to storage, return key/URL in JSON (see `AGENT_TOOL_BINARY.md`) |
| Trying to pass uploaded chat files into a tool via `fromAi` | `fromAi` doesn't carry binary, so the tool gets nothing | Pre-stage uploads to storage, inject keys in the system prompt, and have the tool download by key |
| Setting `passthroughBinaryImages: true` and assuming tools can now see the file | The flag only affects what the LLM sees, not what tools receive | Still need the upload-and-pass-key pattern for tools |
| Losing binary after a JSON transform | The transform's output item doesn't have binary | Use Merge to combine the JSON output with the binary stream |
| Storing image in n8n binary and expecting a chat surface to display | Chat surfaces need URL-accessible images (or a platform-native file upload), not raw `$binary` | Upload to CDN, embed URL or use the platform's file API |
| Hardcoding binary base64 in a Code node | Massive workflow JSON, slow, leaky | Reference binary via `$binary` properly, or upload to storage and reference by URL |
From n8n-io/skills at 180b841, shown as plain text under its license: Apache-2.0 (permissive). The license text is in LICENSE.
View SKILL.md on GitHub at 180b841Files
- SKILL.md7.3 KB · a2f7684204ef
- references/
- AGENT_TOOL_BINARY.md17 KB · 0755dbce51eb
- BINARY_BASICS.md4.9 KB · 90fb1c930538
- CDN_REQUIREMENT.md4.7 KB · 79e664507bf1
- MERGE_FOR_CONTEXT.md3.8 KB · c3b7cb7c68d9
5 files, 38 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.
Skill folder on GitHub at 180b841More from n8n
agent-builder
Agent Builder orchestrates the creation, modification, testing, and publishing of n8n Agents.
Claude Code, Codex, Cursor +3 · about 2.3K tokens · pinned 6 days ago
data-table-manager
This skill manages n8n Data Tables through creation, import, querying, and mutation operations.
Claude Code, Codex, Cursor +3 · about 2.1K tokens · pinned 6 days ago
debugging-executions
Debug workflow execution failures by inspecting failed nodes, re-running executions, and comparing expected versus actual values.
Claude Code, Codex, Cursor +3 · about 2.5K tokens · pinned 6 days ago
instance-awareness
This skill teaches the agent to resolve ambiguous requests by reading the instance's activity log and workflow history instead of asking the user to clarify.
Claude Code, Codex, Cursor +3 · about 1.3K tokens · pinned 6 days ago
intent-recognition
Classifies automation requests by determining which primitive owns the top-level control flow (workflow, agent, needs clarification, or out-of-scope) and…
Claude Code, Codex, Cursor +4 · about 6.9K tokens · pinned 6 days ago
n8n-cli
This skill enables agents to manage n8n workflows, credentials, executions, and instance resources via the n8n CLI command-line tool.
Claude Code, Codex, Cursor +4 · about 2.9K tokens · pinned 6 days ago
Related in Backend and APIs
n8n-error-handling-official
This skill guides agents to build robust error handling in n8n workflows, especially for webhook APIs and scheduled jobs.
by n8nOfficial publisher
Contains scripts
Claude Code, Codex, Cursor +3 · about 2.9K tokens · pinned 6 days ago
n8n-loops-official
This skill teaches the agent to use n8n's three looping mechanisms: default per-item iteration (where nodes run automatically once for each input item), the…
by n8nOfficial publisher
Claude Code, Codex, Cursor +4 · about 3.3K tokens · pinned 6 days ago
n8n-node-configuration-official
Configures n8n nodes correctly by fetching their live parameter shapes from the server and resolving dynamic values.
by n8nOfficial publisher
Claude Code, Codex, Cursor +4 · about 1.9K tokens · pinned 6 days ago
n8n-subworkflows-official
This skill guides agents to build reusable sub-workflows in n8n, which are triggered by Execute Workflow Trigger nodes and encapsulate logic for reuse across…
by n8nOfficial publisher
Claude Code, Codex, Cursor +4 · about 5.7K tokens · pinned 6 days ago
build-workflow
This skill builds n8n workflows using code open in your workspace, then validates and tests them before completion.
by n8nOfficial publisher
Claude Code, Codex, Cursor +4 · about 1.8K tokens · pinned 6 days ago
nvflare-orient
Routes NVFLARE requests to appropriate downstream skills based on user intent and preliminary source inspection findings.
by NVIDIAOfficial publisher
Claude Code, Codex, Cursor +4 · about 600 tokens · pinned 6 days ago
Open roles at n8n
3 open roles on the jobs board
- Forward Deployed Engineer - US East Coast
Boston | California | Pennsylvania | New York | Massachusetts | Virginia | Colorado | New Jersey | Georgia | Texas (Remote)
- Forward Deployed Engineer - EMEA
Germany | Netherlands | Portugal | London Office | Ireland | United Kingdom | Spain (Remote)
- Agentic Engineering Platform Engineer
Remote (Europe) (Remote)