bot-automation — the bot / workflow-automation builder sub-skill
What this sub-skill is for
Standing up something that runs on its own: a chat bot (Discord/Telegram) that responds to
commands and events, or a workflow automation (n8n flow, cron job, or scheduler) that fires on a
trigger and does work without a human in the loop. The two share the same spine — triggers, a handler,
secrets, and a place to keep running — so this one sub-skill covers both and asks which.
Mandatory grill-questions (fold into the Definition of Ready)
Lock these before any code:
- Platform — Discord bot / Telegram bot / n8n workflow / plain cron-or-scheduler script? (or a combo,
e.g. a bot that also runs scheduled jobs.)
- Triggers & events — what fires it? Slash/command messages, reactions, joins (bots); webhook, schedule,
inbound email, DB change (workflows). List every event it must handle.
- Actions — what does it do per trigger, and which external services/APIs does it touch?
- Hosting model — always-on (a long-lived process: needs a host — VPS, container, systemd user
service, or n8n instance) vs. scheduled/cron (wakes, runs, exits). This drives the whole deploy shape.
- Secrets — bot tokens, API keys, webhook secrets. Where do they live? (env / secret store — never the repo.)
- State — stateless, or does it need a store (file, SQLite, Supabase/Postgres) for queues, dedupe, memory?
- Rate limits & idempotency — platform limits respected? Re-delivered events safe to re-run?
- Permissions/scopes — Discord intents / Telegram bot scopes / OAuth scopes kept minimal.
Project sub-agents to generate (into .claude/agents/)
- workflow-builder (delegate-by-default) — builds n8n workflows via the n8n MCP, following its mandated
order; validates before saving. (See the n8n chain below.)
- bot-command-handler (delegate-by-default) — implements bot commands/event handlers, registers slash
commands, handles errors and rate limits, keeps replies clean (no emojis).
- scheduler — sets up cron/schedule triggers and the always-on-vs-cron deploy (systemd user unit, container,
or n8n schedule node); chains
update-config for any local hooks.
- integration-tester — drives a trigger end-to-end and asserts the action happened (message sent / row
written / webhook delivered).
Tools / CLIs / MCP / skills needed
Check in environment-readiness; offer install, never auto-install:
- n8n MCP (chain this for any workflow build) — follow its required order:
get_sdk_reference →
get_suggested_nodes → search_nodes → get_node_types (exact params) → write code → validate_workflow
→ create_workflow_from_code → update_workflow. Do not guess SDK/node params; read the reference first.
- Bots: Node 20+ (
discord.js, telegraf/grammy) or Python (discord.py, python-telegram-bot).
Register the bot in the platform's dev portal; the user pastes the token.
- Scheduling: system
cron, a systemd user timer (matches the user's existing service pattern), or n8n's
schedule trigger for always-on n8n.
- MCP to chain:
n8n (workflows), Supabase (state/queue/dedupe store), claude-in-chrome / playwright
(browser-driven steps a workflow can't reach via API).
- CHAIN these GLOBAL skills:
update-config (hooks / scheduled-agent wiring), cli-anything if it must
drive a GUI tool headlessly, claude-api if a handler/workflow calls Claude (read it before any model id),
verify + code-review before "done".
File / asset nudges (on top of the base set)
Beyond CLAUDE.md, PROJEKT_.md, TASKS.md, DONE.md, README, .claude/:
.env.example — every secret named (token, API keys, webhook secret); real .env is gitignored, never committed.
- Bots:
src/bot.*, src/commands/ (one file per command/handler), command-registration script.
- n8n:
workflows/<name>.json export(s) + a notes file recording the node IDs/params used, so a flow can
be rebuilt or version-controlled.
- Cron/scheduler: the script + a
*.service/*.timer unit (or crontab line) + a deploy note.
runbook.md — how to start/stop/restart, where logs go, how to rotate the token.
state/ or a Supabase schema if a store was chosen; logs/ (gitignored).
Stack defaults & done-bar
Default stack: Discord/Telegram bot → Node 20 + discord.js/grammy, slash commands, run as a long-lived
systemd user service (the user's standing pattern). Workflow → n8n built through its MCP (validated +
published), or a Python/Node script on a systemd timer / cron for simple scheduled jobs. Secrets in env;
state in SQLite or Supabase when needed.
"Finished/working" means (checkable bar):
- Bot: logs in, registers its commands, and responds correctly to each defined command/event in a live
test; handles an unknown command and a rate-limit gracefully.
- Workflow:
validate_workflow passes, the flow is created/published in n8n, and a manual execute_workflow
produces the expected action.
- Schedule: the cron/timer/schedule trigger is installed and actually fires (verified by a real run, not
just a config that looks right).
- Secrets load from env (not hardcoded); restart/runbook works; an end-to-end trigger→action test passes.
Guardrails
- Tokens/keys are secrets — env or secret store only; ask the user to supply them; never invent, never commit.
A leaked bot token = account takeover.
- Minimal scopes/intents — request only the Discord intents / Telegram / OAuth scopes the actions need.
- Idempotency & rate limits — handle re-delivered events without duplicate side-effects; respect platform limits.
- No spam / compliance — outbound messaging (DMs, broadcasts, email steps) must respect opt-out and platform
ToS; don't build mass-DM or scraping bots that violate terms.
- Validate before deploy — never publish an unvalidated n8n workflow or push an untested handler live.
- No emojis in bot replies or output (user's standing rule) — typographic symbols only.
- Commits under the user's name only (Skryx-L-A); never add Claude as co-author.
1---2name: bot-automation3description: Build/set up a bot or automation project — a Discord/Telegram bot OR a workflow automation (n8n, cron, scheduler) — from the user's grilled answers. Project-kit sub-skill loaded by new-project routing whenever someone wants to build a bot, automate a workflow, schedule a recurring job, wire up event triggers, or connect services. Chains the n8n MCP for workflow builds and bakes in hosting (always-on vs cron), secret handling, and a runs-on-schedule done-bar.4---56# bot-automation — the bot / workflow-automation builder sub-skill78## What this sub-skill is for9Standing up something that **runs on its own**: a chat **bot** (Discord/Telegram) that responds to10commands and events, or a **workflow automation** (n8n flow, cron job, or scheduler) that fires on a11trigger and does work without a human in the loop. The two share the same spine — triggers, a handler,12secrets, and a place to keep running — so this one sub-skill covers both and asks which.1314## Mandatory grill-questions (fold into the Definition of Ready)15Lock these before any code:16- **Platform** — Discord bot / Telegram bot / n8n workflow / plain cron-or-scheduler script? (or a combo,17 e.g. a bot that also runs scheduled jobs.)18- **Triggers & events** — what fires it? Slash/command messages, reactions, joins (bots); webhook, schedule,19 inbound email, DB change (workflows). List every event it must handle.20- **Actions** — what does it do per trigger, and which external services/APIs does it touch?21- **Hosting model** — **always-on** (a long-lived process: needs a host — VPS, container, systemd user22 service, or n8n instance) vs. **scheduled/cron** (wakes, runs, exits). This drives the whole deploy shape.23- **Secrets** — bot tokens, API keys, webhook secrets. Where do they live? (env / secret store — never the repo.)24- **State** — stateless, or does it need a store (file, SQLite, Supabase/Postgres) for queues, dedupe, memory?25- **Rate limits & idempotency** — platform limits respected? Re-delivered events safe to re-run?26- **Permissions/scopes** — Discord intents / Telegram bot scopes / OAuth scopes kept minimal.2728## Project sub-agents to generate (into `.claude/agents/`)29- **workflow-builder** *(delegate-by-default)* — builds n8n workflows via the n8n MCP, following its mandated30 order; validates before saving. (See the n8n chain below.)31- **bot-command-handler** *(delegate-by-default)* — implements bot commands/event handlers, registers slash32 commands, handles errors and rate limits, keeps replies clean (no emojis).33- **scheduler** — sets up cron/schedule triggers and the always-on-vs-cron deploy (systemd user unit, container,34 or n8n schedule node); chains `update-config` for any local hooks.35- **integration-tester** — drives a trigger end-to-end and asserts the action happened (message sent / row36 written / webhook delivered).3738## Tools / CLIs / MCP / skills needed39Check in environment-readiness; offer install, never auto-install:40- **n8n MCP (chain this for any workflow build)** — follow its required order: `get_sdk_reference` →41 `get_suggested_nodes` → `search_nodes` → `get_node_types` (exact params) → write code → `validate_workflow`42 → `create_workflow_from_code` → `update_workflow`. Do not guess SDK/node params; read the reference first.43- **Bots:** Node 20+ (`discord.js`, `telegraf`/`grammy`) or Python (`discord.py`, `python-telegram-bot`).44 Register the bot in the platform's dev portal; the user pastes the token.45- **Scheduling:** system `cron`, a `systemd` user timer (matches the user's existing service pattern), or n8n's46 schedule trigger for always-on n8n.47- **MCP to chain:** `n8n` (workflows), `Supabase` (state/queue/dedupe store), `claude-in-chrome` / `playwright`48 (browser-driven steps a workflow can't reach via API).49- **CHAIN these GLOBAL skills:** `update-config` (hooks / scheduled-agent wiring), `cli-anything` if it must50 drive a GUI tool headlessly, `claude-api` if a handler/workflow calls Claude (read it before any model id),51 `verify` + `code-review` before "done".5253## File / asset nudges (on top of the base set)54Beyond CLAUDE.md, PROJEKT_<NAME>.md, TASKS.md, DONE.md, README, `.claude/`:55- `.env.example` — every secret named (token, API keys, webhook secret); real `.env` is gitignored, never committed.56- **Bots:** `src/bot.*`, `src/commands/` (one file per command/handler), command-registration script.57- **n8n:** `workflows/<name>.json` export(s) + a notes file recording the node IDs/params used, so a flow can58 be rebuilt or version-controlled.59- **Cron/scheduler:** the script + a `*.service`/`*.timer` unit (or crontab line) + a deploy note.60- `runbook.md` — how to start/stop/restart, where logs go, how to rotate the token.61- `state/` or a Supabase schema if a store was chosen; `logs/` (gitignored).6263## Stack defaults & done-bar64**Default stack:** Discord/Telegram bot → Node 20 + `discord.js`/`grammy`, slash commands, run as a long-lived65**systemd user service** (the user's standing pattern). Workflow → **n8n** built through its MCP (validated +66published), or a Python/Node script on a **systemd timer / cron** for simple scheduled jobs. Secrets in env;67state in SQLite or Supabase when needed.6869**"Finished/working" means** (checkable bar):70- **Bot:** logs in, registers its commands, and **responds correctly** to each defined command/event in a live71 test; handles an unknown command and a rate-limit gracefully.72- **Workflow:** `validate_workflow` passes, the flow is created/published in n8n, and a manual `execute_workflow`73 produces the expected action.74- **Schedule:** the cron/timer/schedule trigger is installed and **actually fires** (verified by a real run, not75 just a config that looks right).76- Secrets load from env (not hardcoded); restart/runbook works; an end-to-end trigger→action test passes.7778## Guardrails79- **Tokens/keys are secrets** — env or secret store only; ask the user to supply them; never invent, never commit.80 A leaked bot token = account takeover.81- **Minimal scopes/intents** — request only the Discord intents / Telegram / OAuth scopes the actions need.82- **Idempotency & rate limits** — handle re-delivered events without duplicate side-effects; respect platform limits.83- **No spam / compliance** — outbound messaging (DMs, broadcasts, email steps) must respect opt-out and platform84 ToS; don't build mass-DM or scraping bots that violate terms.85- **Validate before deploy** — never publish an unvalidated n8n workflow or push an untested handler live.86- **No emojis in bot replies or output** (user's standing rule) — typographic symbols only.87- **Commits under the user's name only (Skryx-L-A); never add Claude as co-author.**