Back to Mobile Development

Telegram Mini App Architect

telegrammini-apptonweb3mobile
β˜… 4.7 (196)⭐ 28.1kπŸ“„ MITπŸ•’ 2026-06-16Source β†—

Install this skill

npx skills add davila7/claude-code-templates

Works across Claude Code, Cursor, Codex, Copilot & Antigravity

What this skill does

  • β€’Telegram Web App API interface integration
  • β€’TON blockchain wallet connection and transactions
  • β€’Telegram Stars payment flow implementation
  • β€’User authentication via Telegram identity data
  • β€’Viral growth loop and referral system logic

When to use it

  • βœ“Building a new Telegram-native game or utility
  • βœ“Integrating TON Connect for crypto wallet authorization
  • βœ“Implementing monetization through Telegram Stars or in-app payments
  • βœ“Creating referral mechanics to drive app growth within chats

When not to use it

  • βœ•Building a standalone web site that does not interact with Telegram
  • βœ•Projects requiring high-performance desktop native APIs
  • βœ•Applications that do not benefit from the Telegram social graph

How to invoke it

Example prompts that trigger this skill:

  • β€œCreate a new Telegram Mini App project structure.”
  • β€œHelp me add TON Connect to my react Telegram mini app.”
  • β€œImplement a payment flow using Telegram Stars.”
  • β€œGuide me through creating a viral referral button for my app.”
  • β€œCheck my code to ensure it follows mobile-first Telegram UX patterns.”

Example workflow

  1. Initialize the project with the basic Telegram Web App script.
  2. Integrate the Telegram object to capture user context.
  3. Add TON Connect provider to support blockchain wallets.
  4. Implement a payment button using either Stars or TON transactions.
  5. Test the interface using mobile-first responsive design practices.

Prerequisites

  • –Node.js
  • –React knowledge
  • –Basic understanding of Telegram Bot API

Pitfalls & limitations

  • !Failing to respect Telegram's theme colors which ruins native look and feel
  • !Developing desktop-first UIs that ignore mobile touch target constraints
  • !Neglecting to validate initData on the backend to prevent spoofing

FAQ

What is the best way to handle payments?
For digital goods, use Telegram Stars (XTR) via the bot API. For decentralized finance, use TON Connect to trigger on-chain transactions.
Do I need a separate backend?
Yes, while the frontend handles user interactions, you need a secure server to validate user data and process sensitive transaction logic.
Can I use standard web frameworks?
Yes, React, Vue, or vanilla JavaScript work fine, provided you import the telegram-web-app.js script to access native bridging capabilities.

How it compares

Generic prompting often ignores the Telegram-specific theme and touch-target requirements; this skill enforces the specialized architecture needed for successful app integration.

Source & trust

⭐ 28k starsπŸ“„ MITπŸ•’ Updated 2026-06-16πŸ›‘ runs-shell, network

From the source: β€œ# 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,…”

View the full SKILL.md source

# 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

```javascript
## 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
```jsx
// 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
```javascript
// 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
```jsx
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
```json
{
  "url": "https://your-app.com",
  "name": "Your Mini App",
  "iconUrl": "https://your-app.com/icon.png"
}
```

### Send TON Transaction
```jsx
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
```jsx
// 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`

Quoted from davila7/claude-code-templates for reference β€” see the original for the authoritative, latest version.

πŸ“„ Full skill instructions β€” original source: davila7/claude-code-templates
The Telegram Mini App skill assists developers in creating web-based applications that operate inside the Telegram ecosystem. It simplifies the implementation of the Telegram Web App API, providing specialized guidance for integrating TON blockchain wallets, handling user authentication, and managing monetization via Telegram Stars or crypto payments. The skill enforces mobile-first design principles, ensuring your application adapts to Telegram's native themes and interaction paradigms. It is intended for developers building decentralized applications, interactive games, or utilities that require deep integration with the Telegram social graph. By following these patterns, you bridge the gap between traditional web development and the specific constraints of the Telegram client interface, enabling viral growth and native-like experiences for a massive global user base.

How to Use This Skill Unit

Option A: Project-Specific (Recommended)

  1. Click "Download" above
  2. In your project, create the directory: .agent/skills/telegram-mini-app/
  3. Save the file as SKILL.md
  4. The agent will automatically discover the skill based on its description.

Option B: Global Installation (All Agents)

Save the file to these locations to make it available across all projects:

  • Claude Code: ~/.claude/skills/davila7/claude-code-templates/telegram-mini-app/SKILL.md
  • Cursor: ~/.cursor/skills/davila7/claude-code-templates/telegram-mini-app/SKILL.md
  • Antigravity: ~/.gemini/antigravity/skills/davila7/claude-code-templates/telegram-mini-app/SKILL.md

πŸš€ Install with CLI:
npx skills add davila7/claude-code-templates

Read the Master Guide: Mastering Agent Skills β†’

Recommended Rules

View more rules β†’

Recommended Workflows

View more workflows β†’

Recommended MCP Servers

View more MCP servers β†’

Take It Further

Maximize your productivity with these powerful resources

πŸ“‹

Define Your Standards

Set up coding standards to ensure this workflow produces consistent, high-quality results.

Browse Rules Library
πŸ“–

Master Workflows

Learn how to create custom workflows, use Turbo Mode, and build your automation library.

Complete Guide

How to use this Skill in Claude Code & Cursor

For Claude Code (CLI)

To use this skill in Claude Code, copy the rule content into your project's custom instructions or follow our Add-Skill CLI guide. This ensures Claude follows your standards during every code generation.

For Cursor & Windsurf

For Cursor or Windsurf, individual skills are best used in the "Rules for AI" section. This specific unit helps the agent avoid mobile development issues, leading to cleaner, more efficient code.

Why the skill format matters: the standardized Agent Skills format lets your AI agent load detailed instructions only when they are relevant, keeping your prompt clean while improving results.

Source & attribution

This skill is categorized under Mobile Development and is published by davila7, maintained in davila7/claude-code-templates.

← Browse All Agent Skills
Sponsored AI assistant. Recommendations may be paid.