# Add n8n automation to an existing project ## 1. Discover the application boundary Inspect existing source, manifests, CI, API/event contracts, authentication, deployment configuration and existing automation. Do not initialize a new project or impose a stack. Identify producer/consumer, trigger (webhook, schedule, event or manual), payload/response mapping, business owner, external side effects, latency/volume and failure expectations. Reuse an existing workflow/sub-workflow only after inspection. Keep core business invariants and authorization in the owning application; do not silently duplicate them in automation. Ask at most three material questions per batch. Reuse supplied answers and accepted ADRs. Without an existing application contract or goal, continue read-only inventory/planning and ask for the missing requirement. Existing project conventions win over proposed paths. Otherwise propose automation/n8n/workflows/, automation/n8n/fixtures/ and docs/project/integrations/n8n/; do not overwrite unrelated artifacts. Use the directly linked integration plan. ## 2. Verify target capabilities Record target n8n version, Cloud/self-hosted mode, execution topology, node types/versions and available node packages. Prefer a sanitized export from that version and actual versioned node documentation/source as evidence. Verify expressions, item/payload semantics, connection graph, webhook response behavior, credential references and sub-workflow dependencies. Do not guess node typeVersion, parameter keys, SDK APIs, CLI flags or a workflow JSON schema. Discover only already available integration tools and inspect their contracts. Official n8n skills may describe connected tools that are absent here: do not claim validate_workflow/test_workflow or a generic n8n validate command exists. The built-in Server CLI and remote n8n CLI have different execution/access models; do not treat them interchangeably. Inspect the installed tool's version/help only within authorized scope. Do not run downloaded scripts, npx packages, containers, community nodes or external MCP connections to make an example work. No verified target schema/version: deliver the design, mapping, ADR proposals and validation/runbook plan, with executable JSON BLOCKED. If writing workflow JSON from verified contracts, label it a draft until target-side validation succeeds. An importable-looking graph, JSON parsing and linting are distinct from semantic/runtime validation. ## 3. Decide meaningful reliability/security contracts Use decision-records.md and only the applicable directly linked ADR templates. For a state-changing duplicate-capable workflow, explicitly decide idempotency key scope, atomic persistence/claim, payload mismatch, in-progress handling, retention and recovery from an ambiguous external outcome. A check-then-insert branch or workflow static state alone is not proof of durable atomic deduplication. For overlapping executions, state the invariant and competing writers (including API users, other workers and n8n executions). Compare optimistic version checks, database uniqueness/transaction isolation, keyed serialization and locks only where appropriate. A global n8n concurrency limit or an in-process lock is not a cross-writer correctness guarantee. Handle out-of-order events and stale updates explicitly. Decide commit-to-delivery gap, acknowledgments, timeout/backoff/retry ownership, retryable/permanent errors, bounded attempts, poison-message quarantine, replay/reconciliation and alerting. Consider transactional outbox/inbox only if the existing transaction/event guarantees require it; do not force CQRS, sagas or distributed locks for every automation. No cross-system exactly-once claim without a defined boundary and evidence. Set schema/version compatibility and trust/credential/data-retention boundaries. Record considered/not-applicable reasons; no decorative ADR for every node. ## 4. Author scoped artifacts and adapters Use verified built-in nodes where sufficient, descriptive names and brief explanations of intent. Preserve workflow identity only for an explicitly intended update; a new workflow or import collision needs a deliberate identity decision. Document environment-specific URL/credential/sub-workflow bindings separately. Exported JSON can contain credential names/IDs and embedded authorization headers or execution/pinned data: inspect and sanitize before committing. Do not export decrypted credentials or store secrets in JSON, examples, argument text, logs or ADRs. Implement any application adapter through its existing authorization/validation/transaction boundary. Define correlation/event IDs, contract version, timeouts, response semantics and idempotency behavior. Use fictional, minimized fixtures. Verify the supported webhook auth mechanism for the target; a random URL, CORS or an IP filter is not a replacement for required authentication/authorization. Distinguish the instance's test and production webhook URLs; read them from the authorized target rather than inventing a reachable endpoint. No public exposure or production trigger activation is implicit. ## 5. Validate at progressively stronger levels 1. Offline: inspect diff, parse JSON if generated, check references/graph/expressions against actual node contracts and review secrets/credentials/data. Do not execute Code/Execute Command/file operations or expressions from imported data as an offline validation shortcut. 2. Application checks: actual adapter unit/integration tests for payload/auth/contract behavior. Use the existing focused testing skills with real/fake topology stated. 3. Authorized isolated n8n target: import under an agreed identity/backup plan, validate with an actual supported editor/tool and review credential mappings. Import can overwrite matching identities; never assume it is a read-only check. 4. Authorized execution: test expected output plus duplicates, concurrent arrivals, out-of-order events, timeout after an external side effect, dependency failures, retry exhaustion and operator replay as relevant. Manual or tool-assisted tests can execute real nodes and side effects; pinned/mocked nodes do not make an arbitrary workflow safe. Verify production/error-trigger behavior separately where manual execution differs; an editor smoke run is not proof production delivery works. Record exact versions/revision, commands/tool calls and exits/results, actual fixture topology, observed side effects and cleanup. Missing target/tool/access remains UNVERIFIED/BLOCKED. No fabricated validation, delivery, credential or connectivity result. Use iteration-review for substantial changes, maximum two review/fix rounds; unavailable independent review stays UNVERIFIED. ## 6. Handoff and authorized release Deliver import/mapping instructions verified for the target version, separate credential provisioning steps without secret values, test-versus-production trigger setup, monitoring, ownership and recovery/replay runbook. Publication/activation/scheduling and credential use are separate authorized actions. Existing authorization persists; do not ask again for an already-approved step. Without it, finish the local reviewable artifacts and describe the remaining step. Before an intended update, preserve an authorized backup/version and inspect ID/name/ownership conflicts. A rollback must stop new triggers, preserve pending work/deduplication history and restore compatible workflow/application bindings; it cannot undo an external email/payment by restoring JSON. Identify compensation/manual reconciliation for irreversible effects. Do not delete another workflow or bypass access checks. Finalize project STATE/ROADMAP and ADR changes before final source-bound review evidence. ## Source basis Official n8n sources checked 2026-12-02: [JSON export/import](https://docs.n8n.io/workflows/export-import/), [Webhook](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.webhook/), [Server CLI](https://docs.n8n.io/hosting/cli-commands/), [error handling](https://docs.n8n.io/flow-logic/error-handling/) and [official lifecycle skill](https://github.com/n8n-io/skills/blob/main/skills/n8n-workflow-lifecycle-official/SKILL.md). This is an independently authored Foundry integration procedure; no upstream skill/code is installed or bundled. Tool names in upstream documentation are not proof those tools are available. Exact target node schemas and deployment compatibility must be verified per project.