← 返回列表
全部 Skill›DevOps›n8n-conventions

n8n-conventions

作者 @n8n-io · 语言 en
Quick reference for n8n patterns. Full docs /AGENTS.md
DevOpsGit 工作流通用执行命令待翻译
存储库
最近源活动
—
检测 SKILL.md 语言
en
星标 ★
210,427
分支 Fork
0
安装选项
提示
指令
使用 AI 助手安装
将下面的提示复制到你正在使用的 AI 助手中。
下载完整 Skill 目录(含全部配套文件)。 下载压缩包 ↓
SKILL.md 原文预览

n8n Quick Reference

📚 Full Documentation:

  • General: /AGENTS.md - Architecture, commands, workflows
  • Frontend: /packages/frontend/AGENTS.md - CSS variables, timing

Use this skill when you need quick reminders on critical patterns.

Critical Rules (Must Follow)

Technical writing (comments, PRs, issues, docs):

  • Write in ASD-STE100 Simplified Technical English: short sentences, the

active voice, one instruction for each sentence

TypeScript:

  • Never any → use unknown
  • Prefer satisfies over as (except tests)
  • Shared types in @n8n/api-types

Error Handling:

import { UnexpectedError } from '@n8n/errors';
throw new UnexpectedError('message', { extra: { context } });
// DON'T use deprecated ApplicationError

Frontend:

  • Vue 3 Composition API (<script setup lang="ts">)
  • Pinia setup stores (defineStore(<id>, () => { ... }))
  • CSS variables (never hardcode px) - see /packages/frontend/AGENTS.md
  • All text via i18n: i18n.baseText('<key>'), with i18n from useI18n()
  • data-test-id for tests (single value, no spaces)

Backend:

  • Controller → Service → Repository
  • Dependency injection via @n8n/di
  • Config via @n8n/config
  • Zod schemas for validation
  • Pagination args: use offset + limit in controllers and services; translate to TypeORM skip/take only inside repositories

Testing:

  • Vitest (unit), Playwright (E2E)
  • Mock external dependencies
  • Keep filesystem tests in a test-owned temporary directory
  • Set N8N_USER_FOLDER before importing settings code
  • Trace branches activated by mocks and isolate every reachable mutation
  • Work from package directory: pushd packages/cli && pnpm test

Database:

  • SQLite/PostgreSQL only (app DB)
  • Exception: DB nodes (MySQL Node, etc.) can use DB-specific features

GitHub Workflows:

  • Every workflow declares a least-privilege top-level permissions: block

(usually contents: read); jobs needing more override at job level

Commands:

pnpm build > build.log 2>&1  # Always redirect

Before you commit, follow "Verify changes" in /AGENTS.md. Do not run full

lint or typecheck as routine checks. CI runs them.

Secrets: pnpm command lines may be recorded verbatim (opt-in dev metrics) —
pass sensitive values via env vars, never inline on the command line.

Key Packages

| Package | Purpose |

|---------|---------|

| packages/cli | Backend API |

| packages/frontend/editor-ui | Vue 3 frontend shell |

| packages/modules/<name>/frontend | Frontend feature modules. Guide: packages/@n8n/module-cli/frontend-module-guide.md |

| packages/@n8n/api-types | Shared types |

| packages/@n8n/db | TypeORM entities |

| packages/workflow | Core interfaces |

Common Patterns

Pinia Store:

import { STORES } from '@n8n/stores';
export const useMyStore = defineStore(STORES.MY_STORE, () => {
  const state = shallowRef([]);
  return { state };
});

Vue Component:

<script setup lang="ts">
type Props = { title: string };
const props = defineProps<Props>();
</script>

Service:

import { Service } from '@n8n/di';
import { Config } from '@n8n/config';

@Service()
export class MyService {
  constructor(private readonly config: Config) {}
}

📖 Need more details? Read /AGENTS.md and /packages/frontend/AGENTS.md

评论
Nn8n-io
n8n-io
n8n-io/n8n
查看 GitHub 仓库 查看作者的其他 Skill
来源信息
作者@n8n-io
所属大类DevOps / Git 工作流
国内可用性通用
最近源活动—
风险提示执行命令
提示:风险标签为程序静态扫描结果,仅作提示,不代表安全认证。安装前请阅读 SKILL.md 及其引用的脚本、权限,自行判断是否可信。