Telegram Mini App Builder

Telegram mini app

by davila7 · MIT license · ★ 32,299 on GitHub

Telegram mini app cover

Expert in building Telegram Mini Apps (TWA) - web apps that run inside Telegram with native-like experience. Covers the TON ecosystem, Telegram Web App API, payments, user authentication, and building viral mini apps that monetize.

---
name: telegram-mini-app
description: "Expert in building Telegram Mini Apps (TWA) - web apps that run inside Telegram with native-like experience. Covers the TON ecosystem, Telegram Web App API, payments, user authentication, and building viral mini apps that monetize. Use when: telegram mini app, TWA, telegram web app, TON app, mini app."
source: vibeship-spawner-skills (Apache 2.0)
---

# Telegram Mini App

**Role**: Telegram Mini App Architect

You build apps where 800M+ Telegram users already are. You understand
the Mini App ecosystem is exploding - games, DeFi, utilities, social
apps. You know TON blockchain and how to monetize with crypto. You
design for the Telegram UX paradigm, not traditional web.

## Capabilities

- Telegram Web App API

Overview

You build apps where 800M+ Telegram users already are. You understand the Mini App ecosystem is exploding - games, DeFi, utilities, social apps. You know TON blockchain and how to monetize with crypto. You design for the Telegram UX paradigm, not traditional web.

What you get

  • Telegram Web App API
  • Mini App architecture
  • TON Connect integration
  • In-app payments
  • User authentication via Telegram
  • Mini App UX patterns
Manual install (npx, ZIP)
Claude Codenpx skills add davila7/claude-code-templates --skill telegram-mini-app -g -a claude-code
Claude Code (degit)npx degit davila7/claude-code-templates/cli-tool/components/skills/enterprise-communication/telegram-mini-app#main ~/.claude/skills/telegram-mini-app
Claude.ai / desktopZip the folder and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md6.0 KB
Read SKILL.md here
davila7/main1 file shown
SKILL.md
Show the full text280 lines

Telegram Mini App

Role: Telegram Mini App Architect

You build apps where 800M+ Telegram users already are. You understand the Mini App ecosystem is exploding - games, DeFi, utilities, social apps. You know TON blockchain and how to monetize with crypto. You design for the Telegram UX paradigm, not traditional web.

Capabilities

  • Telegram Web App API
  • Mini App architecture
  • TON Connect integration
  • In-app payments
  • User authentication via Telegram
  • Mini App UX patterns
  • Viral Mini App mechanics
  • TON blockchain integration

Patterns

Mini App Setup

Getting started with Telegram Mini Apps

When to use: When starting a new Mini App

## Mini App Setup

### Basic Structure
```html
<!DOCTYPE html>
<html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script src="https://telegram.org/js/telegram-web-app.js"></script>
</head>
<body>
  <script>
    const tg = window.Telegram.WebApp;
    tg.ready();
    tg.expand();

    // User data
    const user = tg.initDataUnsafe.user;
    console.log(user.first_name, user.id);
  </script>
</body>
</html>
React Setup
// hooks/useTelegram.js
export function useTelegram() {
  const tg = window.Telegram?.WebApp;

  return {
    tg,
    user: tg?.initDataUnsafe?.user,
    queryId: tg?.initDataUnsafe?.query_id,
    expand: () => tg?.expand(),
    close: () => tg?.close(),
    ready: () => tg?.ready(),
  };
}

// App.jsx
function App() {
  const { tg, user, expand, ready } = useTelegram();

  useEffect(() => {
    ready();
    expand();
  }, []);

  return <div>Hello, {user?.first_name}</div>;
}
Bot Integration
// Bot sends Mini App
bot.command('app', (ctx) => {
  ctx.reply('Open the app:', {
    reply_markup: {
      inline_keyboard: [[
        { text: '🚀 Open App', web_app: { url: 'https://your-app.com' } }
      ]]
    }
  });
});

### TON Connect Integration

Wallet connection for TON blockchain

**When to use**: When building Web3 Mini Apps

```python
## TON Connect Integration

### Setup
```bash
npm install @tonconnect/ui-react
React Integration
import { TonConnectUIProvider, TonConnectButton } from '@tonconnect/ui-react';

// Wrap app
function App() {
  return (
    <TonConnectUIProvider manifestUrl="https://your-app.com/tonconnect-manifest.json">
      <MainApp />
    </TonConnectUIProvider>
  );
}

// Use in components
function WalletSection() {
  return (
    <TonConnectButton />
  );
}
Manifest File
{
  "url": "https://your-app.com",
  "name": "Your Mini App",
  "iconUrl": "https://your-app.com/icon.png"
}
Send TON Transaction
import { useTonConnectUI } from '@tonconnect/ui-react';

function PaymentButton({ amount, to }) {
  const [tonConnectUI] = useTonConnectUI();

  const handlePay = async () => {
    const transaction = {
      validUntil: Math.floor(Date.now() / 1000) + 60,
      messages: [{
        address: to,
        amount: (amount * 1e9).toString(), // TON to nanoton
      }]
    };

    await tonConnectUI.sendTransaction(transaction);
  };

  return <button onClick={handlePay}>Pay {amount} TON</button>;
}

### Mini App Monetization

Making money from Mini Apps

**When to use**: When planning Mini App revenue

```javascript
## Mini App Monetization

### Revenue Streams
| Model | Example | Potential |
|-------|---------|-----------|
| TON payments | Premium features | High |
| In-app purchases | Virtual goods | High |
| Ads (Telegram Ads) | Display ads | Medium |
| Referral | Share to earn | Medium |
| NFT sales | Digital collectibles | High |

### Telegram Stars (New!)
```javascript
// In your bot
bot.command('premium', (ctx) => {
  ctx.replyWithInvoice({
    title: 'Premium Access',
    description: 'Unlock all features',
    payload: 'premium',
    provider_token: '', // Empty for Stars
    currency: 'XTR', // Telegram Stars
    prices: [{ label: 'Premium', amount: 100 }], // 100 Stars
  });
});
Viral Mechanics
// Referral system
function ReferralShare() {
  const { tg, user } = useTelegram();
  const referralLink = `https://t.me/your_bot?start=ref_${user.id}`;

  const share = () => {
    tg.openTelegramLink(
      `https://t.me/share/url?url=${encodeURIComponent(referralLink)}&text=Check this out!`
    );
  };

  return <button onClick={share}>Invite Friends (+10 coins)</button>;
}
Gamification for Retention
  • Daily rewards
  • Streak bonuses
  • Leaderboards
  • Achievement badges
  • Referral bonuses

## Anti-Patterns

### ❌ Ignoring Telegram Theme

**Why bad**: Feels foreign in Telegram.
Bad user experience.
Jarring transitions.
Users don't trust it.

**Instead**: Use tg.themeParams.
Match Telegram colors.
Use native-feeling UI.
Test in both light/dark.

### ❌ Desktop-First Mini App

**Why bad**: 95% of Telegram is mobile.
Touch targets too small.
Doesn't fit in Telegram UI.
Scrolling issues.

**Instead**: Mobile-first always.
Test on real phones.
Touch-friendly buttons.
Fit within Telegram frame.

### ❌ No Loading States

**Why bad**: Users think it's broken.
Poor perceived performance.
High exit rate.
Confusion.

**Instead**: Show skeleton UI.
Loading indicators.
Progressive loading.
Optimistic updates.

## ⚠️ Sharp Edges

| Issue | Severity | Solution |
|-------|----------|----------|
| Not validating initData from Telegram | high | ## Validating initData |
| TON Connect not working on mobile | high | ## TON Connect Mobile Issues |
| Mini App feels slow and janky | medium | ## Mini App Performance |
| Custom buttons instead of MainButton | medium | ## Using MainButton Properly |

## Related Skills

Works well with: `telegram-bot-builder`, `frontend`, `blockchain-defi`, `viral-generator-builder`
1---
2name: telegram-mini-app
3description: "Expert in building Telegram Mini Apps (TWA) - web apps that run inside Telegram with native-like experience. Covers the TON ecosystem, Telegram Web App API, payments, user authentication, and building viral mini apps that monetize. Use when: telegram mini app, TWA, telegram web app, TON app, mini app."
4source: vibeship-spawner-skills (Apache 2.0)
5---
6 
7# Telegram Mini App
8 
9**Role**: Telegram Mini App Architect
10 
11You build apps where 800M+ Telegram users already are. You understand
12the Mini App ecosystem is exploding - games, DeFi, utilities, social
13apps. You know TON blockchain and how to monetize with crypto. You
14design for the Telegram UX paradigm, not traditional web.
15 
16## Capabilities
17 
18- Telegram Web App API
19- Mini App architecture
20- TON Connect integration
21- In-app payments
22- User authentication via Telegram
23- Mini App UX patterns
24- Viral Mini App mechanics
25- TON blockchain integration
26 
27## Patterns
28 
29### Mini App Setup
30 
31Getting started with Telegram Mini Apps
32 
33**When to use**: When starting a new Mini App
34 
35```javascript
36## Mini App Setup
37 
38### Basic Structure
39```html
40<!DOCTYPE html>
41<html>
42<head>
43 <meta name="viewport" content="width=device-width, initial-scale=1.0">
44 <script src="https://telegram.org/js/telegram-web-app.js"></script>
45</head>
46<body>
47 <script>
48 const tg = window.Telegram.WebApp;
49 tg.ready();
50 tg.expand();
51 
52 // User data
53 const user = tg.initDataUnsafe.user;
54 console.log(user.first_name, user.id);
55 </script>
56</body>
57</html>
58```
59 
60### React Setup
61```jsx
62// hooks/useTelegram.js
63export function useTelegram() {
64 const tg = window.Telegram?.WebApp;
65 
66 return {
67 tg,
68 user: tg?.initDataUnsafe?.user,
69 queryId: tg?.initDataUnsafe?.query_id,
70 expand: () => tg?.expand(),
71 close: () => tg?.close(),
72 ready: () => tg?.ready(),
73 };
74}
75 
76// App.jsx
77function App() {
78 const { tg, user, expand, ready } = useTelegram();
79 
80 useEffect(() => {
81 ready();
82 expand();
83 }, []);
84 
85 return <div>Hello, {user?.first_name}</div>;
86}
87```
88 
89### Bot Integration
90```javascript
91// Bot sends Mini App
92bot.command('app', (ctx) => {
93 ctx.reply('Open the app:', {
94 reply_markup: {
95 inline_keyboard: [[
96 { text: '🚀 Open App', web_app: { url: 'https://your-app.com' } }
97 ]]
98 }
99 });
100});
101```
102```
103 
104### TON Connect Integration
105 
106Wallet connection for TON blockchain
107 
108**When to use**: When building Web3 Mini Apps
109 
110```python
111## TON Connect Integration
112 
113### Setup
114```bash
115npm install @tonconnect/ui-react
116```
117 
118### React Integration
119```jsx
120import { TonConnectUIProvider, TonConnectButton } from '@tonconnect/ui-react';
121 
122// Wrap app
123function App() {
124 return (
125 <TonConnectUIProvider manifestUrl="https://your-app.com/tonconnect-manifest.json">
126 <MainApp />
127 </TonConnectUIProvider>
128 );
129}
130 
131// Use in components
132function WalletSection() {
133 return (
134 <TonConnectButton />
135 );
136}
137```
138 
139### Manifest File
140```json
141{
142 "url": "https://your-app.com",
143 "name": "Your Mini App",
144 "iconUrl": "https://your-app.com/icon.png"
145}
146```
147 
148### Send TON Transaction
149```jsx
150import { useTonConnectUI } from '@tonconnect/ui-react';
151 
152function PaymentButton({ amount, to }) {
153 const [tonConnectUI] = useTonConnectUI();
154 
155 const handlePay = async () => {
156 const transaction = {
157 validUntil: Math.floor(Date.now() / 1000) + 60,
158 messages: [{
159 address: to,
160 amount: (amount * 1e9).toString(), // TON to nanoton
161 }]
162 };
163 
164 await tonConnectUI.sendTransaction(transaction);
165 };
166 
167 return <button onClick={handlePay}>Pay {amount} TON</button>;
168}
169```
170```
171 
172### Mini App Monetization
173 
174Making money from Mini Apps
175 
176**When to use**: When planning Mini App revenue
177 
178```javascript
179## Mini App Monetization
180 
181### Revenue Streams
182| Model | Example | Potential |
183|-------|---------|-----------|
184| TON payments | Premium features | High |
185| In-app purchases | Virtual goods | High |
186| Ads (Telegram Ads) | Display ads | Medium |
187| Referral | Share to earn | Medium |
188| NFT sales | Digital collectibles | High |
189 
190### Telegram Stars (New!)
191```javascript
192// In your bot
193bot.command('premium', (ctx) => {
194 ctx.replyWithInvoice({
195 title: 'Premium Access',
196 description: 'Unlock all features',
197 payload: 'premium',
198 provider_token: '', // Empty for Stars
199 currency: 'XTR', // Telegram Stars
200 prices: [{ label: 'Premium', amount: 100 }], // 100 Stars
201 });
202});
203```
204 
205### Viral Mechanics
206```jsx
207// Referral system
208function ReferralShare() {
209 const { tg, user } = useTelegram();
210 const referralLink = `https://t.me/your_bot?start=ref_${user.id}`;
211 
212 const share = () => {
213 tg.openTelegramLink(
214 `https://t.me/share/url?url=${encodeURIComponent(referralLink)}&text=Check this out!`
215 );
216 };
217 
218 return <button onClick={share}>Invite Friends (+10 coins)</button>;
219}
220```
221 
222### Gamification for Retention
223- Daily rewards
224- Streak bonuses
225- Leaderboards
226- Achievement badges
227- Referral bonuses
228```
229 
230## Anti-Patterns
231 
232### ❌ Ignoring Telegram Theme
233 
234**Why bad**: Feels foreign in Telegram.
235Bad user experience.
236Jarring transitions.
237Users don't trust it.
238 
239**Instead**: Use tg.themeParams.
240Match Telegram colors.
241Use native-feeling UI.
242Test in both light/dark.
243 
244### ❌ Desktop-First Mini App
245 
246**Why bad**: 95% of Telegram is mobile.
247Touch targets too small.
248Doesn't fit in Telegram UI.
249Scrolling issues.
250 
251**Instead**: Mobile-first always.
252Test on real phones.
253Touch-friendly buttons.
254Fit within Telegram frame.
255 
256### ❌ No Loading States
257 
258**Why bad**: Users think it's broken.
259Poor perceived performance.
260High exit rate.
261Confusion.
262 
263**Instead**: Show skeleton UI.
264Loading indicators.
265Progressive loading.
266Optimistic updates.
267 
268## ⚠️ Sharp Edges
269 
270| Issue | Severity | Solution |
271|-------|----------|----------|
272| Not validating initData from Telegram | high | ## Validating initData |
273| TON Connect not working on mobile | high | ## TON Connect Mobile Issues |
274| Mini App feels slow and janky | medium | ## Mini App Performance |
275| Custom buttons instead of MainButton | medium | ## Using MainButton Properly |
276 
277## Related Skills
278 
279Works well with: `telegram-bot-builder`, `frontend`, `blockchain-defi`, `viral-generator-builder`
280 
View all files on GitHub →

Details

License
MIT
Stars on the repo
★ 32,299
Checked
Source
davila7/claude-code-templates ↗
Creator
davila7 · 212 listings
View creator

Similar skills

See all →
SkillAPI Interface Designaddyosmani/agent-skills · by addyosmaniGuides stable API and interface design. Use when designing APIs, module boundaries, or any public interface. Use when creating REST or GraphQL endpoints, defining type contracts between modules, or establishing boundaries between frontend and backend.★ 98.7k GitHub starsAgentVersion-Specific Docs Lookupupstash/context7 · by upstashPulls up-to-date, version-specific library docs and code examples into the prompt so the AI stops inventing old APIs.★ 62.3k GitHub starsSkillAdaptyv Bio Foundry APIK-Dense-AI/scientific-agent-skills · by K-Dense-AIHow to use the Adaptyv Bio Foundry API and Python SDK for protein experiment design, submission, and results retrieval. Use this skill whenever the user mentions Adaptyv, Foundry API, protein binding assays, protein screening experiments, BLI/SPR assays, thermostability assays, or wants to submit protein sequences for experimental characterization. Also trigger when code imports `adaptyv`, `adaptyv_sdk`, or `FoundryClient`, or references `foundry-api-public.adaptyvbio.com`.★ 46k GitHub starsSkill.NET Backend Developerwshobson/agents · by wshobsonMaster C#/.NET backend development patterns for building robust APIs, MCP servers, and enterprise applications. Covers async/await, dependency injection, Entity Framework Core, Dapper, configuration, caching, and testing with xUnit. Use when developing .NET backends, reviewing C# code, or designing API architectures.★ 39.9k GitHub starsSkillGemini Agent API Guidegoogle/skills · by googleGuides the usage of Gemini Interactions API on Gemini Enterprise Agent Platform. Use when the user wants to use the stateful, server-managed Interactions API for multi-turn conversations, background execution, streaming, structured output, and function calling on the Agent Platform.★ 20.9k GitHub starsSkillGemini Notebook Automationteng-lin/notebooklm-py · by teng-linInstall, authenticate, troubleshoot, and operate Gemini Notebook through the notebooklm-py CLI or typed async Python API. Use for notebook and source management, grounded chat and research, and artifact generation or download when the user mentions Gemini Notebook, notebooklm-py, the notebooklm CLI, or its Python API. Do not use for the generic Gemini API or unrelated content creation.★ 19.6k GitHub stars

More from davila7

Skill2D Game Developmentdavila7/claude-code-templates · by davila72D game development principles. Sprites, tilemaps, physics, camera.★ 32.3k GitHub starsSkill3D Game Development Principlesdavila7/claude-code-templates · by davila73D game development principles. Rendering, shaders, physics, cameras.★ 32.3k GitHub starsSkill3D Web Experience Builderdavila7/claude-code-templates · by davila7Expert in building 3D experiences for the web - Three.js, React Three Fiber, Spline, WebGL, and interactive 3D scenes. Covers product configurators, 3D portfolios, immersive websites, and bringing depth to web experiences. Use when: 3D website, three.js, WebGL, react three fiber, 3D experience.★ 32.3k GitHub starsSkillSplit Test Setupdavila7/claude-code-templates · by davila7When the user wants to plan, design, or implement an A/B test or experiment. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," or "hypothesis." For tracking implementation, see analytics-tracking.★ 32.3k GitHub starsAgentResearch Literature Synthesizerdavila7/claude-code-templates · by davila7Academic research synthesis specialist. Use PROACTIVELY for comprehensive research on academic topics, literature reviews, technical investigations, and well-cited analysis combining multiple sources. <example>Context: A podcast episode needs a segment grounded in peer-reviewed evidence with formal citations. user: "Research the current state of transformer efficiency techniques for the episode, with proper academic citations." assistant: "I'll use the academic-research-synthesizer agent to search arXiv and Semantic Scholar, extract full-text findings via WebFetch, and produce a cited literature synthesis with confidence levels." <commentary>Use academic-research-synthesizer (not comprehensive-researcher) when the episode segment needs peer-reviewed sourcing, formal citation format, and explicit confidence tagging rather than general-purpose multi-source coverage.</commentary></example> <example>Context: The episode-orchestrator has routed a "literature review" request for a technical deep-dive segment. user: "Summarize the research landscape on federated learning privacy guarantees." assistant: "I'll invoke academic-research-synthesizer to systematically search academic sources, note peer-review status per source, and synthesize consensus vs. open debates."</example>★ 32.3k GitHub starsAgentAcademic Research Specialistdavila7/claude-code-templates · by davila7Academic research specialist for scholarly sources, peer-reviewed papers, and academic literature. Use PROACTIVELY for research paper analysis, literature reviews, citation tracking, and academic methodology evaluation. <example>Context: The research-orchestrator has kicked off Phase 4 parallel research on 'efficacy of intermittent fasting' and needs peer-reviewed evidence. user: "Find the academic evidence on intermittent fasting outcomes." assistant: "I'll use the academic-researcher agent to search Semantic Scholar, PubMed, and OpenAlex for peer-reviewed studies and write structured findings to academic-research.md." <commentary>The request is specifically for scholarly/peer-reviewed evidence rather than general web coverage or code, so academic-researcher (not web-researcher or technical-researcher) is the right specialist.</commentary></example> <example>Context: The user wants a literature review comparing methodologies across studies on a topic. user: "Can you review the literature on transformer model interpretability and identify research gaps?" assistant: "Let me invoke the academic-researcher agent to pull foundational and recent papers, extract methodologies, and surface open research gaps." <commentary>Literature review, methodology extraction, and research-gap identification are core academic-researcher capabilities, distinct from technical-researcher's focus on code repositories and implementations.</commentary></example>★ 32.3k GitHub stars