mcpField
N
n8n:conventions

n8n:conventions

github.com/n8n-ioDevelopment209.5k319 installsUpdated today
Repository

About n8n:conventions

A quick-reference skill for n8n contributors, collecting key conventions for TypeScript, frontend and backend code, tests, databases, and GitHub workflows. It points to fuller repository guides for additional detail.

Key features

  1. 01TypeScript and error-handling rules
  2. 02Frontend and backend patterns
  3. 03Testing and database guidance
  4. 04Build, lint, and typecheck commands

Use cases

  1. 01Checking conventions before editing n8n
  2. 02Reviewing tests and implementation patterns
  3. 03Running repository checks before a commit

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/n8n-io/n8n --skill n8n:conventions

After installing, type/n8n:conventionsin Claude Code to confirm it loaded.

Details

From the project README

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-workflow';
throw new UnexpectedError('message', { extra: { context } });
// DON'T use deprecated ApplicationError

Frontend:

  • Vue 3 Composition API (<script setup lang="ts">)
  • CSS variables (never hardcode px) - see /packages/frontend/AGENTS.md
  • All text via i18n ($t('key'))
  • data-testid for E2E (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
pnpm typecheck               # Before commit
pnpm lint                    # Before commit

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

PackagePurpose
packages/cliBackend API
packages/frontend/editor-uiVue 3 frontend shell
packages/modules/<name>/frontendFrontend feature modules. Guide: packages/@n8n/module-cli/frontend-module-guide.md
packages/@n8n/api-typesShared types
packages/@n8n/dbTypeORM entities
packages/workflowCore 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

Comments

Markdown supported