Communitygithub.com

ComeOnOliver/skillshub

Stellt Tamagui-Muster für Config v4, Compiler-Optimierung, styled Kontext und plattformübergreifendes Styling bereit. Muss bei der Arbeit mit Tamagui-Projekten verwendet werden (tamagui.config.ts, @tamagui-Imports).

Was ist skillshub?

Dieses Skill bietet erweiterte Muster für Tamagui v1.x, die über die Grundlagen hinausgehen. Es deckt Config v4, Compiler-Optimierung, zusammengesetzte Komponenten und häufige Fehler ab. Entwickler erhalten eine umfassende Anleitung zur Einrichtung von Tamagui mit `@tamagui/config/v4`, zur Erstellung von Themes mit `createThemes` und zur Verwendung von `$`-Präfixregeln für Token-Referenzen. Es erklärt ausführlich, wie man mit `createStyledContext` zusammengesetzte Komponenten erstellt, `styleable()` für Wrapper-Komponenten verwendet und den `accept`-Prop für benutzerdefinierte Komponenten einsetzt. Das Skill enthält wichtige Anti-Patterns, die die Compiler-Optimierung vermeiden sollten, z.B. dynamische Styles und Inline-Funktionen. Es unterstützt alle Tamagui-Plattformen (Web, iOS, Android) und verweist auf zusätzliche Musterdateien wie @DIALOG_PATTERNS.md, @FORM_PATTERNS.md und @COMPILER_PATTERNS.md für spezifischere Anwendungsfälle.

Funktioniert mit~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/aiskillstore/marketplace/0xbigboss/tamagui-best-practices

In Ihrer bevorzugten KI fragen

Öffnet einen neuen Chat, in dem dieser Agent-Skill bereits geladen ist.

Dokumentation

Dieses Skill bietet Muster für Tamagui v1.x, die über die Grundlagen hinausgehen. Es konzentriert sich auf Config v4, Compiler-Optimierung, zusammengesetzte Komponenten und häufige Fehler.

Pflichtkontext-Ladung

Wenn Sie mit diesen Komponenten arbeiten, lesen Sie die entsprechende Musterdatei, BEVOR Sie Code schreiben:

KomponententypErforderliche LektüreÜbergreifende Skills
Dialog, Sheet, modale Overlays@DIALOG_PATTERNS.md
Form, Input, Label, Validierung@FORM_PATTERNS.mdtypescript-best-practices (zod)
Animationen, Übergänge@ANIMATION_PATTERNS.md
Popover, Tooltip, Select@OVERLAY_PATTERNS.md
Compiler-Optimierung@COMPILER_PATTERNS.md
Design-Tokens, Theming@DESIGN_SYSTEM.md

Config v4 Schnellstart

Verwenden Sie @tamagui/config/v4 für eine vereinfachte Einrichtung:

// tamagui.config.ts
import { defaultConfig } from '@tamagui/config/v4'
import { createTamagui } from 'tamagui'

export const config = createTamagui(defaultConfig)

type CustomConfig = typeof config

declare module 'tamagui' {
  interface TamaguiCustomConfig extends CustomConfig {}
}

Empfohlene Einstellung für neue Projekte (gleicht flexBasis an React Native an):

export const config = createTamagui({
  ...defaultConfig,
  settings: {
    ...defaultConfig.settings,
    styleCompat: 'react-native',
  },
})

createThemes-Muster

Für benutzerdefinierte Themes verwenden Sie createThemes mit palette/accent/childrenThemes:

import { createThemes, defaultComponentThemes } from '@tamagui/config/v4'

const generatedThemes = createThemes({
  componentThemes: defaultComponentThemes,
  base: {
    palette: {
      dark: ['#050505', '#151515', /* ...12 Farben */ '#fff'],
      light: ['#fff', '#f8f8f8', /* ...12 Farben */ '#000'],
    },
    extra: {
      light: { ...Colors.blue, shadowColor: 'rgba(0,0,0,0.04)' },
      dark: { ...Colors.blueDark, shadowColor: 'rgba(0,0,0,0.2)' },
    },
  },
  accent: {
    palette: { dark: lightPalette, light: darkPalette }, // invertiert
  },
  childrenThemes: {
    blue: { palette: { dark: Object.values(Colors.blueDark), light: Object.values(Colors.blue) } },
    red: { /* ... */ },
    green: { /* ... */ },
  },
})

Token- und Theme-Syntax

$ Präfix-Regeln

  • Props: Verwenden Sie das $-Präfix für Token-Referenzen: <Text color="$color" fontSize="$4" />
  • Theme-Schlüssel: Zugriff ohne $ in Theme-Definitionen: { color: palette[11] }
  • Token-Zugriff in Variants: Verwenden Sie das Muster tokens.size[name]

Variant-Spread-Operatoren

Spezielle Spread-Operatoren ordnen Token-Kategorien Variant-Werten zu:

const Button = styled(View, {
  variants: {
    size: {
      // Ordnet Größen-Token zu: $1, $2, $true, usw.
      '...size': (size, { tokens }) => ({
        height: tokens.size[size] ?? size,
        borderRadius: tokens.radius[size] ?? size,
        gap: tokens.space[size]?.val * 0.2,
      }),
    },
    textSize: {
      // Ordnet fontSize-Token zu
      '...fontSize': (name, { font }) => ({
        fontSize: font?.size[name],
      }),
    },
  } as const,
})

Wichtig: Verwenden Sie as const für das Variants-Objekt, bis TypeScript inferierte const Generics unterstützt.

Zusammengesetzte Komponenten mit createStyledContext

Für zusammengesetzte APIs wie <Button><Button.Text>Click</Button.Text></Button>:

import {
  SizeTokens,
  View,
  Text,
  createStyledContext,
  styled,
  withStaticProperties,
} from '@tamagui/core'

// 1. Kontext mit gemeinsamen Variant-Typen erstellen
export const ButtonContext = createStyledContext<{ size: SizeTokens }>({
  size: '$medium',
})

// 2. Frame mit Kontext erstellen
export const ButtonFrame = styled(View, {
  name: 'Button',
  context: ButtonContext,
  variants: {
    size: {
      '...size': (name, { tokens }) => ({
        height: tokens.size[name],
        borderRadius: tokens.radius[name],
        gap: tokens.space[name].val * 0.2,
      }),
    },
  } as const,
  defaultVariants: {
    size: '$medium',
  },
})

// 3. Text mit gleichem Kontext erstellen (Variants synchronisieren automatisch)
export const ButtonText = styled(Text, {
  name: 'ButtonText',
  context: ButtonContext,
  variants: {
    size: {
      '...fontSize': (name, { font }) => ({
        fontSize: font?.size[name],
      }),
    },
  } as const,
})

// 4. Mit withStaticProperties zusammensetzen
export const Button = withStaticProperties(ButtonFrame, {
  Props: ButtonContext.Provider,
  Text: ButtonText,
})

Verwendung:

<Button size="$large">
  <Button.Text>Click me</Button.Text>
</Button>

// Oder Standardwerte von oben überschreiben:
<Button.Props size="$small">
  <Button><Button.Text>Small</Button.Text></Button>
</Button.Props>

Hinweis: Das context-Muster funktioniert nicht mit Compiler-Flattening. Für übergeordnete Komponenten (Button, Card) verwenden, nicht für Primitive (Stack, Text).

styleable() für Wrapper-Komponenten

Wenn Sie eine gestylte Komponente in eine funktionale Komponente verpacken, verwenden Sie .styleable(), um die Vererbung von Variants zu erhalten:

const StyledText = styled(Text)

// OHNE styleable - UNTERBROCHENE Variant-Vererbung
const BrokenWrapper = (props) => <StyledText {...props} />

// MIT styleable - RICHTIG
const CorrectWrapper = StyledText.styleable((props, ref) => (
  <StyledText ref={ref} {...props} />
))

// Jetzt funktioniert das:
const StyledCorrectWrapper = styled(CorrectWrapper, {
  variants: {
    bold: { true: { fontWeight: 'bold' } },
  },
})

Hinzufügen zusätzlicher Props

Übergeben Sie ein generisches Typargument für zusätzliche Props:

type ExtraProps = { icon?: React.ReactNode }

const IconText = StyledText.styleable<ExtraProps>((props, ref) => {
  const { icon, ...rest } = props
  return (
    <XStack>
      {icon}
      <StyledText ref={ref} {...rest} />
    </XStack>
  )
})

accept-Prop für benutzerdefinierte Komponenten

Ermöglicht Token/Theme-Auflösung bei nicht standardmäßigen Props:

// Für SVG fill/stroke, die Themenfarben akzeptieren sollen
const StyledSVG = styled(SVG, {}, {
  accept: { fill: 'color', stroke: 'color' } as const,
})

// Verwendung: <StyledSVG fill="$blue10" />

// Für Style-Objekte (wie contentContainerStyle von ScrollView)
const MyScrollView = styled(ScrollView, {}, {
  accept: { contentContainerStyle: 'style' } as const,
})

// Verwendung: <MyScrollView contentContainerStyle={{ padding: '$4' }} />

Wichtig: Verwenden Sie as const für das accept-Objekt.

Prop-Reihenfolge ist wichtig

Bei styled() bestimmt die Prop-Reihenfolge die Überschreibungspriorität:

// backgroundColor kann durch Props überschrieben werden
const Overridable = (props) => (
  <View backgroundColor="$red10" {...props} width={200} />
)
// width kann NICHT überschrieben werden (kommt nach dem Spread)

// Variant-Reihenfolge ist auch wichtig:
<Component scale={3} huge />  // scale = 3 (scale kommt zuerst)
<Component huge scale={3} />  // scale = 2 (huge überschreibt)

Anti-Patterns

Dynamische Styles brechen Optimierung

// SCHLECHT - bricht Compiler-Optimierung
<View style={{ width: someVariable * 2 }} />
<View backgroundColor={isDark ? '$gray1' : '$gray12'} />

// GUT - Variants verwenden
const Box = styled(View, {
  variants: {
    dark: { true: { backgroundColor: '$gray1' }, false: { backgroundColor: '$gray12' } },
  },
})
<Box dark={isDark} />

Inline-Funktionen

// SCHLECHT - neue Funktion bei jedem Rendern
<View onPress={() => handlePress(id)} />

// GUT - stabile Referenz
const handlePressCallback = useCallback(() => handlePress(id), [id])
<View onPress={handlePressCallback} />

Falsche Import-Pfade

// Dies sind verschiedene Pakete mit unterschiedlichen Inhalten:
import { View } from 'tamagui'           // Vollständiges UI-Kit
import { View } from '@tamagui/core'     // Nur Core (kleiner)
import { Button } from '@tamagui/button' // Einzelne Komponente

// Wählen Sie einen Ansatz und bleiben Sie konsistent

Mischen von RN StyleSheet mit Tamagui

// SCHLECHT - StyleSheet-Werte lösen keine Token auf
const styles = StyleSheet.create({ box: { padding: 20 } })
<View style={styles.box} backgroundColor="$blue10" />

// GUT - alles Tamagui
<View padding="$4" backgroundColor="$blue10" />

Platform.OS-Verzweigung für Dialog/Sheet

// SCHLECHT - manuelle Plattform-Verzweigung
if (Platform.OS === 'web') {
  return <Dialog>...</Dialog>
}
return <Sheet>...</Sheet>

// GUT - Adapt verwenden (siehe @DIALOG_PATTERNS.md)
<Dialog>
  <Dialog.Portal>...</Dialog.Portal>
  <Adapt when="sm" platform="touch">
    <Sheet><Adapt.Contents /></Sheet>
  </Adapt>
</Dialog>

Aktuelle Dokumentation abrufen

Für die neuesten API-Details rufen Sie Markdown-Dokumente direkt ab:

# Core-Dokumente
curl -sL "https://tamagui.dev/docs/core/configuration.md"
curl -sL "https://tamagui.dev/docs/core/styled.md"
curl -sL "https://tamagui.dev/docs/core/variants.md"
curl -sL "https://tamagui.dev/docs/core/animations.md"

# Komponenten-Dokumente
curl -sL "https://tamagui.dev/ui/sheet.md"
curl -sL "https://tamagui.dev/ui/dialog.md"
curl -sL "https://tamagui.dev/ui/select.md"

# Vollständiges Dokumentenverzeichnis
curl -sL "https://tamagui.dev/llms.txt"

Für HTML-Seiten verwenden Sie das web-fetch-Skill mit geeigneten Selektoren.

Kurzreferenz

Config v4 Kurzformen (Tailwind-konform)

KurzformEigenschaft
bgbackgroundColor
ppadding
mmargin
wwidth
hheight
brborderRadius

Media Query Breakpoints

TokenStandardServer-Standard
$xs660pxtrue
$sm800pxfalse
$md1020pxfalse
$lg1280pxfalse
$xl1420pxfalse

Animationstreiber

TreiberPlattformAnwendungsfall
cssWebStandard, beste Leistung
react-native-reanimatedNativFür native Animationen erforderlich

Zusätzliche Musterdateien

  • @DIALOG_PATTERNS.md - Dialog, Sheet, Adapt, Barrierefreiheit
  • @FORM_PATTERNS.md - Form, Input, Label, Validierung mit zod
  • @ANIMATION_PATTERNS.md - Animationstreiber, enterStyle/exitStyle
  • @OVERLAY_PATTERNS.md - Popover, Tooltip, Select
  • @COMPILER_PATTERNS.md - Details zur Compiler-Optimierung
  • @DESIGN_SYSTEM.md - Design-Tokens und Theming

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Next.js 16+ uses App Router with Server Components by default. Client Components are only used when interactivity is needed (hooks, event handlers, browser APIs).

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

Verwandte Skills