Command Palette

Search for a command to run...

Назад к скиллам
скилл № 39839

taw-rn-supabase

Wire Supabase JS client into a React Native (Expo) taw-kit project: session persistence via AsyncStorage, magic-link OAuth callback via expo-linking deep…

БесплатноБез исполняемых скриптов
nghiahsgsот nghiahsgs★ 31 звезда на GitHub

Установить taw-rn-supabase в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

taw-rn-supabase

Bridge a React Native (Expo) app to a Supabase backend the way taw-kit's Next.js webapp does it — same project, same RLS policies, shared types — but with mobile-specific glue (AsyncStorage, deep links, no next/headers).

Language rule: Detect the user's input language. Reply 100% Vietnamese for VN users (Southern, friendly), English for EN. Default Vietnamese for ambiguous input. Code/CLI commands stay English.

When to invoke

  • New Expo project that needs Supabase auth or DB access
  • Porting an existing taw-kit web feature (chat, profile, orders, etc.) to mobile and needing the same Supabase backend
  • Adding magic-link sign-in to a mobile app
  • Adding Supabase Realtime subscriptions (e.g. live chat) to mobile

Stack assumptions

  • Expo SDK 51+ (Expo Router, file-based routing)
  • TypeScript
  • @supabase/supabase-js v2.45+
  • @react-native-async-storage/async-storage for session persistence
  • expo-linking + expo-web-browser for OAuth/magic-link callbacks
  • NativeWind v5 (if styling needed — pair with expo-tailwind-setup skill)
  • Already-running Supabase project (URL + anon key in env)

If user is missing any of the above, invoke expo-tailwind-setup or instruct them to run supabase-setup skill first to provision the backend.

Step 1 — Install dependencies

npx expo install @supabase/supabase-js @react-native-async-storage/async-storage expo-linking expo-web-browser

Why each:

  • @supabase/supabase-js — universal client (works in RN with adapter)
  • @react-native-async-storage/async-storage — persists JWT session across app restarts
  • expo-linking — handles myapp:// deep-link callbacks from Supabase auth emails
  • expo-web-browser — opens magic-link / OAuth in in-app browser, returns to app via deep link

Step 2 — Configure app scheme (required for deep links)

Edit app.json (or app.config.ts):

{
  "expo": {
    "scheme": "tawkitapp",
    "ios": { "bundleIdentifier": "com.tawkit.<project-slug>" },
    "android": { "package": "com.tawkit.<projectslug>" }
  }
}

Replace tawkitapp with the project's slug from .taw/intent.json. The scheme MUST be unique per app — collisions cause silent deep-link failures.

Step 3 — Create Supabase client (lib/supabase.ts)

import 'react-native-url-polyfill/auto'
import AsyncStorage from '@react-native-async-storage/async-storage'
import { createClient } from '@supabase/supabase-js'

const supabaseUrl = process.env.EXPO_PUBLIC_SUPABASE_URL!
const supabaseAnonKey = process.env.EXPO_PUBLIC_SUPABASE_ANON_KEY!

export const supabase = createClient(supabaseUrl, supabaseAnonKey, {
  auth: {
    storage: AsyncStorage,
    autoRefreshToken: true,
    persistSession: true,
    detectSessionInUrl: false, // RN does NOT use URLs for callbacks — deep links instead
  },
})

Then npx expo install react-native-url-polyfill (Supabase needs URL APIs missing in RN's Hermes runtime).

.env keys (note EXPO_PUBLIC_* prefix — Expo equivalent of NEXT_PUBLIC_*):

EXPO_PUBLIC_SUPABASE_URL=https://<ref>.supabase.co
EXPO_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOi...

HARD RULE: NEVER add SUPABASE_SERVICE_ROLE_KEY to a mobile app. Mobile bundles ship to user devices = anyone can extract. Service-role calls go through your Next.js backend, which the mobile app calls via authenticated API.

Step 4 — Magic-link sign-in screen

app/(auth)/sign-in.tsx:

import { useState } from 'react'
import { View, Text, TextInput, Pressable, Alert } from 'react-native'
import * as Linking from 'expo-linking'
import { supabase } from '@/lib/supabase'

export default function SignIn() {
  const [email, setEmail] = useState('')
  const [loading, setLoading] = useState(false)

  const sendMagicLink = async () => {
    setLoading(true)
    const redirectTo = Linking.createURL('/auth/callback')
    const { error } = await supabase.auth.signInWithOtp({
      email,
      options: { emailRedirectTo: redirectTo },
    })
    setLoading(false)
    if (error) Alert.alert('Lỗi', error.message)
    else Alert.alert('Đã gửi', 'Mở email để bấm vào link đăng nhập.')
  }

  return (
    <View className="flex-1 justify-center px-6 bg-white dark:bg-black">
      <Text className="text-2xl font-bold mb-4 text-black dark:text-white">Đăng nhập</Text>
      <TextInput
        className="border border-gray-300 dark:border-gray-700 rounded-lg p-3 mb-4 text-black dark:text-white"
        placeholder="[email protected]"
        autoCapitalize="none"
        autoComplete="email"
        keyboardType="email-address"
        value={email}
        onChangeText={setEmail}
      />
      <Pressable
        className="bg-blue-600 rounded-lg p-3 items-center"
        onPress={sendMagicLink}
        disabled={loading || !email}
      >
        <Text className="text-white font-semibold">
          {loading ? 'Đang gửi...' : 'Gửi link đăng nhập'}
        </Text>
      </Pressable>
    </View>
  )
}

(VN labels by default; switc

Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

  1. 01Read
  2. 02Write
  3. 03Edit
  4. 04Bash
  5. 05Grep
  6. 06Glob
  7. 07Skill

FAQ

Что делает скилл taw-rn-supabase?

Wire Supabase JS client into a React Native (Expo) taw-kit project: session persistence via AsyncStorage, magic-link OAuth callback via expo-linking deep links, Realtime subscriptions on RN, and shared TypeScript types with the Next.js webapp twin (taw-kit's typical web<->mobile pair pattern). This is the mobile counterpart of `auth-magic-link` (web). User-visible strings match the user's input language (Vietnamese by default for VN users). Trigger phrases (EN + VN): "supabase react native", "supabase mobile", "auth mobile expo", "magic link mobile", "tich hop supabase vao app", "supabase deep link".

Как установить скилл taw-rn-supabase?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл taw-rn-supabase запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить taw-rn-supabase с