Load before calling the app tools. Use when the user wants to build or change an n8n App: a small web app, form, dashboard, tracker or other browser UI that n8n hosts. Also load when the conversation lists app targets or a pending app.
82%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Low
Low-risk findings worth noting
An n8n App is a static browser app (Vue 3 and Vite). n8n stores its source,
builds it in a sandbox and hosts the build on the apps domain. open_app puts
the source of an app into your sandbox workspace and commit_app saves it back.
You edit the files with the workspace tools.
localStorage.@n8n/app-sdk, so never add it to package.json. Use plain CSS by default.
Install another public npm package only when the app needs it.location.origin. Never hardcode a host: the preview
and the published app run on different hosts.A new app starts from this source:
index.html loads /src/main.js.src/main.js mounts src/App.vue on #app.vite.config.js uses the Vue plugin.package.json and package-lock.json use exact package versions.Add components under src/. Keep files small and focused.
create_app, make sure you understand what the user wants to
achieve, who will use the app, its core data, its essential actions, and its
required views. Do not propose a blueprint while a material part of the
request is unclear. Use ask_user to clarify it. Prefer selectable options
with a recommended default. Do not ask about minor styling or details with
safe defaults.create_app with a short blueprint. The
user can review the description and edit the name, namespace, visibility,
and theme before approval. Include a high-level binding plan for the
workflows, data tables, and agents the app is likely to need. Do not delay
the blueprint to design every resource or find every resource id. Mark a
resource as existing and include its id only when you already know it.
Otherwise, mark it as new. Do not create or change a resource before the
user approves the blueprint. Approval creates the app. Build from the
blueprint returned by the tool, not from your proposal.
Then call open_app with the returned app.id before you edit files. After
the app is open, build and commit the app layout with empty data first.
Create data tables, workflows and agents only after that commit. See
Build order for a new app.
If the user cancels, do not create, open, or edit app files.create_app. n8n reuses the
pending id after approval.appId from the conversation context. If the
conversation has no id, call list_apps (optionally with a search text) and
pick the app by name. If several apps match, ask the user which one. Then
call open_app.open_app returns the app folder, apps/<appId>. It keeps a folder that is
already open, with your uncommitted edits.light, build only a light theme.dark, build only a dark theme.both, add light and dark styles. Use
@media (prefers-color-scheme: dark) so the app responds to the theme
switch in the preview and to the browser setting when opened directly.workspace_read_files and change
files with workspace_edit_files. Put all the files of one step into one
call, not one call for each file. Use the single-file tools only for a single
file. Read only what you need: use grep to find text, and read line ranges
of large files. workspace_edit_files runs every operation and reports each
one, so fix only the operations that failed. To add a dependency, run
npm install --save-exact --ignore-scripts --no-audit --no-fund --prefer-offline --registry=https://registry.npmjs.org <package>
in the app folder. Install all required packages in one command. Use only
packages from the public npm registry. Do not use Git, URL, file, workspace
or custom-registry dependencies. Do not run install when the dependency
files did not change.npm ci --ignore-scripts --no-audit --no-fund --prefer-offline once, then
npm run build. After that, run only npm run build unless package.json
or package-lock.json changed. Fix every error and build again until the
build passes.commit_app saves the folder (without
node_modules and dist) as one version, and n8n builds it again. Never
commit half-done work: every commit is a version. An app layout with empty
data is a finished step.commit_app returns buildStatus. On failed, read
diagnostics (stage, message, log), fix the source and commit again. After
three failed builds in a row, stop and explain the problem to the user.If a commit reports that the app draft changed, someone else saved a newer
version. Your folder is kept. Note your changes, call discard_app_changes to
load the newer draft, and apply your changes again. It keeps node_modules. Run
npm ci --ignore-scripts --no-audit --no-fund --prefer-offline only if the
newer draft changed the package files.
The user must see the app in the preview before you create any data table, workflow or agent. This rule has no exceptions: follow it also when the data is simple, or when you could build against real data at once.
new. Then add the bindings (see Call n8n).If the blueprint marks no resource as new, there is nothing to create. Bind
the existing resources before the first commit and use the real data.
A binding gives the app access to one workflow, data table or agent of its project under a key. The app uses the key, never a resource ID.
Call list_app_bindings with the appId. The result lists each binding
with its key, kind, resource name and permissions, and types describes the
input, output and row shapes. Use only keys from this list in the source.
If the app needs a resource without a binding, add one with bind_app_resource:
{ key, kind: 'dataTable', dataTableId, permissions } with permissions
from read, insert, update and delete.{ key, kind: 'workflow', workflowId }.{ key, kind: 'agent', agentId, permissions } with permissions from
chat and history.Find the ID with the data table, workflow or agent tools. The resource must
be in the project of the app. The key is a short camelCase name, for
example tasks. A binding with an existing key replaces that binding.
Remove a binding that the app no longer uses with unbind_app_resource and
its key.
Grant only the permissions that the app uses. Every visitor who can open
the app can use its bindings. On an instance app, this is every user of
the instance. Ask the user before you give an instance app write access, a
workflow or agent chat.
Read warnings in each result. A missing resource or an unpublished
workflow or agent gives the app an error. Tell the user about it.
Each binding change saves a new version of the app, like a commit. You can
change bindings before the first commit and while the app folder is open. A
binding change keeps an open folder on the current draft, so you do not need
to discard it. If a commit reports that the app draft changed, use
discard_app_changes as described in Workflow. The live app gets
the new bindings when the user publishes.
Import the client from @n8n/app-sdk. It calls the API of the app origin, so
it works on the preview and on the published app:
import { n8n, N8nAppError } from '@n8n/app-sdk';
// Workflow: `output` holds the items of the node that ran last.
const run = await n8n.workflows.submit.run({ email });
if (run.status !== 'success') throw new Error(run.error ?? run.status);
// Data table: each call needs the matching permission. Without `read`,
// `update` and `delete` return only the `id` of each row.
const { data, count } = await n8n.tables.tasks.list({ sortBy: 'createdAt:desc', take: 50 });
await n8n.tables.tasks.insert([{ title: 'New task' }]);
await n8n.tables.tasks.update({ filters: [{ columnName: 'id', value: 1 }] }, { done: true });
// Agent: `text()` reads the whole reply. Iterate the chat to stream events.
const reply = await n8n.agents.support.chat(message).text();
// Visitor: the signed-in n8n user.
const { user } = await n8n.me();Every call throws N8nAppError with status, code and message on failure.
Show the user a short error message, and a loading state while a call runs.
A workflow can use the visitor's own accounts. When the visitor has not
connected one, run throws code credentials_required, and
error.credentials lists the accounts. Show a link for each account with a
connectUrl. Open the link in a new tab. Let the visitor run the workflow
again after they connect:
try {
await n8n.workflows.submit.run({ email });
} catch (error) {
if (error instanceof N8nAppError && error.code === 'credentials_required') {
showConnectLinks(error.credentials.filter((c) => c.connectUrl));
} else throw error;
}By default, bind data tables to the app and read and write them directly. A bound data table shows all its rows to every visitor. This is correct when all visitors share the same data.
Use a workflow only when each visitor must see or change only their own rows,
and the app must not trust the visitor's input. The visitor can change a user
ID, email or name that the app sends in the run input or in a table filter. Use
the values from n8n.me() only for display. For this case:
Do not bind the data table to the app.
Bind a workflow that reads and writes the table for the visitor.
In that workflow, add a Code node directly after the trigger. The Code node reads the visitor's user ID and adds it to each item:
const visitor = $execution.customData.get('appVisitor');
return $input.all().map((item) => ({ json: { ...item.json, visitor } }));In the later nodes, read visitor from the output of the Code node. For
example, filter and set a userId column of the data table with it.
The value has the format user:<id>. Read appVisitor only in a Code node.
One conversation can build several apps for one requirement, for example a
dashboard for all users and an admin app for the project. Create one app for
each audience or access level. Each app has its own folder. Commit each app separately and always pass
the right appId.
You cannot publish apps. Tell the user to publish with the Publish button of the app. The app uses the visibility that the user approved in the blueprint. The user can change it in the app settings.
n8n-io/n8n
e405c26
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.