skills/tamagui-best-practices/SKILL.md
Use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).
npx skillsauth add awfixers-stuff/opencode-config tamagui-best-practicesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Tamagui v1.x patterns beyond fundamentals: Config v4, compiler optimization, compound components, and gotchas.
| Context | File | What it covers | |---------|------|----------------| | Dialog, Sheet, modal overlays | @DIALOG_PATTERNS.md | Adapt component, accessibility | | Form, Input, Label, validation | @FORM_PATTERNS.md | zod integration | | Animations, transitions | @ANIMATION_PATTERNS.md | drivers, enterStyle/exitStyle | | Popover, Tooltip, Select | @OVERLAY_PATTERNS.md | overlay primitives | | Compiler optimization | @COMPILER_PATTERNS.md | what the compiler can/cannot flatten | | Design tokens, theming | @DESIGN_SYSTEM.md | palette, token structure |
Minimal setup with @tamagui/config/v4. Add styleCompat: 'react-native' for new projects to align flexBasis with React Native behavior:
import { defaultConfig } from '@tamagui/config/v4'
import { createTamagui } from 'tamagui'
export const config = createTamagui({
...defaultConfig,
settings: { ...defaultConfig.settings, styleCompat: 'react-native' },
})
declare module 'tamagui' {
interface TamaguiCustomConfig extends typeof config {}
}
For custom themes use createThemes with palette/accent/childrenThemes — see @DESIGN_SYSTEM.md.
styled() variants instead of inline conditionals — dynamic values break flattening.style={{ ... }} with variables; use variant props instead.context pattern (createStyledContext) disables compiler flattening — use for higher-level components (Button, Card), not primitives.// BAD — breaks compiler
<View backgroundColor={isDark ? '$gray1' : '$gray12'} />
// GOOD — use variants
const Box = styled(View, {
variants: {
dark: { true: { backgroundColor: '$gray1' }, false: { backgroundColor: '$gray12' } },
},
})
styled(): reusable components, variant-driven behavior, compiler-optimizable primitives.as const on variants objects (TypeScript limitation until inferred const generics).Prop order determines override priority — props after a spread cannot be overridden by callers:
// width is locked; backgroundColor can be overridden
<View backgroundColor="$red10" {...props} width={200} />
Variant order matters — later props win:
<Component scale={3} huge /> // scale = 3 (scale listed first)
<Component huge scale={3} /> // scale = 2 (huge overrides, comes first in variants)
Use .styleable() when wrapping styled components — preserves variant inheritance:
const CorrectWrapper = StyledText.styleable((props, ref) => (
<StyledText ref={ref} {...props} />
))
accept prop for non-standard token resolution (SVG fill/stroke, contentContainerStyle):
const StyledSVG = styled(SVG, {}, { accept: { fill: 'color', stroke: 'color' } as const })
Import consistency — tamagui, @tamagui/core, and @tamagui/button are different packages; pick one approach per project.
Never mix RN StyleSheet with Tamagui — StyleSheet values don't resolve tokens.
Platform branching for Dialog/Sheet — use Adapt instead of Platform.OS checks (see @DIALOG_PATTERNS.md).
Config v4 shorthands: bg backgroundColor, p padding, m margin, w width, h height, br borderRadius
Media breakpoints: $xs 660px, $sm 800px, $md 1020px, $lg 1280px, $xl 1420px
Animation drivers: css (web, default), react-native-reanimated (native, required)
Token $ prefix: use in props (color="$color"), omit in theme definitions ({ color: palette[11] })
curl -sL "https://tamagui.dev/docs/core/configuration.md"
curl -sL "https://tamagui.dev/llms.txt" # full index
development
Use when starting dev servers, watchers, tilt, or any process expected to outlive the conversation. Provides zmx session management patterns for long-lived processes.
development
Zig testing skill for writing and running tests. Use when using zig build test, writing comptime tests, using test filters, working with test allocators to detect leaks, or using Zig's built-in fuzz testing (0.14+). Activates on queries about Zig tests, zig test, zig build test, comptime testing, test allocators, Zig fuzz testing, or detecting memory leaks in Zig tests.
development
Zig debugging skill. Use when debugging Zig programs with GDB or LLDB, interpreting Zig runtime panics, using std.debug.print for tracing, configuring debug builds, or debugging Zig programs in VS Code. Activates on queries about debugging Zig, Zig panics, zig gdb, zig lldb, std.debug.print, Zig stack traces, or Zig error return traces.
tools
Zig cross-compilation skill. Use when cross-compiling Zig programs to different targets, using Zig's built-in cross-compilation for embedded, WASM, Windows, ARM, or using zig cc to cross-compile C code without a system cross-toolchain. Activates on queries about Zig cross-compilation, zig target triples, zig cc cross-compile, Zig embedded targets, or Zig WASM.