Skip to content
Back to skills

Unprompted Telegram

ASecurity

Design and audit Telegram bots and Mini Apps: BOT.md specs, inline keyboard budgets, Rich Messages streaming, initData verification, Stars payments, and a 20-rule deterministic audit. Load whenever building or reviewing a Telegram bot, keyboard flow, or Mini App.

  • 670 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added December 5, 2026
ai-agentsrustgoshellbashnodeexpressgitapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 11 files and shows the line behind each finding

Scanned December 5, 2026

npx -y skills add mocasus/unprompted --skill unprompted-telegram --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Unprompted Telegram?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Unprompted Telegram
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mocasus-unprompted-telegram/badge)](https://www.skillsdirectory.com/skills/mocasus-unprompted-telegram)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: unprompted-telegram
version: 4.3.3
license: MIT
description: >-
  Design and audit Telegram bots and Mini Apps: BOT.md specs, inline keyboard
  budgets, Rich Messages streaming, initData verification, Stars payments, and a
  20-rule deterministic audit. Load whenever building or reviewing a Telegram
  bot, keyboard flow, or Mini App.
compatibility: [windows, macos, linux]
metadata:
  author: mocasus
  category: telegram
  repository: https://github.com/mocasus/unprompted
  openclaw:
    emoji: "🤖"
    requiredBins: ["node"]
---

# unprompted-telegram — Bot Direction Protocol

Extends the v4 direction contract to chat surfaces. The UI protocol owns web
pages; this skill owns the conversation: what the bot is for, which screen the
user is on, what each button costs, and what proves it works.

Telegram rule IDs (`TG-01…TG-20`) are separate from `D/S/W/A/M/E`. They audit bot
code, not markup, and they never change the 67-check totals.

## 1. Spec first (`TG-00`)

Write `BOT.md` before the first handler. A bot without a spec becomes a command
list with no exit. Start from `references/bot-md.md` or run:

```bash
node <skills-dir>/unprompted-telegram/scripts/telegram-audit.mjs --init BOT.md
```

Through the CLI, `--ask` interviews the four decisions that matter (name, one
job, success metric, non-goal) before writing the file:

```bash
npx github:mocasus/unprompted telegram --init BOT.md --ask
```

If no `BOT.md` exists, label the output `DRAFT (NO BOT.MD)` and keep it
non-shippable. The spec fixes:

- one job per screen, and the exit from it;
- the command surface, capped at seven commands;
- the keyboard map with `callback_data` values already allocated;
- the states each screen can be in;
- who pays, and for what.

## 2. Command surface

Commands are the public API of a bot. More than seven is a menu nobody reads.

| Slot | Rule |
|---|---|
| `/start` | Onboarding plus the primary action. Never a wall of text. |
| `/help` | One screen, same keyboard as the main menu. |
| `/settings` | Only if the bot stores preferences. |
| Domain verbs | Maximum three, each a noun the user would say. |
| `/admin` | Hidden from `setMyCommands` for non-admins. |

Command descriptions are under 120 characters, lowercase, and verb-first. The
`setMyCommands` call is part of the deliverable, not an afterthought.

## 3. Inline keyboard contract

Inline keyboards carry the navigation. Reply keyboards are for data entry only
(phone, location, a fixed answer set).

- `callback_data` is 1-64 bytes. Budget it like a schema: `ns:action:id`
  (`cart:add:42`, `page:next:3`).
- Three buttons per row maximum, twelve per screen unless paginated.
- Every screen answers three questions: back, home, close.
- Every press gets an `answerCallbackQuery`. Silence feels broken; the client
  shows a spinner for up to 15 seconds.
- Toggles show their state in the label (`Notifications: on`), not in color.
- Destructive actions confirm with two explicit buttons, never one ambiguous
  "OK".
- Navigation edits the current message. Sending a new one floods history.

Full layout, pagination, and router patterns: `references/inline-keyboards.md`.

## 4. Rich Messages

Bot API 10.3 added rich messages: structured blocks, streaming drafts, and
ephemeral replies. Use them for receipts, comparisons, articles, and any content
that would otherwise become a wall of `parse_mode` text.

- Build `InputRichMessage` with blocks for tables, lists, details, and slideshows;
  keep `markdown` or `html` only for short prose.
- Stream long answers with `sendRichMessageDraft`, throttled to 250-500 ms, then
  finish with `sendRichMessage` or `editMessageText`.
- Always ship a fallback for clients without 10.3: `isVersionAtLeast` or a
  `sendMessage` path. A missing fallback is a blank chat.
- Ephemeral messages replace toasts for confirmations that should not persist.

Details and block selection: `references/rich-messages.md`.

## 5. Mini Apps

A Mini App is a web page with a Telegram contract. The contract is not optional.

- Verify `initData` on the server with HMAC-SHA256 before trusting any field.
  Never trust the client copy.
- Read `themeParams` into CSS variables; hardcoded colors break dark mode.
- Respect `safeAreaInset` and `contentSafeAreaInset`; call `expand()` and
  `ready()` on boot.
- MainButton owns the primary action: disable it while submitting and show
  progress instead of accepting double taps.
- BackButton mirrors navigation; closing confirmation protects unsaved input.

Full lifecycle and snippets: `references/mini-apps.md`.

## 6. Payments

- Create invoices with `XTR` (Stars) unless the product is physical.
- Answer `pre_checkout_query` within 10 seconds, always, even to reject.
- Verify `successful_payment` by `telegram_payment_charge_id`, store it once, and
  make the handler idempotent.
- Refunds use `refundStarPayment`; never hand-roll balances.

`references/payments-stars.md` has the flow and the failure table.

## 7. States and copy

Every screen ships four states: loading, empty, error, success. A bot that only
renders the happy path is a demo.

- Error copy names the failed action and the next step, not "Something went
  wrong".
- Empty copy says why it is empty and what fills it.
- Loading is one line, edited in place, not a second message.
- Cancellation is always available and always returns to a known screen.

## 8. Evidence gate

Run the auditor on changed bot sources:

```bash
node <skills-dir>/unprompted-telegram/scripts/telegram-audit.mjs --validate BOT.md
node <skills-dir>/unprompted-telegram/scripts/telegram-audit.mjs <files-or-dirs>
node <skills-dir>/unprompted-telegram/scripts/telegram-audit.mjs <files> --spec BOT.md
```

The validator checks the spec before the code exists: required sections,
command cap, screen states, the callback budget, namespace registration,
idempotency keys, Mini App auth, and the evidence list. A skeleton with
placeholders fails on purpose.

`--spec` bridges the two: every `callback_data` in code is matched against the
`BOT.md` keyboard map, so an unregistered namespace (`SB-01`), a registered
button nobody wired (`SB-02`), or a namespace with no key (`SB-03`) shows up as
drift instead of shipping silently.

Add `--strict` in CI to fail on warnings. Close substantive deliveries with:

```text
UNPROMPTED BOT REPORT
- Spec      : BOT.md | DRAFT (NO BOT.MD)
- Rules     : TG 20/20 evaluated
- Errors    : 0
- Warnings  : 0
- Score     : 100/100
- Evidence  : keyboard matrix at 320/768/1440, callback table, initData proof
- Verdict   : PASS
```

Never print `PASS` when the audit reports errors or when the keyboard matrix is
missing. Use `REVIEW` for warnings and `BLOCK` for errors.

## Sub-references

| File | Use when |
|---|---|
| `references/bot-md.md` | Starting a bot, or the spec is missing |
| `references/inline-keyboards.md` | Designing navigation, pagination, callbacks |
| `references/rich-messages.md` | Formatting receipts, articles, streaming answers |
| `references/mini-apps.md` | Building a Web App surface |
| `references/payments-stars.md` | Selling anything for Stars |
| `references/anti-patterns.md` | Reviewing an existing bot |

## Starters

Copy from `assets/` instead of starting blank. All three pass the auditor at
100/100.

| File | Use |
|---|---|
| `assets/miniapp-shell.html` | Theme params, safe areas, `ready()`/`expand()`, four states, guarded MainButton |
| `assets/miniapp-verify.mjs` | `initData` HMAC verification plus an Express-style guard |
| `assets/keyboard-router.ts` | Namespaced callback router, clamped pagination, stale-button fallback |

Files in this skill

  • SKILL.md7.4 KB
  • assets/keyboard-router.ts3.1 KB
  • assets/miniapp-shell.html5.7 KB
  • assets/miniapp-verify.mjs1.5 KB
  • references/anti-patterns.md3 KB
  • references/bot-md.md4.2 KB
  • references/inline-keyboards.md4.9 KB
  • references/mini-apps.md5.6 KB
  • references/payments-stars.md3.6 KB
  • references/rich-messages.md4.4 KB
  • scripts/telegram-audit.mjs32.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.