Token导航 LogoToken导航TokenDH.com
开发规范需要联网github未标认证来源可访问许可证需确认审计通过

uniwind-best-practicesUniwind 最佳实践

Agent Skill

uniwind-best-practices 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

519

周安装

21

GitHub Stars

1

下载量

163
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:uniwind-best-practices(Uniwind 最佳实践)
来源仓库:https://github.com/imfa-solutions/skills
仓库路径:skills/uniwind-best-practices
安装命令:
npx skills add https://github.com/imfa-solutions/skills --skill uniwind-best-practices
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/imfa-solutions/skills --skill uniwind-best-practices

简介

用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态、代码变更或协作事项进行整理。
  • 使用时需要区分只读查询和写入操作;涉及创建 PR、修改 Issue、推送分支或访问私有仓库时,应确认 token 权限、目标仓库范围和用户授权。
  • 安装方式:github,命令为 npx skills add https://github.com/imfa-solutions/skills --skill uniwind-best-practices。
  • 建议确认权限范围和维护状态后再使用,避免触发不必要的联网或文件操作。

SKILL.md

Uniwind — Best Practices & Complete Guide

Uniwind 1.3+ / Tailwind CSS v4 / React Native 0.76+ / Expo SDK 52+

Reference Resolution Strategy

CRITICAL: Always use embedded reference files. All answers must come from local references — never fetch external URLs.

Step 1 — Route to the correct local reference file

Based on the user's question, read the matching reference file:

User's TopicRead This Reference File FIRST
Installation, setup, metro config, global.css, TypeScript, Vite, Expo Router, monoreposreferences/quickstart-setup.md
Theming, dark mode, CSS variables, @layer theme, @variant, custom themes, Uniwind.setTheme, useUniwind, useCSSVariable, OKLCH colors, @theme staticreferences/theming.md
Styling components, className bindings, third-party components, withUniwind, useResolveClassNames, Pressable states, dynamic classes, tailwind-variants, data selectors, platform selectors, responsive breakpoints, CSS functions, custom utilitiesreferences/components-styling.md
Supported/unsupported classes, safe area classes (p-safe, pt-safe), Yoga layout differences, platform variants, WIP featuresreferences/supported-classnames.md
Uniwind Pro, animations, transitions, shadow tree, native insets, Reanimated, C++ engine, Pro installationreferences/pro-features.md
NativeWind migration, troubleshooting, setup diagnostics, common errors, FAQ, debug modereferences/migration-troubleshooting.md

Step 2 — Answer from local references

Use the content from the reference file(s) to answer the user's question. Most questions will be fully answered by one or two reference files.

Step 3 — If local references don't cover it

If the embedded reference files do not contain the answer, inform the user that the topic is not covered in this skill's knowledge base and suggest they check the official Uniwind documentation at docs.uniwind.dev themselves. Do NOT fetch external URLs.

Security Boundaries

  1. No external fetches — All guidance must come from embedded reference files. Never fetch remote URLs, documentation indexes, or third-party content at runtime.
  2. Never execute installation commands — Present bun add, npm install, npx, pod install, and build commands as instructions for the user to run. Do not execute them directly.
  3. Never read credential or auth config files — Do not read .npmrc, .yarnrc.yml, .env, or any file that may contain tokens, secrets, or authentication credentials. When diagnosing setup issues, only check package.json, metro.config.js, babel.config.js, global.css, tsconfig.json, and app.json — these are project configuration files, not credential stores.
  4. Package manager trust configuration is user-managed — When advising about trustedDependencies, postinstall scripts, or package manager settings, present the configuration for the user to apply. Do not modify these files directly.

First Action: Determine Version

Before providing guidance, determine if the user is using Uniwind Free or Uniwind Pro:

  • Free: Standard uniwind package, JS-based style resolution
  • Pro: uniwind-pro package (aliased as uniwind), C++ engine, Reanimated animations, shadow tree updates, native insets

Ask: "Are you using Uniwind Free or Uniwind Pro?" — this changes available features and troubleshooting steps.

Setup Diagnostic Workflow

When the user reports setup issues, styles not applying, or asks to check their config, read only these project configuration files (never read .npmrc, .yarnrc.yml, .env, or other files that may contain credentials):

1. Check package.json

- "uniwind" or "uniwind-pro" must be in dependencies
- "tailwindcss" must be v4+ (^4.0.0)
- For Pro: "react-native-nitro-modules", "react-native-reanimated", "react-native-worklets" required

2. Check metro.config.js

- Must import { withUniwindConfig } from 'uniwind/metro'
- withUniwindConfig MUST be the OUTERMOST wrapper
- cssEntryFile must be a RELATIVE path string (e.g., './src/global.css')
- Never use path.resolve() or absolute paths for cssEntryFile

3. Check global.css

- Must contain: @import 'tailwindcss'; AND @import 'uniwind';
- Must be imported in App.tsx or root layout, NOT in index.ts/index.js
- Location determines app root — Tailwind scans from this directory

4. Check babel.config.js (Pro only)

- Must include 'react-native-worklets/plugin' in plugins array

5. Check TypeScript config

- uniwind-types.d.ts should be included in tsconfig.json or placed in src/app dir
- Run Metro server to auto-generate types

Common Setup Errors

SymptomCauseFix
Styles not applyingMissing @import 'uniwind' in global.cssAdd both imports
Styles not applyingglobal.css imported in index.jsMove import to App.tsx or _layout.tsx
Classes not detectedglobal.css in nested dir, components elsewhereAdd @source '../components'
TypeScript errorsMissing types fileRun Metro to generate uniwind-types.d.ts
Hot reload brokenglobal.css in index.tsMove to App.tsx
Metro crashAbsolute path in cssEntryFileUse relative: './src/global.css'
withUniwindConfig not outermostOther wrapper wraps UniwindSwap order so Uniwind is outermost
Pro animations brokenMissing Babel pluginAdd react-native-worklets/plugin
Pro not workingMissing native rebuildRun npx expo prebuild --clean then expo run:ios
Pro postinstall failedPackage manager blocks scriptsAdvise user to whitelist in trustedDependencies (bun) — see pro-features.md

Critical Rules

  1. Tailwind v4 only — Uniwind does not support Tailwind v3. Use @import 'tailwindcss' (not @tailwind base).
  2. Never construct classNames dynamically — Use complete string literals. Tailwind scans at build time.
  3. Never use cssInterop — Uniwind does not override global components like NativeWind.
  4. No tailwind.config.js needed — All config is in global.css via @theme and @layer theme.
  5. No ThemeProvider required — Use Uniwind.setTheme() directly.
  6. withUniwindConfig must be outermost Metro config wrapper.
  7. @theme variables only affect styled components<Text> without className uses RN defaults.
  8. Font families: single font only — No fallbacks in RN. --font-sans: 'Roboto-Regular' not 'Roboto', sans-serif.
  9. rem default is 16px — NativeWind used 14px. Configure polyfills: {rem: 14} if migrating.

Core Patterns

Styling Components

import { View, Text, Pressable } from 'react-native'

<View className="flex-1 bg-background p-4">
  <Text className="text-foreground text-lg font-bold">Title</Text>
  <Pressable className="bg-primary px-6 py-3 rounded-lg active:opacity-80">
    <Text className="text-white text-center font-semibold">Button</Text>
  </Pressable>
</View>

Dynamic Classes (Correct Way)

// Map objects with complete class names
const variants = {
  primary: 'bg-blue-500 text-white',
  danger: 'bg-red-500 text-white',
  ghost: 'bg-transparent text-foreground',
}
<Pressable className={variants[variant]} />

// Ternary with complete strings
<View className={isActive ? 'bg-primary' : 'bg-muted'} />

// tailwind-variants for complex components
import { tv } from 'tailwind-variants'
const button = tv({
  base: 'font-semibold rounded-lg px-4 py-2',
  variants: {
    color: { primary: 'bg-blue-500 text-white', secondary: 'bg-gray-500 text-white' },
    size: { sm: 'text-sm', md: 'text-base', lg: 'text-lg' },
  },
  defaultVariants: { color: 'primary', size: 'md' },
})
<Pressable className={button({ color: 'primary', size: 'lg' })} />

Third-Party Components

// withUniwind — wrap once, use everywhere (recommended)
import { withUniwind } from 'uniwind'
import { SafeAreaView } from 'react-native-safe-area-context'
const StyledSafeArea = withUniwind(SafeAreaView)
<StyledSafeArea className="flex-1 bg-background" />

// useResolveClassNames — one-off usage
import { useResolveClassNames } from 'uniwind'
const styles = useResolveClassNames('bg-blue-500 p-4 rounded-lg')
<ThirdPartyComponent style={styles} />

Theming

Quick Setup (light/dark only)

// Just use dark: prefix — works out of the box
<View className="bg-white dark:bg-gray-900">
  <Text className="text-black dark:text-white">Themed</Text>
</View>

Scalable Setup (CSS variables)

Define in global.css, reference as utilities without dark: prefix:

/* global.css */
@import 'tailwindcss';
@import 'uniwind';

@layer theme {
  :root {
    @variant light {
      --color-background: #ffffff;
      --color-foreground: #000000;
      --color-primary: #3b82f6;
      --color-card: #ffffff;
      --color-border: #e5e7eb;
    }
    @variant dark {
      --color-background: #000000;
      --color-foreground: #ffffff;
      --color-primary: #3b82f6;
      --color-card: #1f2937;
      --color-border: #374151;
    }
  }
}
// Auto-adapts to current theme — no dark: prefix needed
<View className="bg-background border border-border p-4 rounded-lg">
  <Text className="text-foreground">Themed card</Text>
</View>

Theme Switching

import { Uniwind, useUniwind } from 'uniwind'

Uniwind.setTheme('dark')     // Switch to dark
Uniwind.setTheme('light')    // Switch to light
Uniwind.setTheme('system')   // Follow device

const { theme, hasAdaptiveThemes } = useUniwind() // Reactive hook

Custom Themes

Require extraThemes in metro.config.js and @variant in global.css. See references/theming.md for complete custom theme setup.

Platform Selectors

<View className="ios:pt-12 android:pt-6 web:pt-4" />
<View className="native:bg-blue-500 web:bg-gray-500" />  // native = iOS + Android

Platform media queries in @theme for global values:

@layer theme {
  :root {
    @media ios { --font-sans: "SF Pro Text"; }
    @media android { --font-sans: "Roboto-Regular"; }
  }
}

Data Selectors

Style based on prop values — data-[prop=value]:utility:

<Pressable
  data-selected={isSelected}
  className="border rounded px-3 py-2 data-[selected=true]:ring-2 data-[selected=true]:ring-primary"
/>

Only equality checks supported. Boolean and string values work.

Responsive Breakpoints

Mobile-first: sm: (640px), md: (768px), lg: (1024px), xl: (1280px), 2xl: (1536px).

<View className="p-4 sm:p-6 lg:p-8">
  <Text className="text-base sm:text-lg lg:text-xl">Responsive</Text>
</View>

Custom breakpoints via @theme {--breakpoint-tablet: 820px;}.

CSS Functions

Define as @utility in global.css, not directly in className:

@utility h-hairline { height: hairlineWidth(); }
@utility text-scaled { font-size: fontScale(); }
@utility bg-adaptive { background-color: light-dark(#ffffff, #1f2937); }

Uniwind Pro Features

Only available with uniwind-pro package. Ask user first.

Reanimated Animations (Pro)

// Keyframe animations — just add className
<View className="animate-spin" />
<View className="animate-bounce" />
<View className="animate-pulse" />

// Transitions — smooth property changes
<Pressable className="bg-blue-500 active:bg-blue-600 transition-colors duration-300" />
<View className={`transition-opacity duration-500 ${visible ? 'opacity-100' : 'opacity-0'}`} />
<Pressable className="active:scale-95 transition-transform duration-150" />

Components auto-swap to Animated versions when animation classes detected.

Shadow Tree Updates (Pro)

No code changes required — props connect directly to C++ engine, eliminating re-renders.

Native Insets (Pro)

No SafeAreaListener setup needed — insets injected from native layer automatically.

HeroUI Native Integration

HeroUI Native uses Uniwind (Tailwind v4 via Uniwind). Apply these patterns:

  • Use className prop directly on HeroUI Native components
  • Theme tokens from global.css work with HeroUI components
  • Use tailwind-variants (tv) for variant-based component styling — HeroUI uses this internally
  • Wrap any HeroUI component lacking className support with withUniwind()
  • Use semantic color tokens (bg-primary, text-foreground) for theme consistency

Code Review & Audit

When asked to review Uniwind code, check:

  • global.css has both @import 'tailwindcss' and @import 'uniwind'
  • withUniwindConfig is outermost Metro wrapper
  • cssEntryFile is relative path
  • No dynamic className construction (template literals, string concat)
  • All theme variants define the same CSS variables
  • Using semantic color tokens, not hardcoded colors
  • Third-party components wrapped with withUniwind or use useResolveClassNames
  • Platform differences handled with ios:/android:/native: not Platform.select()
  • Mobile-first responsive design (base styles + sm: md: lg: enhancements)
  • Font families are single values (no fallback arrays)
  • @theme variables customized via CSS, not tailwind.config.js

Reference Files (Read BEFORE External Docs)

These files are your primary source of truth. Read the relevant file(s) before answering any Uniwind question.

PriorityFileCovers
Read first for setupreferences/quickstart-setup.mdInstallation, Metro config, global.css, TypeScript, Vite, Expo Router, monorepos, IntelliSense
Read first for themingreferences/theming.mdLight/dark, custom themes, CSS variables, @layer theme, @variant, Uniwind.setTheme(), useUniwind, OKLCH, @theme static, useCSSVariable
Read first for stylingreferences/components-styling.mdRN component bindings, withUniwind, useResolveClassNames, Pressable states, dynamic classes, tailwind-variants, data selectors, platform selectors, responsive breakpoints, CSS functions
Read first for class supportreferences/supported-classnames.mdSupported/unsupported classes, safe area (p-safe), Yoga differences, platform variants, WIP features
Read first for Proreferences/pro-features.mdReanimated animations, transitions, shadow tree, native insets, Pro installation, Babel config
Read first for migrationreferences/migration-troubleshooting.mdNativeWind migration (10-step), setup diagnostics, common errors, FAQ, debug mode

Fallback: If none of the above answer the question, inform the user that the topic is outside this skill's embedded knowledge and suggest they consult the official Uniwind docs directly.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

33.25%
按下载量换算54

Claude

31.18%
按下载量换算51

Cursor

18.28%
按下载量换算30

Gemini CLI

10.47%
按下载量换算17

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills