Token导航 LogoToken导航

Agent Skill · 前端设计

antd-style-to-tailwind(antd style TO Tailwind CSS 前端)

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

antd-style-to-tailwind 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证信息还不明确,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 8,040。

总安装 318周安装 13GitHub Stars 4,789下载 103核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:antd-style-to-tailwind(antd style TO Tailwind CSS 前端)
来源仓库:https://github.com/dtyq/magic
仓库路径:skills/antd-style-to-tailwind
安装命令:
npx skills add https://github.com/dtyq/magic --skill antd-style-to-tailwind
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/dtyq/magic --skill antd-style-to-tailwind

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

用于将 antd-style 编写的组件样式迁移至 Tailwind CSS,支持 createStyles 转换。适合在 Codex、Claude、Cursor、Gemini CLI 中需要重构现有组件样式时使用。

使用时需先阅读目标组件文件,替换 antd Button 为 shadcn Button,避免直接覆盖样式。安装前建议确认权限范围和维护状态,以及是否会触发联网、命令执行或文件读写。可通过 GitHub 仓库获取具体用法,建议结合原始 README 和示例脚本进一步验证功能。

来源仓库内路径:skills/antd-style-to-tailwind

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/dtyq/magic --skill antd-style-to-tailwind;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

antd-style-to-tailwind 怎么安装?

在终端执行 npx skills add https://github.com/dtyq/magic --skill antd-style-to-tailwind。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

antd-style-to-tailwind 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

antd-style-to-tailwind 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add https://github.com/dtyq/magic --skill antd-style-to-tailwind 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

antd-style-to-tailwind 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

antd-style-to-tailwind 用的人多吗?

公开数据是累计安装 318 次,近一周安装 13 次,下载 103 次,GitHub 4,789 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

antd-style-to-tailwind 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。
  • 来源仓库有 4,789 星,维护活跃度相对可查。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
antd-style-to-tailwind

antd style TO Tailwind CSS 前端 · 本页

3184,789执行命令未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

antd-style → Tailwind CSS Migration

When to apply

  • User asks to migrate / rewrite / convert a component's styles to Tailwind
  • A new feature is being built in a file that currently uses createStyles
  • User references styles.ts, createStyle, useXxxStyles, or cx()
  • Component contains antd Button — replace with shadcn Button during migration

Prerequisites

Always read these files before starting:

  • The target component (index.tsx or equivalent)
  • Its styles.ts
  • tailwind.config.js and src/index.css if token mapping is unclear

Migration Steps

1. Audit the styles.ts

Identify:

  • Styles used only by this component → remove from styles.ts
  • Styles shared with other components → keep createStyles for those

Also check if the styles file is imported anywhere else before deleting:

rg "from.*ComponentName/styles" --type tsx --type ts

2. Replace createStyles wiring

- import { useXxxStyles } from "./styles"
+ import { cn } from "@/opensource/lib/utils"

  const targetComponent = observer((props) => {
-   const { styles, cx } = useXxxStyles()

Use cn() everywhere cx() was used.

Do not build class strings with + concatenation. Prefer:

const segmentedClassName = cn(
	"rounded-md border border-border p-1",
	"[&_.magic-segmented-group]:gap-0.5",
	"[&_.magic-segmented-item-label]:text-xs",
)

3. Z-index semantic tokens

Prefer semantic z-index classes over arbitrary z-[N] values.

ValueTailwind classCSS variable
1000z-tooltip--z-index-tooltip
1000z-popup--z-index-popup
1000z-dropdown--z-index-dropdown
1000z-dialog--z-index-dialog
1000z-drawer--z-index-drawer

Choose by context: use z-tooltip for tooltips, z-dropdown for menus, z-dialog for modals.

4. Translate CSS properties

CSSTailwind
width: 100%w-full
width: fit-contentw-fit
height: fit-contenth-fit
padding: 12px 0py-3
padding: 10pxp-2.5
padding: 6pxp-1.5
padding: 4px 8pxpx-2 py-1
padding: 4px 6pxpx-1.5 py-1
padding: 0 4pxpx-1
padding: 0 6pxpx-1.5 py-0
margin-top: 6pxmt-1.5
margin-top: 10pxmt-2.5
margin-left: automl-auto
display: flexflex
display: inline-flexinline-flex
flex-direction: columnflex-col
align-items: centeritems-center
align-self: flex-endself-end
justify-content: flex-endjustify-end
gap: 4pxgap-1
gap: 6pxgap-1.5
gap: 10pxgap-2.5
font-size: 12px; line-height: 16pxtext-xs leading-4
font-size: 10px; line-height: 13pxtext-[10px] leading-[13px]
font-size: 14px; line-height: 1.4text-sm leading-[1.4]
font-weight: 600font-semibold
font-weight: 400font-normal
cursor: pointercursor-pointer
cursor: defaultcursor-default
cursor: not-allowedcursor-not-allowed
position: relativerelative
position: absoluteabsolute
flex: noneflex-none
flex-shrink: 1shrink (default, often omit)
white-space: nowrapwhitespace-nowrap
white-space: pre-wrapwhitespace-pre-wrap
overflow: hiddenoverflow-hidden
text-overflow: ellipsistext-ellipsis
min-width: 0min-w-0
border-radius: 8pxrounded-md (= 8px via --radius-md)
border-radius: 12pxrounded-[12px]
border-radius: 0 4px 4px 0rounded-r-[4px]
box-shadow: 0 1px 2px rgba(0,0,0,0.05)shadow-sm

5. Map design tokens

Prefer semantic Tailwind vars — they auto-adapt to dark mode.

antd-style tokenTailwind classNotes
token.magicColorUsages.text[0]text-foregroundprimary text
token.magicColorUsages.text[1]text-foreground/80slightly dimmed
token.magicColorUsages.text[2]text-muted-foregroundsecondary text
token.magicColorUsages.text[3]text-foreground/35disabled/placeholder
token.magicColorUsages.fill[0]bg-fillhover fill (subtle)
token.magicColorUsages.fill[1]bg-fill-secondaryactive fill (stronger)
token.magicColorUsages.fill[2]bg-black/[0.13] + dark:bg-white/[0.13]deep active fill
token.magicColorUsages.borderborder-border
token.magicColorUsages.bg[0..4]bg-backgroundall white in light
token.magicColorUsages.warning.defaulttext-orange-500⚠️ orange, not amber
token.magicColorUsages.warningLight.defaultbg-orange-50⚠️ orange-0
token.magicColorUsages.danger.defaulttext-destructiveuses Tailwind semantic
token.magicColorUsages.dangerLight.defaultbg-destructive/10prefer slash opacity
token.magicColorUsages.primary.defaulttext-primarybrand blue
token.magicColorUsages.primaryLight.defaultbg-primary-10⚠️ Use not bg-primary/10
token.magicColorUsages.success.defaulttext-green-500
token.magicColorUsages.successLight.defaultbg-green-50
token.magicColorUsages.info.defaulttext-blue-500
token.magicColorUsages.infoLight.defaultbg-blue-50
token.magicColorUsages.tertiary.defaulttext-muted-foreground
token.magicColorUsages.disabled.bgbg-gray-200 + dark:bg-white/10
token.magicColorUsages.disabled.texttext-foreground/35
token.magicColorScales.grey[0]bg-muted / bg-gray-50
token.magicColorScales.grey[2]border-border (preferred)
token.magicColorScales.grey[9]text-foreground
token.borderRadiusSM (4px)rounded-[4px]use [4px] not rounded-sm (2px)

Project-specific opacity tokens (from src/index.css):

  • Primary light token keeps semantic suffix (bg-primary-10) due mixed light/dark opacity mapping
  • Destructive opacity should use slash syntax (bg-destructive/10, bg-destructive/20)
AvoidUseCSS variable
bg-primary/10bg-primary-10--custom-primary-10-dark-primary-20 (light 10%, dark 20%)
bg-destructive-10bg-destructive/10--destructive + opacity
bg-destructive-20bg-destructive/20--destructive + opacity
border-gray-500/10 (outline)border-[var(--custom-outline-10-dark-outline-20)]--custom-outline-10-dark-outline-20

6. Map hardcoded hex colors

HexTailwind equivalent
#171717text-foreground
#e5e5e5 (border)border-border
#9ca3aftext-gray-400 / border-gray-400
#3b82f6text-blue-500
#ebf2febg-[#ebf2fe] + dark: dark:bg-blue-500/10
#f5f6f7bg-[#f5f6f7] + dark: dark:bg-white/10
#f9f9f9bg-gray-50 + dark: dark:bg-white/5
#ffffff (surface)bg-white + dark: dark:bg-card
rgba(46,47,56,0.09)bg-black/[0.09] + dark: dark:bg-white/[0.09]

7. Pseudo-elements

::after / ::before with decorative content:

// Before (antd-style)
wrapper: css`
	position: relative;
	&::after {
		content: " ";
		position: absolute;
		left: 11px;
		top: 0;
		width: 1px;
		height: 100%;
		border-left: 1px dashed ${token.magicColorScales.grey[2]};
	}
`

// After (Tailwind)
;("relative after:content-[''] after:absolute after:left-[11px] after:top-0 after:w-px after:h-full after:border-l after:border-dashed after:border-border")

8. Child selectors

CSS patternTailwind arbitrary variant
& p {margin-bottom: 0}[&_p]:mb-0
& p {color: X!important}[&_p]:!text-X
& p {font-size: 12px!important}[&_p]:!text-xs
& p {line-height: 16px!important}[&_p]:!leading-4
svg {color: X}[&_svg]:text-X

9. CSS animations

antd-style keyframeTailwind
Custom rotate(0 → 360) spinanimate-spin (1s linear infinite)
Custom fade-in / slideCheck tailwind.config.js animation section for project-defined animations

10. Replace antd layout components

antd layout primitives (Flex, Space, Row, Col) must be replaced with plain <div> + Tailwind.

Flex → div
antd Flex propTailwind equivalent
<Flex><div className="flex">
<Flex vertical><div className="flex flex-col">
gap={4}gap-1
gap={6}gap-1.5
gap={8}gap-2
gap={10}gap-2.5
gap={12}gap-3
gap={16}gap-4
gap={20}gap-5
gap={24}gap-6
align="center"items-center
align="start"items-start
align="end"items-end
justify="center"justify-center
justify="space-between"justify-between
justify="flex-end"justify-end
wrap / wrap="wrap"flex-wrap
flex={1} (child)flex-1 on the child
- import { Flex } from "antd"

- <Flex vertical gap={10}>
-   <span>…</span>
-   <Flex gap={8}>…</Flex>
- </Flex>

+ <div className="flex flex-col gap-2.5">
+   <span>…</span>
+   <div className="flex gap-2">…</div>
+ </div>
Space → div
- <Space size={8} direction="vertical">
+ <div className="flex flex-col gap-2">

10.5 Replace MagicScrollBar with shadcn ScrollArea

When migrating legacy list areas:

- import MagicScrollBar from "@/opensource/components/base/MagicScrollBar"
+ import { ScrollArea } from "@/opensource/components/shadcn-ui/scroll-area"

Map old SimpleBar content padding to viewportClassName:

- <MagicScrollBar className="h-full w-full [&_.simplebar-content]:px-2.5 [&_.simplebar-content]:pb-2.5">
+ <ScrollArea className="min-h-0 h-full w-full" viewportClassName="px-2.5 pb-2.5">

Critical height-chain rule (flex layouts):

  • Every ancestor from panel body to ScrollArea must provide a calculable height
  • Typical safe chain: flex-1 min-h-0 overflow-hidden on parent + min-h-0 h-full on ScrollArea
  • Avoid wrapping ScrollArea with components that add an extra auto-height layer (for example spinner wrappers) unless that wrapper and its direct child are both h-full

If loading overlay breaks scrolling, prefer rendering loading as a branch:

{
	loading ? (
		<div className="flex h-full w-full items-center justify-center">{/* spinner */}</div>
	) : (
		<ScrollArea className="min-h-0 h-full w-full" viewportClassName="px-2.5 pb-2.5">
			{/* list */}
		</ScrollArea>
	)
}

Keep existing data-testid values on list / loading / empty nodes when replacing containers.

11. Replace antd Button with shadcn Button

When migrating a component that uses antd Button, replace it with shadcn Button from @/opensource/components/shadcn-ui.

Import change
- import { Button } from "antd"
+ import { Button } from "@/opensource/components/shadcn-ui"
antd → shadcn mapping
antd Buttonshadcn Button
type="primary"variant="default" (or omit, default)
type="default"variant="outline" or variant="secondary"
type="text"variant="ghost"
type="link"variant="link"
dangervariant="destructive"
size="large"size="lg"
size="small"size="sm"
icon={<Icon />}Put icon as child: <Button><Icon /> Text</Button>
loadingUse disabled + loading spinner as child, or a loading state component
Example migration
- import { Button } from "antd"
- import { IconDownload } from "@tabler/icons-react"
+ import { Button } from "@/opensource/components/shadcn-ui"
+ import { IconDownload } from "@tabler/icons-react"  // or lucide-react

- <Button type="primary" icon={<IconDownload size={20} />} onClick={handleDownload}>
-   {t("detail.downloadFile")}
- </Button>
+ <Button onClick={handleDownload} size="sm">
+   <IconDownload className="size-5" />
+   {t("detail.downloadFile")}
+ </Button>

shadcn Button has built-in [&_svg]:size-4; use className="size-5" on the icon for 20px. Remove any className overrides that were needed for antd — shadcn Button uses Tailwind and supports className for minor tweaks only.

11.5 Replace antd Input with shadcn Input

When migrating a component that uses antd Input, replace it with shadcn Input from @/opensource/components/shadcn-ui/input.

Import change
- import { Input } from "antd"
+ import { Input } from "@/opensource/components/shadcn-ui/input"
Prefix icon migration

Antd prefix prop is not used in shadcn Input. Wrap Input with a relative container and render the icon absolutely:

<div className="relative w-full">
	<IconSearch
		size={16}
		className="pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"
	/>
	<Input
		value={searchText}
		onChange={(event) => setSearchText(event.target.value)}
		className="pl-9"
		placeholder={t("mcp.panel.searchPlaceholder")}
	/>
</div>
Notes
  • Keep data-testid unchanged during migration
  • Preserve placeholder and controlled value logic
  • Use fixed width wrapper only when desktop layout needs it (for example w-[240px])

12. Antd component overrides (non-Button)

When applying Tailwind to other antd components (Dropdown, Modal, etc.), antd's CSS specificity requires !important for most visual properties. Layout utilities like flex-none do NOT need ! since they're additive.

Workspace rule (critical): for internal antd class overrides, use .magic-* prefix, not .ant-*.

  • ✅ "[&_.magic-alert]:text-xs"
  • ❌ "[&_.ant-alert]:text-xs"
// Dropdown overlayClassName targeting internal antd classes
overlayClassName="[&_.magic-dropdown-menu]:!p-[6px] [&_.magic-dropdown-menu]:flex
  [&_.magic-dropdown-menu]:flex-col [&_.magic-dropdown-menu]:gap-1
  [&_.magic-dropdown-menu-item]:!p-0"

Rule of thumb for !: Does antd set this property by default? If yes → !. If it's purely additive (flex-none, mt-2.5, self-end) → no ! needed.

13. Interactive states (hover / active / focus / disabled)

Always add all four states when styling interactive elements. Missing any state causes visible regressions (e.g., a button that darkens on hover but ignores keyboard focus).

State token mapping
StateToken equivalentTailwind classNotes
hover bgfill[0]hover:bg-fillsemantic, auto dark-mode
hover bg (stronger)fill[1]hover:bg-fill-secondaryfor already-filled surfaces
active bgfill[1]active:bg-fill-secondaryslightly darker than hover
hover texttext[0]hover:text-foregroundkeeps text readable
focus ringring CSS varfocus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ringkeyboard only
disabled—disabled:pointer-events-none disabled:opacity-50always include
Ghost button (bg-background + border)
// Canonical ghost button pattern — always use cn()
const ghostButton = cn(
	"inline-flex items-center cursor-pointer rounded-lg",
	"bg-background text-foreground border border-border",
	"hover:bg-fill hover:text-foreground",
	"active:bg-fill-secondary",
	"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
	"disabled:pointer-events-none disabled:opacity-50",
)
Filled button (bg-primary)
const primaryButton = cn(
	"bg-primary text-primary-foreground",
	"hover:bg-primary/90",
	"active:bg-primary/80",
	"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
	"disabled:pointer-events-none disabled:opacity-50",
)
Filled muted button (bg-muted / bg-fill)
const mutedButton = cn(
	"bg-fill text-foreground",
	"hover:bg-fill-secondary hover:text-foreground",
	"active:bg-black/[0.13] dark:active:bg-white/[0.13]",
	"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
	"disabled:pointer-events-none disabled:opacity-50",
)
Shared const pattern (for custom div buttons)

When building custom button-like elements (not shadcn Button), extract to a module-level const:

// Outside component — for div/span that acts as button
const actionButtonBase = cn(
  "inline-flex h-6 items-center gap-1 px-2.5 py-1",
  "cursor-pointer rounded-lg text-xs leading-4",
  "bg-background text-foreground border border-border",
  "hover:bg-fill hover:text-foreground",
  "active:bg-fill-secondary",
  "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
  "disabled:pointer-events-none disabled:opacity-50",
)

// For shadcn Button — use variant/size props, className for minor tweaks only
<Button variant={isActive ? "default" : "outline"} size="sm">

Dark Mode Patterns

Add dark: variants for all hardcoded light-specific colors.

LightDarkUse case
bg-whitedark:bg-cardsurface / card bg
bg-orange-50dark:bg-orange-500/20warning/warningLight bg
text-orange-500dark:text-orange-400warning text
[&_p]:!text-orange-500dark:[&_p]:!text-orange-400warning p override
bg-green-50dark:bg-green-500/20success bg
text-green-500dark:text-green-400success text
bg-blue-50dark:bg-blue-500/20info/secondary bg
text-blue-500dark:text-blue-400info/secondary text
bg-[#ebf2fe]dark:bg-blue-500/10finished badge bg (hardcoded)
bg-[#f5f6f7]dark:bg-white/10suspended badge bg (hardcoded)
text-gray-400dark:text-gray-500muted icon/label
bg-gray-50dark:bg-white/5subtle list item bg
!bg-whitedark:!bg-cardantd button/surface bg
bg-black/[0.09]dark:bg-white/[0.09]fill[1] dark overlay
bg-black/[0.13]dark:bg-white/[0.13]fill[2] darker overlay

Semantic Tailwind variables (bg-background, border-border, text-foreground, bg-muted, bg-fill, bg-fill-secondary) are already dark-mode aware — no dark: prefix needed.

Dark Mode Verification Checklist

After migration, verify dark mode styles are complete:

  1. Scan for hardcoded light colors without dark:

- bg-white, bg-gray-50, bg-orange-50, bg-green-50, bg-blue-50, bg-amber-50 - text-gray-400, text-gray-500, text-orange-500, text-green-500, text-blue-500 - bg-[#...], text-[#...] (hex values) - border-gray-200, border-gray-300 - Each of these must have a matching dark: variant.

  1. Verify semantic tokens

- Prefer bg-background, text-foreground, border-border, bg-muted, bg-fill — these auto-adapt. - If using fixed colors (e.g. bg-white), always pair with dark:bg-card or equivalent.

  1. Interactive elements

- hover:, active: states using light-only colors need dark: variants. - Example: hover:bg-gray-100 → add dark:hover:bg-white/10.

  1. Manual verification

- Toggle dark mode in the app and visually inspect the migrated component. - Check: backgrounds, text contrast, borders, shadows, focus rings. - Ensure no "invisible" text or low-contrast elements in dark mode.

  1. Search pattern for audit # Find light-only color classes — verify each has a dark: variant in same className rg "bg-(white|gray-50|orange-50|green-50|blue-50|amber-50)" --type tsx path/to/component rg "text-(gray-[34]00|orange-500|green-500|blue-500)" --type tsx path/to/component

React patterns to fix during migration

Prefer proper types over eslint-disable / as any

When passing props to child components, fix type errors by using proper interfaces instead of as any or eslint-disable-next-line @typescript-eslint/no-explicit-any.

  1. Export the child's props interface from the child component: - interface PlaybackTabContentProps {+ export interface PlaybackTabContentProps {
  2. Use that interface as the parent's prop type: - playbackProps?: Record<string, unknown> + playbackProps?: PlaybackTabContentProps
  3. Remove type assertions — spread directly without as any: - <PlaybackTabContent {...(playbackProps as any)} /> + <PlaybackTabContent {...playbackProps} />
  4. Simplify property access — no cast needed: - (playbackProps as Record<string, unknown>)?.isFullscreen === true + playbackProps?.isFullscreen === true

Reserve eslint-disable only for cases where proper typing is impractical (e.g. MobX store data with loose typing in .map() callbacks). Prefer exporting interfaces and typing props correctly.

Object initializer in deps causes stale closure warnings

The pattern const x = thing || {} creates a new object reference every render, causing ESLint to warn about unstable useCallback/useMemo deps. Wrap it in useMemo:

- const fileData = tool?.detail?.data || {}
+ const fileData = useMemo(() => tool?.detail?.data || {}, [tool?.detail?.data])

@ts-ignore vs @ts-expect-error

  • @ts-ignore — suppresses the error silently; ESLint bans it.
  • @ts-expect-error — requires a real error to exist; errors if the line is clean.

Migration rule:

  1. Replace // @ts-ignore with // @ts-expect-error and add a brief reason.
  2. Run lint. If you get "Unused '@ts-expect-error' directive" → the line is already clean, just delete the comment entirely.
- // @ts-ignore
+ // @ts-expect-error - result type does not expose data.file_id
  const fileId = result?.data?.file_id || result?.currentFileId

any on JSX .map() callbacks over store data (last resort)

When iterating over data from a MobX/Zustand store with loose typing, first try to add proper types (e.g. define StoreItem interface, use as StoreItem where the parent builds the data). Use eslint-disable only when proper typing is impractical (e.g. store shape is dynamic or external).

{
	/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
}
{
	items?.map((item: any) => (
		<Child data={item.attrs as ExpectedType} key={getUniqueId(item.attrs as ExpectedType)} />
	))
}
⚠️ The eslint-disable-next-line comment must be on the line immediately before the {items?.map( expression — not before the wrapping {condition && ( wrapper.

Shared base class pattern

When multiple elements share the same base styles, extract into a const outside the component:

// Before (in createStyles)
box: css`border-radius: 12px; display: inline-flex; padding: 4px 8px; ...`

// After (module-level const)
const boxBase = "rounded-[12px] inline-flex px-2 py-1 items-center text-xs gap-1 [&_p]:mb-0"

// Usage
<span className={cn(boxBase, "bg-amber-50 text-amber-500 dark:bg-amber-500/10 dark:text-amber-400")}>

Checklist before finishing

  • All styles.xxx references replaced with Tailwind classes
  • useXxxStyles import and call removed from component
  • createStyles export removed from styles.ts (if no other consumers)
  • keyframes import removed from styles.ts if unused
  • styles.ts file deleted after confirming no other imports
  • cn() imported from @/opensource/lib/utils
  • No className + concatenation; use cn(...) instead
  • antd Button replaced with shadcn Button from @/opensource/components/shadcn-ui
  • antd Input replaced with shadcn Input from @/opensource/components/shadcn-ui/input
  • If MagicScrollBar was replaced, ScrollArea uses viewportClassName and height-chain (min-h-0 + h/full) is verified
  • Dark mode verification: All hardcoded light colors have dark: variants; prefer semantic tokens (bg-background, text-foreground, etc.); manually verify in dark mode
  • antd layout components (Flex, Space, Row, Col) replaced with div + Tailwind
  • Unused antd imports removed after replacement
  • Interactive elements have all four states: hover: / active: / focus-visible: / disabled:
  • Repeated button/link classes extracted to a module-level const (DRY)
  • token.borderRadiusSM translated to rounded-[4px], not rounded-sm
  • Object initializers used as hook deps wrapped in useMemo
  • @ts-ignore replaced with @ts-expect-error + reason, or deleted if no error exists
  • Type safety: Props passed to children use proper interfaces (export from child, use in parent); avoid as any and eslint-disable for type errors
  • any in JSX map callbacks used only as last resort; prefer proper types when feasible
  • ! prefix on antd overrides applied correctly (visual props only, not layout utilities)
  • Antd override selectors use .magic-* class prefix, not .ant-*
  • Lints pass (pnpm lint)

Additional resources

平台分布

Codex

38.61%
按下载量换算40

Claude

26.82%
按下载量换算28

Cursor

20.39%
按下载量换算21

Gemini CLI

9.2%
按下载量换算9

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/dtyq/magic --skill antd-style-to-tailwind 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

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

继续浏览同类 Skills