Quick reference for n8n patterns. Full docs /AGENTS.md
Install
npx skills add https://github.com/n8n-io/n8n --skill n8nconventionsSKILL.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→ useunknown - Prefer
satisfiesoveras(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-testidfor 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+limitin controllers and services; translate to TypeORMskip/takeonly inside repositories
Testing:
- Vitest (unit), Playwright (E2E)
- Mock external dependencies
- Keep filesystem tests in a test-owned temporary directory
- Set
N8N_USER_FOLDERbefore 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 (usuallycontents: 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
| 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
Related skills
n8n-workflow-lifecycle-officialn8n-io1.8KUse when starting, designing, organizing, finishing, or shipping an n8n workflow. Covers visual layout (sticky notes), descriptions that capture the *why*, node names, validation, testing, folders/projects, and publishing. Triggers on create_workflow_from_code, update_workflow, validate_workflow, publish_workflow, archive_workflow, "design", "lay out", "organize", "structure", "sticky", "describe this workflow", "ship", "deploy", "publish", "name this workflow", or any folder/project organization8n-debugging-officialn8n-io1.6KUse when an n8n workflow isn't working, errors appear, results don't match what was expected, or the user says "this isn't working." Triggers on errors, unexpected output, "it's not working", "why is this happening", "the workflow stopped", failure investigation, or any debugging context.n8n-agents-officialn8n-io1.6KUse when building or editing any AI feature in n8n: AI Agents, Text Classifier, Information Extractor, Sentiment Analysis, Summarization Chain, Basic LLM Chain, embeddings, vector stores, single one-shot LLM calls, or AI media generation (image / audio / video) via the native LangChain provider nodes. Triggers on any `@n8n/n8n-nodes-langchain.*` node, "agent", "chat assistant", "LLM with tools", "tool calling", "fromAi", "system prompt", "memory window", "structured output", "outputParser", "funn8n-error-handling-officialn8n-io1.6KUse when building any webhook-triggered workflow, scheduled/production-bound workflow, wiring a per-node error output, or any workflow where silent failure would drop user-visible work. Triggers on "webhook", "respond to webhook", "API", "production", "error", "failure", "5xx", "try/catch", "error workflow", "onError", "continueErrorOutput", "error branch", "node error output", "output(1)", "main[1]", "scheduled", or any workflow that runs unattended.