Communitygithub.com

ComeOnOliver/skillshub

Fornece padrões do Tamagui para config v4, otimização do compilador, contexto estilizado e estilização multiplataforma. Deve ser usado ao trabalhar com projetos Tamagui (tamagui.config.ts, imports @tamagui).

O que é skillshub?

Esta skill oferece padrões e práticas recomendadas para o Tamagui v1.x, indo além dos fundamentos. Ela é essencial para desenvolvedores que utilizam Tamagui em seus projetos, pois aborda tópicos cruciais como Config v4 (configuração simplificada), otimização do compilador (evitando estilos dinâmicos), criação de componentes compostos com `createStyledContext` e `withStaticProperties`, e o uso correto de tokens de tema. A skill também inclui guias de referência rápida para atalhos de estilo (como `bg`, `p`, `m`) e breakpoints de mídia. É compatível com todos os projetos que utilizam Tamagui (React Native, Web) e orienta a evitar anti-padrões comuns, como o uso de `StyleSheet` misturado com Tamagui ou funções inline. O fluxo de trabalho recomendado envolve a leitura obrigatória de arquivos de padrão específicos (como `@DIALOG_PATTERNS.md` e `@COMPILER_PATTERNS.md`) antes de escrever código para componentes relacionados.

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

Perguntar na sua IA favorita

Abre um novo chat com esta habilidade de agente já pré-carregada.

Documentação

Esta skill fornece padrões para Tamagui v1.x que vão além dos fundamentos. Ela foca em Config v4, otimização do compilador, componentes compostos e erros comuns.

Carregamento de Contexto Obrigatório

Ao trabalhar com esses componentes, leia o arquivo de padrão correspondente ANTES de escrever código:

Tipo de ComponenteLeitura ObrigatóriaCompetências Cruzadas
Dialog, Sheet, modal overlays@DIALOG_PATTERNS.md
Form, Input, Label, validação@FORM_PATTERNS.mdtypescript-best-practices (zod)
Animações, transições@ANIMATION_PATTERNS.md
Popover, Tooltip, Select@OVERLAY_PATTERNS.md
Otimização do compilador@COMPILER_PATTERNS.md
Tokens de design, temas@DESIGN_SYSTEM.md

Início Rápido com Config v4

Use @tamagui/config/v4 para configuração simplificada:

// 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 {}
}

Configuração recomendada para novos projetos (alinha flexBasis ao React Native):

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

Padrão createThemes

Para temas personalizados, use createThemes com paleta/destaque/temas filhos:

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

const generatedThemes = createThemes({
  componentThemes: defaultComponentThemes,
  base: {
    palette: {
      dark: ['#050505', '#151515', /* ...12 cores */ '#fff'],
      light: ['#fff', '#f8f8f8', /* ...12 cores */ '#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 }, // invertido
  },
  childrenThemes: {
    blue: { palette: { dark: Object.values(Colors.blueDark), light: Object.values(Colors.blue) } },
    red: { /* ... */ },
    green: { /* ... */ },
  },
})

Sintaxe de Token e Tema

Regras do Prefixo $

  • Props: Use prefixo $ para referências a tokens: <Text color="$color" fontSize="$4" />
  • Chaves de tema: Acesse sem $ nas definições de tema: { color: palette[11] }
  • Acesso a tokens em variantes: Use o padrão tokens.size[name]

Operadores de Espalhamento de Variantes

Operadores especiais mapeiam categorias de tokens para valores de variantes:

const Button = styled(View, {
  variants: {
    size: {
      // Mapeia tokens de tamanho: $1, $2, $true, etc.
      '...size': (size, { tokens }) => ({
        height: tokens.size[size] ?? size,
        borderRadius: tokens.radius[size] ?? size,
        gap: tokens.space[size]?.val * 0.2,
      }),
    },
    textSize: {
      // Mapeia tokens de fontSize
      '...fontSize': (name, { font }) => ({
        fontSize: font?.size[name],
      }),
    },
  } as const,
})

Importante: Use as const no objeto de variantes até que o TypeScript suporte genéricos const inferidos.

Componentes Compostos com createStyledContext

Para APIs compostas como <Button><Button.Text>Clique</Button.Text></Button>:

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

// 1. Crie contexto com tipos de variantes compartilhados
export const ButtonContext = createStyledContext<{ size: SizeTokens }>({
  size: '$medium',
})

// 2. Crie frame com contexto
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. Crie texto com mesmo contexto (variantes sincronizam automaticamente)
export const ButtonText = styled(Text, {
  name: 'ButtonText',
  context: ButtonContext,
  variants: {
    size: {
      '...fontSize': (name, { font }) => ({
        fontSize: font?.size[name],
      }),
    },
  } as const,
})

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

Uso:

<Button size="$large">
  <Button.Text>Clique em mim</Button.Text>
</Button>

// Ou sobrescreva padrões de cima:
<Button.Props size="$small">
  <Button><Button.Text>Pequeno</Button.Text></Button>
</Button.Props>

Nota: O padrão context não funciona com achatamento do compilador. Use para componentes de alto nível (Button, Card), não para primitivos (Stack, Text).

styleable() para Componentes Wrapper

Ao encapsular um componente estilizado em um componente funcional, use .styleable() para preservar a herança de variantes:

const StyledText = styled(Text)

// SEM styleable - Herança de variante QUEBRADA
const BrokenWrapper = (props) => <StyledText {...props} />

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

// Agora isso funciona:
const StyledCorrectWrapper = styled(CorrectWrapper, {
  variants: {
    bold: { true: { fontWeight: 'bold' } },
  },
})

Adicionando Props Extras

Passe um argumento de tipo genérico para props adicionais:

type ExtraProps = { icon?: React.ReactNode }

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

Prop accept para Componentes Personalizados

Permite resolução de token/tema em props não padrão:

// Para fill/stroke de SVG que devem aceitar cores de tema
const StyledSVG = styled(SVG, {}, {
  accept: { fill: 'color', stroke: 'color' } as const,
})

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

// Para objetos de estilo (como contentContainerStyle do ScrollView)
const MyScrollView = styled(ScrollView, {}, {
  accept: { contentContainerStyle: 'style' } as const,
})

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

Importante: Use as const no objeto accept.

A Ordem das Props é Importante

Em styled(), a ordem das props determina a prioridade de sobrescrita:

// backgroundColor pode ser sobrescrito por props
const Overridable = (props) => (
  <View backgroundColor="$red10" {...props} width={200} />
)
// width NÃO PODE ser sobrescrito (vem após o spread)

// A ordem das variantes também importa:
<Component scale={3} huge />  // scale = 3 (scale vem primeiro)
<Component huge scale={3} />  // scale = 2 (huge sobrescreve)

Anti-Padrões

Estilos Dinâmicos Quebram a Otimização

// RUIM - quebra a otimização do compilador
<View style={{ width: someVariable * 2 }} />
<View backgroundColor={isDark ? '$gray1' : '$gray12'} />

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

Funções Inline

// RUIM - nova função a cada renderização
<View onPress={() => handlePress(id)} />

// BOM - referência estável
const handlePressCallback = useCallback(() => handlePress(id), [id])
<View onPress={handlePressCallback} />

Caminhos de Importação Errados

// Estes são pacotes diferentes com conteúdos diferentes:
import { View } from 'tamagui'           // Kit UI completo
import { View } from '@tamagui/core'     // Apenas core (menor)
import { Button } from '@tamagui/button' // Componente individual

// Escolha uma abordagem e seja consistente

Misturando RN StyleSheet com Tamagui

// RUIM - valores de StyleSheet não resolvem tokens
const styles = StyleSheet.create({ box: { padding: 20 } })
<View style={styles.box} backgroundColor="$blue10" />

// BOM - tudo Tamagui
<View padding="$4" backgroundColor="$blue10" />

Ramificação Platform.OS para Dialog/Sheet

// RUIM - ramificação manual de plataforma
if (Platform.OS === 'web') {
  return <Dialog>...</Dialog>
}
return <Sheet>...</Sheet>

// BOM - use Adapt (veja @DIALOG_PATTERNS.md)
<Dialog>
  <Dialog.Portal>...</Dialog.Portal>
  <Adapt when="sm" platform="touch">
    <Sheet><Adapt.Contents /></Sheet>
  </Adapt>
</Dialog>

Obtendo Documentação Atual

Para detalhes mais recentes da API, busque documentos markdown diretamente:

# Documentação do core
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"

# Documentação de componentes
curl -sL "https://tamagui.dev/ui/sheet.md"
curl -sL "https://tamagui.dev/ui/dialog.md"
curl -sL "https://tamagui.dev/ui/select.md"

# Índice completo de documentação
curl -sL "https://tamagui.dev/llms.txt"

Para páginas HTML, use a skill web-fetch com seletores apropriados.

Referência Rápida

Atalhos do Config v4 (alinhados com Tailwind)

AtalhoPropriedade
bgbackgroundColor
ppadding
mmargin
wwidth
hheight
brborderRadius

Breakpoints de Consulta de Mídia

TokenPadrãoPadrão do Servidor
$xs660pxtrue
$sm800pxfalse
$md1020pxfalse
$lg1280pxfalse
$xl1420pxfalse

Drivers de Animação

DriverPlataformaCaso de Uso
cssWebPadrão, melhor desempenho
react-native-reanimatedNativoNecessário para animações nativas

Arquivos de Padrão Adicionais

  • @DIALOG_PATTERNS.md - Dialog, Sheet, Adapt, acessibilidade
  • @FORM_PATTERNS.md - Form, Input, Label, validação com zod
  • @ANIMATION_PATTERNS.md - Drivers de animação, enterStyle/exitStyle
  • @OVERLAY_PATTERNS.md - Popover, Tooltip, Select
  • @COMPILER_PATTERNS.md - Detalhes de otimização do compilador
  • @DESIGN_SYSTEM.md - Tokens de design e temas

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

Habilidades Relacionadas