sync-credentials
Skill18 starsChanged 42 days agoMITView on GitHub
Sync credential IDs from the live n8n instance. Two modes — list (default) reports IDs + TypeScript snippets, fix-workflows rewrites stale credential IDs in local `.workflow.ts` files by joining on credential name. Use after n8n migration, when setting up a new instance, or in response to a credential-freshness auto-reaction signal.
In this repository25 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- build-stack-v2Skill
- build-workflowSkill
- build-workflow-v2Skill
- check-mcpsSkill
- data-tablesSkill
- deploySkill
- feedbackSkill
- find-credentialSkill
- find-projectSkill
- init-repoSkill
- inventorySkill
- mirror-syncSkill
- n8nac-cheatsheetSkill
- n8nac-referenceSkill
- n8n-code-javascriptSkill
- n8n-code-pythonSkill
- n8n-modeSkill
- n8n-orchestration-patternsSkill
- n8n-structured-extractionSkill
- plugin-testingSkill
- pull-schemasSkill
- session-envSkill
- stack-intakeSkill
- test-manualSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
All work happens in scripts/ (colocated).
- Very specific: line 33
Add --dry-run to preview without writing files.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Sync Credentials from n8n Instance
All work happens in scripts/ (colocated). The skill body is short on purpose — the scripts are the source of truth.
Modes
Default — list live credentials
node "$CLAUDE_PLUGIN_ROOT/skills/sync-credentials/scripts/list.js"Prints a table of all credentials on the active n8n instance plus ready-to-paste TypeScript snippets. Read-only.
--fix-workflows — rewrite stale credential IDs
node "$CLAUDE_PLUGIN_ROOT/skills/sync-credentials/scripts/fix-workflows.js" [--dry-run] [--all-projects]Walks workflows/**/*.workflow.ts, finds every credentials: { <type>: { id: '…', name: '…' } } block, joins by credential name against the live instance filtered to the workspace-pinned project, and rewrites the id value where the live ID differs from the local one. Order of id / name inside the block is tolerated; type mismatches and orphans are reported and NOT auto-rewritten.
Project scoping (default): credentials owned by projects other than the active workspace project are dropped from the candidate pool. This prevents cross-project ID injection that would push fine but fail at runtime ("credential not accessible"). Use --all-projects to disable the filter (rare).
Add --dry-run to preview without writing files.
This is what the SessionStart credential-freshness auto-reaction triggers:
AUTOPILOT_ACTION_REQUIRED: /n8n-autopilot:sync-credentials --fix-workflowsCompanion scripts
scripts/list.js— fetches credentials vianpx n8nac credential list --json, prints table + snippetsscripts/fix-workflows.js— the rewrite logic. Self-contained Node script, tolerant block-parsing regex, surgicalid:replacement inside each matched block (never global), conflict + orphan reporting.
Prerequisites
- n8nac workspace bound. Check via
npx n8nac workspace status --json. If not bound, runnpx n8nac setup --mode connect-existingfirst. - At least one credential configured on the live instance (or create one via
npx n8nac credentials ensure <recipeId>from the shared recipe catalogue).
Error Handling
n8nac credential listfails → script exits 1 with a hint to checkworkspace status.- No
.workflow.tsfiles → script exits 2 with a hint. - Type mismatch (workflow says
openAiApi, live credential with that name isopenRouterApi) → reported as conflict, NOT rewritten. - Duplicate name on instance (same credential name appears twice live) → reported as conflict, NOT rewritten — user must rename one on the instance.
- Orphan (workflow references a name that does not exist on live instance) → reported, NOT rewritten — user creates the credential or removes the reference.
When to auto-trigger this skill
The SessionStart hook scripts/check-credential-freshness.sh (plugin-wide, not in this skill folder — it is a generic plugin hook) emits the auto-reaction line above when it detects local workflow files referencing credential IDs that do not exist on the live instance. Run with --fix-workflows in that case — list alone does not resolve the underlying problem.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

