/dev-skills:init-pure-admin-iconifyfrom dev-skills
Initializes a pure-admin style Iconify icon rendering system in Vite+Vue3 projects, supporting offline/online icons and unified useRenderIcon rendering.
Ships in dev-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
本技能用于在任意 vite + vue3 项目中,快速初始化一套与 pure-admin 思路一致的 iconify 图标体系,提供:
IconifyIconOffline(离线图标)IconifyIconOnline(在线图标)useRenderIcon(统一分流渲染)offlineIcon(本地离线图标映射与兼容别名)目标是让业务层只关心"传什么图标",不关心底层是离线、在线还是组件对象。
IconXxx 命名,同时支持新式 collection/name、collection:nameComponent 类型图标ReIcon 导出使用,不要各处二次封装 @iconify/vueuseRenderIcon:菜单、路由、表格配置统一返回组件IconXxx 仅做兼容,不作为新代码首选优先使用"照抄 + 最小改造"策略,不要凭记忆重写。
如果已有可运行的 src/components/ReIcon,优先完整复制后做最小改动。
将来源项目 src/components/ReIcon 映射到目标项目同路径:
来源文件 -> 目标文件
src/components/ReIcon/index.ts -> src/components/ReIcon/index.ts
src/components/ReIcon/type.ts -> src/components/ReIcon/type.ts
src/components/ReIcon/src/hooks.ts -> src/components/ReIcon/src/hooks.ts
src/components/ReIcon/src/iconifyIconOffline.ts -> src/components/ReIcon/src/iconifyIconOffline.ts
src/components/ReIcon/src/iconifyIconOnline.ts -> src/components/ReIcon/src/iconifyIconOnline.ts
src/components/ReIcon/src/offlineIcon.ts -> src/components/ReIcon/src/offlineIcon.ts
只复制这 6 个文件即可完成核心能力。
@/ 是否存在main.ts 或 src/plugins/icon.tsofflineIcon.ts 里导入和映射项IconXxx 是否需要保留除上述改动外,不要主动改 API、类型和导出结构。
在目标项目安装:
pnpm add -D @iconify/json @iconify/vue unplugin-icons vite-svg-loader
可选工具:
pnpm add @pureadmin/utils
如果你采用
~icons/...组件导入方式,unplugin-icons是必需项。
在 vite.config.ts(或插件聚合文件)添加 unplugin-icons:
import Icons from "unplugin-icons/vite";
export default defineConfig({
plugins: [
vue(),
Icons({
compiler: "vue3",
scale: 1,
}),
],
});
建议结构:
src/components/ReIcon/
├── index.ts
├── type.ts
└── src/
├── iconifyIconOffline.ts
├── iconifyIconOnline.ts
├── hooks.ts
└── offlineIcon.ts
模板代码已拆分到 templates/ 目录,直接按路径复制,不需要手动从文档里摘代码。
templates/ReIcon/index.ts
templates/ReIcon/type.ts
templates/ReIcon/src/iconifyIconOffline.ts
templates/ReIcon/src/iconifyIconOnline.ts
templates/ReIcon/src/hooks.ts
templates/ReIcon/src/offlineIcon.ts
templates/setup-icon.ts
复制规则:
templates/ReIcon/** -> src/components/ReIcon/**templates/setup-icon.ts -> src/plugins/icon.ts(或合并到你的入口注册文件)如果你希望"一字不动照抄"旧项目,请把旧项目
offlineIcon.ts全量复制过来,再对照模板补齐缺失导出。
在 src/plugins/icon.ts(或等价入口)注册:
import type { App } from "vue";
import { IconifyIconOffline, IconifyIconOnline, registerOfflineIcons } from "@/components/ReIcon";
export function setupIcon(app: App) {
registerOfflineIcons(app);
app.component("IconifyIconOffline", IconifyIconOffline);
app.component("IconifyIconOnline", IconifyIconOnline);
}
如果旧项目已大量使用 Element Plus 全局图标别名,不要删除原注册,只新增 iconify 能力。
<IconifyIconOffline icon="ep/menu" width="18" height="18" />
<IconifyIconOnline icon="ri:home-4-line" width="18" height="18" />
import { useRenderIcon } from "@/components/ReIcon";
const iconComp = useRenderIcon("ep/setting", { width: "18px", height: "18px" });
菜单项 icon 可直接写:
IconUserep/settingri:shield-user-line渲染层统一走 useRenderIcon,不要在菜单组件内部再写一套 icon 分流逻辑。
~icons/... 导入是否生效(未生效通常是漏配 unplugin-icons)@/components/ReIcon 是否可解析registerOfflineIcons(app) 是否在应用启动阶段执行IconXxx,对应 alias 是否存在仅在以下情况扩充 offlineIcon.ts:
useRenderIcon 中稳定命中离线路径扩充步骤:
import EpXxx from "~icons/ep/xxx"offlineIcons["ep/xxx"] = markRaw(EpXxx)aliasIcons.IconXxx = offlineIcons["ep/xxx"]vite.config.ts 已启用 unplugin-iconsReIcon 目录和导出结构完整useRenderIcon 可同时处理组件、离线字符串、在线字符串IconXxx 页面未被破坏.icon-title 这类容易冲突的命名,使用更局部语义类名IconXxx 只保兼容,新代码优先 ep/menu、ri:...、useRenderIconReIcon 再造一套 renderIconReIcon 文件useRenderIcon为 Iconify SVG 图标注入多色渐变填充和呼吸动画(发光 + 缩放)。
# GSAP 策略需要安装
pnpm add gsap
<script setup lang="ts">
import { ref } from "vue";
import { useIconEffect } from "@/components/ReIcon";
const iconRef = ref<HTMLElement | null>(null);
useIconEffect({
target: iconRef,
gradient: {
stops: [
{ offset: "0%", color: "#3cd8ff" },
{ offset: "100%", color: "#2f73ff" },
],
},
breath: {
strategy: "gsap",
gsap: { scale: [1, 1.12], duration: 2.2, ease: "sine.inOut" },
},
});
</script>
完整的 API 参考、渐变注入原理、三层动画策略选择、CSS 方案、多卡片场景、全局协调器、已知约束与坑位等详细内容,见以下 reference 文件:
| reference 文件 | 内容 | 何时阅读 |
|---|---|---|
references/useIconEffect.md | 完整 API 参考、渐变注入核心原理、三层动画策略(GSAP/CSS/Auto)、CSS 方案、策略选择指南、已知约束与坑位 | 需要使用 useIconEffect 时 |
references/breath-coordinator.md | 全局协调器模式(Pinia/Composable)、按实例独立使用的代价量化、决策树、与 KeepAlive 配合 | ≥4 实例或需要全局暂停/恢复时 |
| 模板文件 | 说明 |
|---|---|
templates/ReIcon/src/useIconEffect.ts | useIconEffect composable 源码 |
templates/ReIcon/type.ts | 类型定义(GradientStop、IconBreathConfig 等) |
templates/breathCoordinator.pinia.ts | 全局协调器 — Pinia Store 版本 |
templates/breathCoordinator.composable.ts | 全局协调器 — 纯 Composable 版本 |
references/breath-coordinator.md (opens in a new tab)references/useIconEffect.md (opens in a new tab)templates/ReIcon/index.ts (opens in a new tab)templates/ReIcon/src/hooks.ts (opens in a new tab)templates/ReIcon/src/iconifyIconOffline.ts (opens in a new tab)templates/ReIcon/src/iconifyIconOnline.ts (opens in a new tab)templates/ReIcon/src/offlineIcon.ts (opens in a new tab)templates/ReIcon/src/useIconEffect.ts (opens in a new tab)templates/ReIcon/type.ts (opens in a new tab)templates/breathCoordinator.composable.ts (opens in a new tab)templates/breathCoordinator.pinia.ts (opens in a new tab)templates/setup-icon.ts (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
7 skills in this plugin
/init-release-base-relizy-and-bumppUse when 需要为 pnpm monorepo 从零接入 relizy + bumpp 组合发版方案,或处理 init relizy、init bumpp、接入发版、monorepo 发版初始化、relizy + bumpp、 relizy.config、bump.config、changelog.config、独立版本、GitHub Release 自动化。/init-shadcn-docs-nuxtUse when initializing or rebuilding any component-library/project documentation site based on `shadcn-docs-nuxt`, or troubleshooting its Nuxt Content/H3, `nuxt-og-image` Nuxt-generation drift, prerender, SSR externalization, module-compatibility, MDC syntax, or Windows build issues; also for Nuxt 3 → 4 generation upgrades and deployment-channel adjudication. 适用于初始化或重构任意组件库/项目的 `shadcn-docs-nuxt` 文档站,快速建立可运行、可构建、可维护的 Nuxt 文档底座,或排查配置复杂化、 模块兼容、Nuxt Content/H3 版本漂移、prerender、SSR externalization、MDC 语法错误、 Windows 构建假卡死等故障;也适用于 Nuxt 3 → 4 世代升级与部署通道裁决。触发词包括“搭建组件库文档”“接入 shadcn-docs-nuxt”“重做 Nuxt 文档站”、 “迁移文档模板”“Nuxt 4 升级”以及 Content cache/search API 500、`contents: []`、`ERR_INVALID_URL`、`sendError` 导出缺失、 `entities/decode`、`FUNCTION_INVOCATION_FAILED`、`[unstorage] Invalid key`、Vercel `READY` 但请求失败、`rolldown@nightly` 解析失败、 `@vueuse/core`、`registerMessageResolver`、`prerender:routes`、`ERR_MODULE_NOT_FOUND`、`UNLOADABLE_DEPENDENCY`、 `stream did not contain valid UTF-8`、`/_ipx` logo 404、prebuilt workflow 过度设计等错误信号与场景。/nitro-api-development使用 Nitro v3 框架和 H3 编写服务端 API 的技能。适用于初始化纯后端 Nitro 项目、 为 Vite 项目赋予全栈能力、编写符合规范的 CRUD 接口、以及使用 Drizzle ORM 进行数据库交互。当需要开发新的 Nitro 接口、初始化 Nitro 配置、 或咨询 Nitro 开发规范时使用此技能。/openspecOpenSpec 规范驱动开发助手 - 基于 OPSX 工作流的 AI 辅助编程框架。 在编写代码前与 AI 就需求达成一致,使用 Schema 驱动的工件依赖系统管理变更。
触发条件(满足任意一项即触发): 1. 用户提及 "openspec"、"opsx"、规范驱动开发、spec-driven 2. 用户想要开始新功能开发、重构或探索复杂需求 3. 用户抱怨 AI 理解偏差或频繁返工 4. 用户使用斜杠命令如 /opsx:new、/opsx:ff、/opsx:apply 等 5. 项目初始化或准备重大变更时 6. 需要生成 proposal、design、tasks 等规范文档时 7. 进入某个项目,需要检查项目级技能目录里是否还有用户不再使用的 openspec 局部技能
推荐使用:改进现有项目(棕地开发)、需要高质量实现的关键功能、团队协作开发。 不推荐:快速原型验证(0→1 探索)、一次性小脚本、需求极度不明确的创新探索。/use-agent-browser规范化使用 agent-browser(AI 浏览器自动化 CLI/MCP)完成页面打开、元素交互、截图取证与 Web 调试: 安装与 doctor 诊断、open/snapshot/@ref 工作流、等待与视口策略、Windows 启动失败降级链 (--no-sandbox、CDP 接管、headless 连接)、MCP 传输层故障三岔口分流(只读取证 → CLI 探活 → CDP 兜底)、 四层超时模型、并发会话与 namespace 隔离、浏览器复用与版本核查、截图证据规范与进程收口、 可视化默认(config headed 有头)、仿人指针 --input-mode human、highlight 元素高亮、 tab 聚合(--pin-tab 单窗口多 tab / session=窗口)。 当需要打开网页、浏览器自我验收、视觉验证、E2E 冒烟、前端页面调试、登录态操作、 想让 agent 的浏览器「可见、光标会动、元素高亮、标签聚合」, 或用户提到 agent-browser、agent browser、浏览器自动化、snapshot 截图取证、可视化有头浏览器, 或遇到 MCP 浏览器工具全线超时、agent-browser 连接失败时使用。 Use when driving the agent-browser CLI/MCP for browser acceptance, visual verification, headed/visible defaults, human-like pointer movement, tab aggregation, web debugging, Windows startup-failure fallbacks, or MCP transport-failure triage./use-vercel-deploy-in-monorepo用于将 pnpm monorepo 或独立仓库部署到一个或多个 Vercel Project,处理 Vercel Git Integration、 本地 link、Project Settings 漂移、Shared Environment Variables、Node 22.x/24.x、 Turbo 任务链、Nitro 产物和 Vercel 部署日志诊断。 Use when deploying pnpm monorepos or standalone repositories to one or more Vercel Projects, including Vercel Git Integration, local linking, Project Settings drift, Shared Environment Variables, Node 22.x/24.x, Turbo task chains, Nitro artifacts, or Vercel deployment-log diagnosis.npx claudepluginhub ruan-cat/monorepo --plugin dev-skills