update-layer

Use when updating TL schema layer in mtcute, fetching new Telegram API schemas, or when user asks to update the layer/schema

451 stars

Best use case

update-layer is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Use when updating TL schema layer in mtcute, fetching new Telegram API schemas, or when user asks to update the layer/schema

Teams using update-layer should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/update-layer/SKILL.md --create-dirs "https://raw.githubusercontent.com/mtcute/mtcute/main/.claude/skills/update-layer/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/update-layer/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How update-layer Compares

Feature / Agentupdate-layerStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Use when updating TL schema layer in mtcute, fetching new Telegram API schemas, or when user asks to update the layer/schema

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Update TL Layer

Update the Telegram TL schema by fetching from multiple sources, resolving conflicts, and generating code.

## Workflow

> Avoid wasting time and effort on reading the scripts to understand how they work, everything you need is listed below.

### 1. Dry run

```bash
cd packages/core && pnpm tsx scripts/tl/fetch-api.ts --dry-run
```

Parse the output. It contains:

- **SCHEMAS** - available sources and their layers
- **LAYER** - the final layer number
- **CONFLICTS** - entries needing manual resolution (with numbered options)
- **DOCS** - whether cached documentation is available
- **VERSION** - current version and suggested bump

### 2. Resolve and run

Build flags from the dry-run output:

```bash
pnpm tsx scripts/tl/fetch-api.ts \
  --resolve entryName=N \    # 0=remove, 1+ = pick option from dry-run. repeat per conflict
  --docs cached|fresh \      # use cached docs if available, or force re-fetch
  --bump                     # or --no-bump
```

You should pass `--docs fresh` when one of the Core/Corefork/Blogfork schemas was updated, but the cached docs are still on an older layer.

In most cases you should pass `--bump`, except when running again within the same run (e.g. to fix int53 types).

### 3. Process diff

```bash
pnpm tsx scripts/tl/process-diff.ts
```

### 4. Check int53 overrides
This prints a structured summary of changes: added/removed/modified classes and methods, and a list of `long` fields that may need int53 overrides.
Check if they represent user/channel/chat IDs or file sizes — those should be `int53`

If there are such `long` fields listed, present them to the user and run the `scripts/tl/add-int53-overrides.ts` script to add the override to the file like so:
```bash
# ! key is the entry name, array items are the fields that need to be overridden
echo '{"class":{"user":["bot_id"],"channel":["linked_id"]},"method":{"messages.getHistory":["offset_id"]}}' | pnpm tsx scripts/tl/add-int53-overrides.ts
```

Verify that there were no `[warn]` messages regarding the overrides you just added.

### 5. Generate code

```bash
pnpm run gen-tl
```

### 6. Update compat layer

If constructors changed ID or were removed, update `packages/core/src/utils/binary/compat.ts`:
- Add new `case` entries in `mapCompatObject` and type-specific mappers for old constructor names (e.g. `user_layer225`)
- Map old fields to new structure, filling in defaults for new required fields
- If a constructor was removed, try to find the closest replacement, whenever possible

### 7. Update high-level types

Based on the diff, update these files for new/changed TL types:

**New message actions:** Add interfaces + switch cases in `packages/core/src/highlevel/types/messages/message-action.ts` (`_messageActionFromTl`). Also add new types to the `MessageAction` union.

**New chat event actions:** Add interfaces + switch cases in `packages/core/src/highlevel/types/peers/chat-event/actions.ts` (`_actionFromTl`). Also add new types to the `ChatAction` union.

**New message fields:** Update `packages/core/src/highlevel/types/messages/message.ts` (the `Message` class).

**New user/chat fields:** Update as needed:
- `packages/core/src/highlevel/types/peers/user.ts` (`User` class, wraps `user` type)
- `packages/core/src/highlevel/types/peers/full-user.ts` (`FullUser` class, wraps `userFull` type)
- `packages/core/src/highlevel/types/peers/chat.ts` (`Chat` class, wraps `chat`, `chatForbidden`, `channel`, `channelForbidden` types)
- `packages/core/src/highlevel/types/peers/full-chat.ts` (`FullChat` class, wraps `chatFull` and `channelFull` types)

### 8. Other follow-ups

**Message-related updates:** If `Update`-related types changed (including `messageAction*`, `messageMedia*`, `messageReply*Header`, `messageForwardHeader`, `messageEntity*`), update `_fetchMissingPeers` in the updates manager to handle new fields.

**Peer-related updates:** If `user` or `channel` changed, update `service/peers.ts` min-updating logic for new fields.

### 9. Verify

> Note: all these tasks may take a long time, use timeout=5m for each to avoid issues

```bash
# typecheck and fix any type errors
pnpm run -w lint:tsc

# run eslint, fix any remaining linting issues
pnpm run -w lint:ci --fix

# run tests
pnpm run -w test
```

### 10. Summary

- Present the summary of changes in the schema to the user
- Present your changes in the code to the user

Related Skills

writing-methods

451
from mtcute/mtcute

Use when adding or modifying high-level client methods in packages/core/src/highlevel/methods/. Covers function signatures, codegen annotations, peer resolution, update handling, pagination, and all common patterns.

using-mtcute

451
from mtcute/mtcute

Use when working with mtcute, @mtcute/* packages, Telegram MTProto in TypeScript, TL types, Telegram API methods, or building Telegram bots/clients in TypeScript. Not for Bot API wrapper libraries (grammy, telegraf, node-telegram-bot-api).

multiplayer

31392
from sickn33/antigravity-awesome-skills

Multiplayer game development principles. Architecture, networking, synchronization.

claude-win11-speckit-update-skill

31392
from sickn33/antigravity-awesome-skills

Windows 11 system management

Investor Update Generator

3880
from openclaw/skills

Generate professional monthly/quarterly investor updates that keep stakeholders informed and build trust.

Workflow & Productivity

Triple-Layer Memory System

3880
from openclaw/skills

三层记忆系统 - 解决 AI Agent 长对话记忆丢失和上下文管理问题

Memory & Context Management

Three-Layer Memory System for Claude Code

19
from KimYx0207/claude-memory-3layer

A cross-session memory system that automatically extracts, stores, and loads knowledge across Claude Code sessions.

Workflow & ProductivityClaude

update-deps

37910
from RSSNext/Folo

Update all dependencies across frontend and backend projects. Reads changelogs for breaking changes, checks affected code, runs tests, and provides a summary. Use when updating npm dependencies across the monorepo.

speckit-updater

31392
from sickn33/antigravity-awesome-skills

SpecKit Safe Update

update-specification

28865
from github/awesome-copilot

Update an existing specification file for the solution, optimized for Generative AI consumption based on new requirements or updates to any existing code.

update-markdown-file-index

28865
from github/awesome-copilot

Update a markdown file section with an index/table of files from a specified folder.

update-llms

28865
from github/awesome-copilot

Update the llms.txt file in the root folder to reflect changes in documentation or specifications following the llms.txt specification at https://llmstxt.org/