Practical example repository for generating and managing n8n workflows with an OpenAI Codex skill plus a small n8n API helper script.
n8n is powerful, but development is mainly GUI-based. When workflows grow larger, editing and iterating through the UI becomes inefficient.
This repo explores a different approach:
- Generate workflows using AI (vibe coding style)
- Modify workflows programmatically
- Use exported JSON examples as training/context
- Deploy workflows via API instead of manual UI steps
The goal is to move n8n workflow development from GUI-only -> to AI-assisted code-driven development.
If you're working with n8n and want a more scalable way to build workflows, feel free to check it out.
- Build a local reference corpus of real workflow JSON files.
- Let Codex analyze node usage and wiring patterns.
- Generate new workflows from that learned pattern.
- Upload, edit, and activate workflows through the n8n Public API.
Before asking Codex to generate workflows, collect real workflow examples. Without reference examples, output quality will be much lower.
First choice (recommended):
- Export workflows directly from your own n8n instance with:
uv run scripts/export_workflows.pyAlternative:
- Download template workflows from a public source, for example:
https://github.com/enescingoz/awesome-n8n-templates
Then place JSON files in workflow/ and ask Codex to analyze them first.
uvinstalled- Access to an n8n instance with a Public API key
- Create environment:
uv venv- Create local config file:
Copy-Item .env.example .env-
Link this repo to your n8n API key:
- In your n8n main page, go to:
Settings -> n8n API -> Create an API Key - Use:
Label:codexExpiration:No Expiration
- Copy the generated key (you will paste it into
.envin the next step).
- In your n8n main page, go to:
-
Set API values in
.env:
N8N_BASE_URL=https://your-n8n-host/
N8N_API_KEY=replace-with-your-api-key- Skill:
.agents/skills/n8n/SKILL.md - API helper script:
.agents/skills/n8n/scripts/n8n_api.py - API reference notes:
.agents/skills/n8n/references/n8n-reference.md - Workflow generation guide from local analysis:
.agents/skills/n8n/references/workflow-node-generation-guide.md
Export all workflows from your instance:
uv run scripts/export_workflows.pyView one workflow:
uv run .agents/skills/n8n/scripts/n8n_api.py workflow view --id <workflowId>Download one workflow JSON:
uv run .agents/skills/n8n/scripts/n8n_api.py workflow download --id <workflowId> --out workflow/<name>.json- Run
uv run scripts/export_workflows.pyto populateworkflow/*.jsonfrom your n8n instance. - Optionally add extra examples from public template repositories.
- Ask Codex to analyze node purposes and connection patterns.
- Ask Codex to generate a new workflow JSON file in
workflow/. - Validate and upload:
uv run .agents/skills/n8n/scripts/n8n_api.py workflow create --file workflow/<generated>.json- Update an existing workflow:
uv run .agents/skills/n8n/scripts/n8n_api.py workflow edit --id <workflowId> --file workflow/<generated>.json- Activate after validation:
POST /workflows/{id}/activate(Codex can run this for you).
Show help:
uv run .agents/skills/n8n/scripts/n8n_api.py --helpWorkflow operations:
uv run .agents/skills/n8n/scripts/n8n_api.py workflow view --id <workflowId>
uv run .agents/skills/n8n/scripts/n8n_api.py workflow create --file workflow.json
uv run .agents/skills/n8n/scripts/n8n_api.py workflow edit --id <workflowId> --file workflow-updated.json
uv run .agents/skills/n8n/scripts/n8n_api.py workflow delete --id <workflowId>Execution operations:
uv run .agents/skills/n8n/scripts/n8n_api.py execution list --limit 5
uv run .agents/skills/n8n/scripts/n8n_api.py execution get --id <executionId>
uv run .agents/skills/n8n/scripts/n8n_api.py execution retry --id <executionId> --load-workflow
uv run .agents/skills/n8n/scripts/n8n_api.py execution stop --id <executionId>This repository is an OpenAI Codex-oriented example. The skill layout and workflow may not work as-is in other coding assistants.
If you use another tool, ask that tool to:
- Convert this skill structure into its own skill/agent format.
- Preserve the same n8n API guardrails and workflow-generation rules.
- Re-map file paths and command conventions as needed.
Simple prompt:
Create a workflow that summarizes important daily news and sends it to my Telegram, then upload it to n8n.
Stronger prompt (recommended):
Please analyze workflow/*.json first, then generate an n8n workflow that collects important daily news and sends one summary message to Telegram. Use multi-source RSS, keep only today's items, deduplicate by URL, and include both Schedule Trigger and Manual Trigger. Save JSON under workflow/, upload it to n8n using .agents/skills/n8n/scripts/n8n_api.py, and report the created workflow ID plus activation status.
Why this works better:
- It forces analysis-first behavior using local references.
- It defines concrete functional requirements.
- It requires file output, upload, and verifiable completion details.


