Agent skill

Create Component

by wot-ui in wot-ui/wot-ui

在 wot-ui 项目中创建新组件骨架与必要注册点。用户要求从零创建组件源码、补齐 types.vue.scss 结构或注册全局组件类型时调用;不负责 Demo 页、测试和文档迁移。

MITAuto-check passedFrontend & Design

Install Create Component

skills CLI
$ npx skills add wot-ui/wot-ui --skill create-component -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install wot-ui/wot-ui create-component --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/wot-ui/wot-ui.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/create-component .claude/skills/create-component && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
create-component
GitHub stars
384
Token cost
~2.1k tokens
SKILL.md length
289 words
Files
1
Skills in repo
10
Repo updated
First seen
Licence
MIT

At a glance

在 wot-ui 项目中创建新组件骨架与必要注册点。用户要求从零创建组件源码、补齐 types.vue.scss 结构或注册全局组件类型时调用;不负责 Demo 页、测试和文档迁移。

  • Works in 9 steps: 创建组件目录 → 创建类型定义文件 (types.ts) → 创建组件文件 (wd-{组件名}.vue) → …
  • Tasks that involve CSS and styling
  • SKILL.md covers 职责边界, 组件目录结构, 创建步骤 and 常用 Composables, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Create Component is an agent skill from wot-ui/wot-ui. 在 wot-ui 项目中创建新组件骨架与必要注册点。用户要求从零创建组件源码、补齐 types.vue.scss 结构或注册全局组件类型时调用;不负责 Demo 页、测试和文档迁移。

Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Frontend & Design, covering CSS and styling. It works with Vue.js. The repository describes itself as: 一个轻量、美观、AI友好的 uni-app 组件库。 The licence is MIT.

When your agent uses it

  • Tasks that involve CSS and styling

Example prompts

  • “/create-component”

Workflow steps

9 steps, taken from the step headings in SKILL.md.

  1. 创建组件目录
  2. 创建类型定义文件 (types.ts)
  3. 创建组件文件 (wd-{组件名}.vue)
  4. 创建样式文件 (index.scss)
  5. 注册全局类型声明 (global.d.ts)
  6. 配置文档侧边栏
  7. 创建演示页面 (src/subPages/{组件名驼峰}/Index.vue)
  8. 配置演示页面路由 (src/pages.json)
  9. 配置首页入口 (src/pages/index/Index.vue)

What it can do on your machine

Read from SKILL.md and the folder at commit 0abe2c2. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript, vue, bash, scss and json).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Create Component loads about 2.1k tokens when it runs. Until then it costs about 27 tokens; SKILL.md has 289 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~27
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from wot-ui/wot-ui at commit 0abe2c2, republished under its MIT licence (© wot-ui). 289 words, ~2,111 tokens.

Download SKILL.mdSave it as .claude/skills/create-component/SKILL.md (or your agent's skills folder).
name
create-component
description
在 wot-ui 项目中创建新组件骨架与必要注册点。用户要求从零创建组件源码、补齐 types.vue.scss 结构或注册全局组件类型时调用;不负责 Demo 页、测试和文档迁移。

创建新组件技能

本技能用于在 wot-ui 项目中创建新的 UI 组件骨架。

默认遵循 wot-ui-component-baseline 中的共享约束,命名与注释细则可配合 vue-comment 使用。

职责边界

  • 本 Skill 负责组件源码目录、基础文件、必要注册点。
  • 本 Skill 不负责 Demo 页编写,相关工作交给 create-demo-page。
  • 本 Skill 不负责测试创建,相关工作交给 create-test。
  • 本 Skill 不负责 Markdown 文档迁移或大规模文档编写,相关工作交给 migrate-component-doc。

组件目录结构

每个组件位于 src/uni_modules/wot-ui/components/wd-{组件名}/ 目录下,包含以下文件:

wd-{组件名}/
├── types.ts           # 类型定义文件
├── wd-{组件名}.vue    # 组件主文件
└── index.scss         # 样式文件

创建步骤

1. 创建组件目录
bash
mkdir -p src/uni_modules/wot-ui/components/wd-{组件名}

2. 创建类型定义文件 (types.ts)
typescript
import type { ComponentPublicInstance, ExtractPropTypes, PropType } from 'vue'
import { baseProps, makeBooleanProp, makeNumberProp, makeNumericProp, makeStringProp } from '../common/props'

// 如果需要定义枚举类型
export type {组件名}Type = 'primary' | 'success' | 'warning' | 'danger'

export const {组件名驼峰}Props = {
  // 继承基础 props (customStyle, customClass)
  ...baseProps,
  /**
   * 属性描述
   * 类型: string
   * 默认值: ''
   */
  prop1: makeStringProp(''),
  /**
   * 布尔属性描述
   * 类型: boolean
   * 默认值: false
   */
  disabled: makeBooleanProp(false),
  /**
   * 数字属性描述
   * 类型: number
   * 默认值: 0
   */
  count: makeNumberProp(0),
  /**
   * 数字或字符串属性
   * 类型: string | number
   * 默认值: ''
   */
  value: makeNumericProp('')
}

// Props 类型导出
export type {组件名}Props = ExtractPropTypes<typeof {组件名驼峰}Props>

// 如果组件暴露方法,定义 Expose 类型
export type {组件名}Expose = {
  /** 方法描述 */
  methodName: () => void
}

// 组件实例类型
export type {组件名}Instance = ComponentPublicInstance<{组件名}Expose, {组件名}Props>
Props 工具函数说明
工具函数用途示例
makeStringProp(default)字符串属性makeStringProp('')
makeBooleanProp(default)布尔属性makeBooleanProp(false)
makeNumberProp(default)数字属性makeNumberProp(0)
makeNumericProp(default)数字或字符串属性makeNumericProp('')
makeArrayProp<T>()数组属性makeArrayProp<string>()
makeRequiredProp(type)必填属性makeRequiredProp(String)

3. 创建组件文件 (wd-{组件名}.vue)
vue
<template>
  <view :class="rootClass" :style="customStyle">
    <!-- 组件内容 -->
    <slot></slot>
  </view>
</template>

<script lang="ts">
export default {
  name: 'wd-{组件名}',
  options: {
    addGlobalClass: true,
    // #ifndef MP-TOUTIAO
    virtualHost: true,
    // #endif
    styleIsolation: 'shared'
  }
}
</script>

<script lang="ts" setup>
import { computed } from 'vue'
import { {组件名驼峰}Props, type {组件名}Expose } from './types'

const props = defineProps({组件名驼峰}Props)

// Emits 定义
const emit = defineEmits<{
  click: [event: Event]
  change: [value: string]
}>()

// 计算根节点类名
const rootClass = computed(() => {
  return `wd-{组件名} ${props.customClass}`
})

// 组件方法
function handleClick(event: Event) {
  emit('click', event)
}

// 暴露给父组件的方法
defineExpose<{组件名}Expose>({
  methodName: () => {
    // 实现
  }
})
</script>

<style lang="scss">
@use './index.scss';
</style>
组件选项说明
  • addGlobalClass: true - 允许使用全局样式类
  • virtualHost: true - 开启虚拟节点模式
  • styleIsolation: 'shared' - 样式共享模式

4. 创建样式文件 (index.scss)
scss
@use '../../styles/mixin/mixin.scss' as *;
@use '../../styles/variable.scss' as *;

// 定义组件级 CSS 变量(支持主题定制)
${组件名}-bg: var(--wot-{组件名}-bg, $filled-oppo);
${组件名}-padding: var(--wot-{组件名}-padding, $padding-loose);
${组件名}-border-radius: var(--wot-{组件名}-border-radius, $radius-main);

@include b({组件名}) {
  display: flex;
  padding: ${组件名}-padding;
  background: ${组件名}-bg;
  border-radius: ${组件名}-border-radius;

  // 定义元素 (Element)
  @include e(header) {
    // .wd-{组件名}__header
  }

  @include e(content) {
    // .wd-{组件名}__content
  }

  @include e(footer) {
    // .wd-{组件名}__footer
  }

  // 定义状态修饰符 (Modifier)
  @include when(disabled) {
    // .wd-{组件名}.is-disabled
    opacity: $opacity-disabled;
  }

  @include when(active) {
    // .wd-{组件名}.is-active
  }

  // 定义变体修饰符
  @include m(primary) {
    // .wd-{组件名}--primary
  }

  @include m(large) {
    // .wd-{组件名}--large
  }
}
BEM 命名规范
Mixin生成选择器说明
@include b(name).wd-name定义块 (Block)
@include e(elem).wd-name__elem定义元素 (Element)
@include m(mod).wd-name--mod定义修饰符 (Modifier)
@include when(state).wd-name.is-state定义状态
@include edeep(elem):deep(.wd-name__elem)穿透子组件样式
@include me(elem)嵌套在 m 下的 e修饰符下的元素
常用样式变量
类别变量示例说明
颜色$primary-6, $danger-main, $text-main语义化颜色
间距$padding-loose, $spacing-tight内边距/间距
圆角$radius-main, $radius-large边框圆角
字体$typography-body-size-main字号
边框$border-main, $stroke-main边框

常用 Composables

项目提供了多个可复用的组合式函数:

Composable用途
useParent获取父组件实例
useChildren管理子组件
useLockScroll锁定页面滚动
useClickAway点击外部区域检测
useQueueToast/Notify 队列管理
useTranslate国际化

使用示例:

typescript
import { useLockScroll } from '../composables/useLockScroll'

// #ifdef H5
useLockScroll(() => showPopup.value)
// #endif

条件编译

uni-app 支持跨平台条件编译:

vue
<!-- 仅 H5 平台 -->
// #ifdef H5
<view>H5 专用内容</view>
// #endif

<!-- 仅微信小程序 -->
// #ifdef MP-WEIXIN
<view>微信小程序专用</view>
// #endif

<!-- 非 App 平台 -->
// #ifndef APP
<view>非 App 内容</view>
// #endif
5. 注册全局类型声明 (global.d.ts)

在 src/uni_modules/wot-ui/global.d.ts 中添加组件类型声明:

typescript
declare module 'vue' {
  export interface GlobalComponents {
    // ... 已有组件
    Wd{组件名帕斯卡}: typeof import('./components/wd-{组件名}/wd-{组件名}.vue')['default']
  }
}

命名规则:组件名使用帕斯卡命名法(PascalCase),如 WdVideoPreview、WdIndexBar

交付要求

  • 至少创建 types.ts、wd-<component>.vue、index.scss。
  • 如组件需全局识别,补充 global.d.ts。
  • 保持最小可运行骨架,不把 Demo、测试、文档强行塞入同一任务。
  • 完成后至少校验当前新增或修改文件无明显语法错误。 | 最低版本 | Min Version |

8. 配置文档侧边栏

需要在以下两个文件中添加侧边栏配置:

中文侧边栏 (docs/.vitepress/locales/zh-CN.ts)
typescript
// 在对应分类的 items 数组中添加
{
  link: '/component/{组件名}',
  text: '{组件名帕斯卡} {中文名}'
}
英文侧边栏 (docs/.vitepress/locales/en-US.ts)
typescript
{
  link: '/en-US/component/{组件名}',
  text: '{组件名帕斯卡} {英文名}'
}

分类参考:

  • 基础:Button、Icon、Popup、Transition 等
  • 导航:Pagination、Tabs、Tabbar、Navbar 等
  • 数据输入:Input、Picker、Calendar、Form 等
  • 反馈:Toast、Loading、ActionSheet 等
  • 数据展示:Badge、Card、Cell、Tag 等

9. 创建演示页面 (src/subPages/{组件名驼峰}/Index.vue)
vue
<template>
  <page-wraper>
    <view class="page-{组件名}">
      <demo-block :title="$t('jiBenYongFa')">
        <wd-{组件名}>基本用法</wd-{组件名}>
      </demo-block>

      <demo-block :title="$t('otherFeature')">
        <!-- 其他功能演示 -->
      </demo-block>
    </view>
  </page-wraper>
</template>

<script lang="ts" setup>
// 组件逻辑
</script>

<style lang="scss" scoped>
.page-{组件名} {
  // 页面样式
}
</style>

注意:使用 page-wraper 组件包裹页面,使用 demo-block 组件分块展示功能


10. 配置演示页面路由 (src/pages.json)

在 subPackages 的 pages 数组中添加:

json
{
  "path": "{组件名驼峰}/Index",
  "name": "{组件名驼峰}",
  "style": {
    "mp-alipay": {
      "allowsBounceVertical": "NO"
    },
    // #ifdef MP
    "navigationBarTitleText": "{组件名帕斯卡} {中文名}",
    // #endif
    // #ifndef MP
    "navigationBarTitleText": "%{组件名小写}-title%"
    // #endif
  }
}

11. 配置首页入口 (src/pages/index/Index.vue)

在对应分类的 pages 数组中添加演示页面入口:

typescript
// 在对应分类(如 show 数据展示)的 pages 数组中添加
{
  id: '{组件名驼峰}',
  name: t('{组件名小写}-{中文名}')
}

分类对应关系:

分类 ID说明示例组件
widget基础Button、Icon、Popup
nav导航Tabs、Tabbar、Navbar
form数据输入Input、Picker、Calendar
feedback反馈Toast、Loading、ActionSheet
show数据展示Badge、Card、Cell、Img

检查清单

创建组件后,确保完成以下事项:

组件代码

  • types.ts 中所有 props 都有中文注释
  • 组件支持 customClass 和 customStyle 属性
  • 样式使用 BEM 命名规范
  • CSS 变量使用 --wot-{组件名}-* 格式命名
  • 如有暴露方法,定义正确的 Expose 类型
  • 组件设置了正确的 name 选项

类型声明

  • 在 global.d.ts 中添加组件类型声明

文档

  • 创建中文文档 docs/component/{组件名}.md
  • 创建英文文档 docs/en-US/component/{组件名}.md
  • 在 zh-CN.ts 中添加侧边栏配置
  • 在 en-US.ts 中添加侧边栏配置

演示页面

  • 创建演示页面 src/subPages/{组件名驼峰}/Index.vue
  • 在 pages.json 中配置页面路由
  • 在 src/pages/index/Index.vue 中添加首页入口

© wot-ui, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/create-component of wot-ui/wot-ui.

Open the folder on GitHubat commit 0abe2c2

Compare with similar skills

Create Component next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Create Component compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Create Component this skillwot-ui/wot-ui384—~2.1kAutomated safety check: PassMIT
Tailwindcss Developmentanonaddy/anonaddy4.9k10 repos~865Automated safety check: PassMIT
Kill AI Slopyetone/kill-ai-slop1.3k—~1.4kAutomated safety check: PassApache-2.0
Design StyleCastor6/tactus3761 repos~2.1kAutomated safety check: PassApache-2.0
Orchardcore Asset ManagerOrchardCMS/OrchardCore8.2k—~1.5kAutomated safety check: PassBSD-3-Clause
Cross Platform Tauri UIifer47/markeron1.2k—~2kAutomated safety check: PassMIT

Similar skills

  • Tailwindcss Development

    anonaddy/anonaddy

    Always invoke when the user's message includes 'tailwind' in any form.

    4.9k GitHub starsUsed in 10 repos~865 tokens
    Frontend & DesignAuto-check passed
  • Kill AI Slop

    yetone/kill-ai-slop

    Find and remove AI slop — the generic, machine-default visual and copy tics of vibe-coded products — from a web project.

    1.3k GitHub stars~1.4k tokensUpdated 23 days ago
    Frontend & DesignAuto-check passed
  • Design Style

    Castor6/tactus

    A skill your agent uses whenever the user asks to build, create, design, develop, improve, or style any frontend interface or visual element.

    376 GitHub starsUsed in 1 repo~2.1k tokens
    Frontend & DesignAuto-check passed
  • Orchardcore Asset Manager

    OrchardCMS/OrchardCore

    Builds, watches, and manages frontend assets in OrchardCore.

    8.2k GitHub stars~1.5k tokensUpdated today
    Frontend & DesignAuto-check passed
  • Cross-platform UI styling for MarkerOn Tauri app (macOS WKWebView vs Windows WebView2).

    1.2k GitHub stars~2k tokensUpdated today
    Frontend & DesignAuto-check passed
  • Vuetify Skilld

    logue/vite-vuetify-ts-starter

    Vue Material Component Framework. An agent skill from logue/vite-vuetify-ts-starter.

    181 GitHub starsUsed in 1 repo~1.9k tokens
    Frontend & DesignAuto-check passed

More from wot-ui/wot-ui

All 10 skills in this repo
  • Create Demo Page

    wot-ui/wot-ui

    为组件创建演示页面并统一组织结构。用户要求新建/重构组件 Demo、统一展示顺序或用 demo-group 与 demo-group-item 编排时调用。

    384 GitHub stars~547 tokensUpdated 13 days ago
    Auto-check passed
  • 为新组件或新特性快速生成符合设计系统规范的 SCSS 变量定义代码,或检查现有变量是否合规. An agent skill from wot-ui/wot-ui.

    384 GitHub stars~906 tokensUpdated 13 days ago
    Auto-check passed
  • Generate Theme

    wot-ui/wot-ui

    为 wot-ui 生成单文件主题 SCSS,并在 App.vue 中挂载语义变量. An agent skill from wot-ui/wot-ui.

    384 GitHub stars~2.4k tokensUpdated 13 days ago
    Auto-check passed
  • 优化 subPages 演示页面中的样式,将硬编码的颜色、字号、间距、圆角等替换为 wot-ui 设计系统语义变量。允许直接使用已全局注入的 variable.scss Sass 变量,也允许使用 CSS 自定义属性;不需要额外引入 variable.scss。消除手写的暗色模式覆盖块,统一使用语义变量实现自适应主题。同时将 class 命名统一为 BEM 规范。

    384 GitHub stars~4.9k tokensUpdated 13 days ago
    Auto-check passed
  • Vue Comment

    wot-ui/wot-ui

    统一 Vue 与 wot-ui 组件源码中的注释和命名规范。用户要求规范组件 Props 注释、函数命名、类型说明、变量命名或在创建组件后补齐代码注释时调用;不负责 Demo、测试和文档迁移。

    384 GitHub stars~965 tokensUpdated 13 days ago
    Auto-check passed
  • 迁移组件 Markdown 文档到新规范。用户明确要求迁移文档结构、重排 Demo 章节、合并 Attributes/Options 列、迁移最低版本标记或升级旧文档格式时调用;不用于仅做一致性核对。

    384 GitHub stars~610 tokensUpdated 13 days ago
    Auto-check passed

Works with

Questions about Create Component

What does Create Component do?

在 wot-ui 项目中创建新组件骨架与必要注册点。用户要求从零创建组件源码、补齐 types.vue.scss 结构或注册全局组件类型时调用;不负责 Demo 页、测试和文档迁移。. Create Component is an agent skill from wot-ui/wot-ui.

When should I use Create Component?

Create Component fits situations like: tasks that involve CSS and styling.

How do I install Create Component in Claude Code?

Run `npx skills add wot-ui/wot-ui --skill create-component -a claude-code`. Or copy the skill folder (.agents/skills/create-component in wot-ui/wot-ui) into .claude/skills/create-component in your project. Claude Code loads it when a task matches its description.

How do I install Create Component in Codex?

Run `npx skills add wot-ui/wot-ui --skill create-component -a codex`. Or copy the skill folder (.agents/skills/create-component in wot-ui/wot-ui) into .agents/skills/create-component in your project. Codex loads it when a task matches its description.

Can I use Create Component in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add wot-ui/wot-ui --skill create-component -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/create-component, .gemini/skills/create-component, .github/skills/create-component and .opencode/skills/create-component in your project.

What does Create Component need to run?

SKILL.md names no scripts, command-line tools or credentials: Create Component is instructions for the agent only.

Does Create Component access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Create Component safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Create Component use?

Create Component is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Create Component use?

About 2.1k tokens (SKILL.md is roughly 8.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Create Component?

Skills that share tags, products or a category with Create Component: Tailwindcss Development (anonaddy/anonaddy, 4.9k stars), Kill AI Slop (yetone/kill-ai-slop, 1.3k stars), Design Style (Castor6/tactus, 376 stars) and Orchardcore Asset Manager (OrchardCMS/OrchardCore, 8.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Create Component?

wot-ui (a GitHub organization) maintains it in wot-ui/wot-ui, which has 384 GitHub stars. The repository holds 10 skills in this directory. The repository was last updated on September 25, 2026.

Source: wot-ui/wot-ui on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.