$npx -y skills add vrtalex/bitrix24-skill --skill bitrix24-agentDesign, implement, debug, and harden integrations between AI agents and Bitrix24 REST API (webhooks, OAuth 2.0, scopes, events, batch, limits, REST 3.0). Use whenever the user wants to connect an AI assistant or agent to a Bitrix24 portal or act on one — for example create or upd
| 1 | # Bitrix24 Agent (Lean + Reliable) |
| 2 | |
| 3 | Use this skill to deliver correct Bitrix24 integrations with low token usage and production-safe defaults. |
| 4 | |
| 5 | ## Quick Start |
| 6 | |
| 7 | Use this flow unless the user asks for a different one: |
| 8 | |
| 9 | 1. Pick intent + one minimal pack (`core` by default). |
| 10 | 2. Run a read probe first. |
| 11 | 3. For writes, use plan then execute with confirmation. |
| 12 | |
| 13 | Read probe: |
| 14 | |
| 15 | ```bash |
| 16 | python3 skills/bitrix24-agent/scripts/bitrix24_client.py user.current --params '{}' |
| 17 | ``` |
| 18 | |
| 19 | Safer write flow: |
| 20 | |
| 21 | ```bash |
| 22 | python3 skills/bitrix24-agent/scripts/bitrix24_client.py crm.lead.add \ |
| 23 | --params '{"fields":{"TITLE":"Plan demo"}}' \ |
| 24 | --packs core \ |
| 25 | --plan-only |
| 26 | |
| 27 | python3 skills/bitrix24-agent/scripts/bitrix24_client.py \ |
| 28 | --execute-plan <plan_id> \ |
| 29 | --confirm-write |
| 30 | ``` |
| 31 | |
| 32 | ## Runtime Prerequisites |
| 33 | |
| 34 | Required environment: |
| 35 | |
| 36 | - `B24_DOMAIN` |
| 37 | - `B24_AUTH_MODE` = `webhook` or `oauth` |
| 38 | |
| 39 | Webhook mode: |
| 40 | |
| 41 | - `B24_WEBHOOK_USER_ID` |
| 42 | - `B24_WEBHOOK_CODE` |
| 43 | |
| 44 | OAuth mode: |
| 45 | |
| 46 | - `B24_ACCESS_TOKEN` |
| 47 | - `B24_REFRESH_TOKEN` |
| 48 | - `B24_CLIENT_ID` and `B24_CLIENT_SECRET` (for `--auto-refresh`) |
| 49 | |
| 50 | Useful safety/reliability flags: |
| 51 | |
| 52 | - `B24_REQUIRE_PLAN=1` for mandatory plan->execute on write/destructive calls |
| 53 | - `B24_PACKS=core,...` for default pack set |
| 54 | - `B24_RATE_LIMITER=file` with `B24_RATE_LIMITER_RATE` and `B24_RATE_LIMITER_BURST` |
| 55 | |
| 56 | ## Default Mode: Lean |
| 57 | |
| 58 | Apply these limits unless the user asks for deep detail: |
| 59 | |
| 60 | - Load at most 2 reference files before first actionable step. |
| 61 | - Start from `references/packs.md`. |
| 62 | - Then open only one target file: `references/catalog-<pack>.md`. |
| 63 | - Open `references/chains-<pack>.md` only if the user needs workflow steps. |
| 64 | - Open `references/bitrix24.md` only for auth architecture, limits, event reliability, or unknown errors. |
| 65 | |
| 66 | Response limits: |
| 67 | |
| 68 | - Use concise output (goal + next action + one command). |
| 69 | - Do not retell documentation. |
| 70 | - Do not dump large JSON unless requested. |
| 71 | - Save your own tokens on reads: add `--out compact` (minified) or `--out summary` (a `{count, ids, next, total}` digest for `*.list`); cap rows with `--max-items N`. Use the API's `select` in `--params` to fetch fewer fields. Default output is unchanged (`full`). |
| 72 | - Return only delta if guidance was already given. |
| 73 | |
| 74 | ## Routing Workflow |
| 75 | |
| 76 | 1. Determine intent: |
| 77 | - method call |
| 78 | - troubleshooting |
| 79 | - architecture decision |
| 80 | - event/reliability setup |
| 81 | |
| 82 | 2. Normalize product vocabulary: |
| 83 | |
| 84 | - "collabs", "workgroups", "projects", "social network groups" -> `collab` (and `boards` for scrum). |
| 85 | - "Copilot", "CoPilot", "BitrixGPT", "AI prompts" -> `platform` (`ai.*`). |
| 86 | - "open lines", "contact center connectors", "line connectors" -> `comms` (`imopenlines.*`, `imconnector.*`). |
| 87 | - "feed", "live feed", "news feed" -> `collab` (`log.*`). |
| 88 | - "sites", "landing pages", "landing" -> `sites` (`landing.*`). |
| 89 | - "booking", "calendar", "work time", "time tracking" -> `services` (`booking.*`, `calendar.*`, `timeman.*`). |
| 90 | - "orders", "payments", "catalog", "products" -> `commerce` (`sale.*`, `catalog.*`). |
| 91 | - "consents", "consent", "e-signature", "sign" -> `compliance` (`userconsent.*`, `sign.*`). |
| 92 | - "chat-bot", "bot", "imbot", "bot command" -> `bots` (`imbot.v2.*`). |
| 93 | - "booking", "reservation", "resource", "slots" -> `booking` (`booking.*`). |
| 94 | - "email", "mailbox", "mail message" -> `mail` (`mail.*`). |
| 95 | - "recurring task", "task template" -> `templates` (`tasks.template.*`). |
| 96 | |
| 97 | 3. Choose auth quickly: |
| 98 | |
| 99 | - one portal/internal integration: webhook |
| 100 | - app or multi-portal lifecycle: OAuth |
| 101 | |
| 102 | 4. Select minimal packs: |
| 103 | |
| 104 | - default `core` |
| 105 | - add only required packs: `comms`, `automation`, `collab`, `content`, `boards`, `commerce`, `services`, `platform`, `sites`, `compliance`, `diagnostics`, `bots`, `booking`, `mail`, `templates` |
| 106 | |
| 107 | ## Execution Flow (Safe by Default) |
| 108 | |
| 109 | Command template: |
| 110 | |
| 111 | ```bash |
| 112 | python3 skills/bitrix24-agent/scripts/bitrix24_client.py <method> \ |
| 113 | --params '<json>' \ |
| 114 | --packs core |
| 115 | ``` |
| 116 | |
| 117 | Guardrails to enforce: |
| 118 | |
| 119 | - allowlist via packs and `--method-allowlist` |
| 120 | - write gate with `--confirm-write` |
| 121 | - destructive gate with `--confirm-destructive` |
| 122 | - optional two-phase write with `--plan-only` and `--execute-plan` |
| 123 | - ide |