Agent skill

Create Test

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

“为组件创建单元测试的标准流程”

— description from SKILL.md by wot-ui
MITAuto-check passedFrontend & Design

Install Create Test

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

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

GitHub CLI
$ gh skill install wot-ui/wot-ui create-test --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-test .claude/skills/create-test && 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-test
GitHub stars
384
Token cost
~690 tokens
SKILL.md length
121 words
Files
1
Skills in repo
10
Repo updated
First seen
Licence
MIT

At a glance

  • Works in 6 steps: 确认组件信息 → 创建测试文件 → 使用测试模板 → …
  • SKILL.md covers 目录结构, 创建步骤 and 最佳实践
  • Calls npm and npx

About this skill

Create Test is a skill in wot-ui/wot-ui (384 stars). Its SKILL.md is about 690 tokens. Licence: MIT.

Workflow steps

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

  1. 确认组件信息
  2. 创建测试文件
  3. 使用测试模板
  4. 编写具体测试用例
  5. 运行测试
  6. 提升覆盖率技巧

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

    Shell commands in SKILL.md call:

    • npm
    • npx

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

  • Network

    No URLs in SKILL.md. Its commands use npm and npx, which can reach the network depending on how they are called.

    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 Test loads about 690 tokens when it runs. Until then it costs about 7 tokens; SKILL.md has 121 words of instructions outside code blocks.

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

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). 121 words, ~690 tokens.

Download SKILL.mdSave it as .claude/skills/create-test/SKILL.md (or your agent's skills folder).
name
create-test
description
为组件创建单元测试的标准流程

创建测试技能

本技能用于为 wot-ui 项目中的组件创建单元测试。测试框架使用 vitest 和 @vue/test-utils。

目录结构

所有组件测试位于 tests/components/ 目录下,命名格式为 wd-{组件名}.test.ts。

创建步骤

1. 确认组件信息
  • 组件名称: 例如 icon, button
  • 组件路径: src/uni_modules/wot-ui/components/wd-{组件名}/wd-{组件名}.vue
  • Props 定义: src/uni_modules/wot-ui/components/wd-{组件名}/types.ts
2. 创建测试文件

在 tests/components/ 目录下创建 wd-{组件名}.test.ts 文件。

3. 使用测试模板

将以下模板复制到测试文件中,并根据组件实际情况进行修改。

typescript
import { mount } from '@vue/test-utils'
import Wd{组件名帕斯卡} from '@/uni_modules/wot-ui/components/wd-{组件名}/wd-{组件名}.vue'
import { describe, test, expect, vi, beforeEach } from 'vitest'

describe('Wd{组件名帕斯卡}', () => {
  beforeEach(() => {
    vi.clearAllMocks()
  })

  // 1. 基本渲染测试
  test('基本渲染', () => {
    const wrapper = mount(Wd{组件名帕斯卡})
    // 检查根类名
    expect(wrapper.classes()).toContain('wd-{组件名}')
    // 检查是否有 snapshot (可选)
    // expect(wrapper.element).toMatchSnapshot()
  })

  // 2. Props 测试
  // 遍历 types.ts 中定义的所有 props,测试其效果
  test('Props: propName', () => {
    const wrapper = mount(Wd{组件名帕斯卡}, {
      props: {
        propName: 'value'
      }
    })
    // 断言 props 生效,例如检查样式、类名或 DOM 结构
    expect(wrapper.classes()).toContain('is-some-state')
  })

  // 3. Events 测试
  test('Events: click', async () => {
    const wrapper = mount(Wd{组件名帕斯卡})
    await wrapper.trigger('click')
    expect(wrapper.emitted('click')).toBeTruthy()
  })

  // 4. Slots 测试
  test('Slots: default', () => {
    const content = 'Slot Content'
    const wrapper = mount(Wd{组件名帕斯卡}, {
      slots: {
        default: content
      }
    })
    expect(wrapper.text()).toContain(content)
  })
})
4. 编写具体测试用例

根据 types.ts 中的 Props 定义和组件逻辑,完善测试用例。

  • Boolean Props: 测试 true 和 false (默认) 的情况。通常对应类名变化 is-{prop}。
  • String/Number Props: 测试不同值对组件显示的影响。
  • Events: 测试交互是否触发了正确的事件,并携带了正确的参数。
  • Expose: 如果组件暴露了方法 (Expose),需要测试这些方法调用后的效果。
  • External Classes/Styles: 测试 customClass 和 customStyle 是否生效。
5. 运行测试

使用以下命令运行测试,确保通过:

bash
# 运行所有测试
npm run test

# 运行特定文件测试 (推荐)
npx vitest tests/components/wd-{组件名}.test.ts
6. 提升覆盖率技巧

为了确保高测试覆盖率,请关注以下方面:

  • 分支覆盖 (Branch Coverage): 确保 if/else、switch 语句的所有分支都被执行。
  • 边界条件 (Boundary Conditions): 测试最小值、最大值、空值、超长文本等极端情况。
  • 交互状态 (Interactive States): 测试禁用 (disabled)、加载中 (loading)、只读 (readonly) 等状态下的行为。
  • 异步操作 (Async Operations): 确保测试了 setTimeout、nextTick 或 Promise 相关的异步逻辑。
  • 插槽内容 (Slot Content): 测试默认插槽和具名插槽在有无内容时的渲染表现。

最佳实践

  • 描述清晰: test 的描述应该清晰表达测试的目的。
  • 功能覆盖: 尽量覆盖组件的所有 Props、Events 和 Slots。
  • mocks: 如果组件依赖外部环境或 API,使用 vi.mock 或 vi.spyOn 进行模拟。
  • cleanup: beforeEach 中清理 mocks,保证测试独立性。

© 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-test of wot-ui/wot-ui.

Open the folder on GitHubat commit 0abe2c2

Compare with similar skills

Create Test 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 Test compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Create Test this skillwot-ui/wot-ui384—~690Automated safety check: PassMIT
Web Artifacts Builderanthropics/skills180k41 repos~769Automated safety check: PassApache-2.0
React Doctormakeplane/plane61k12 repos~657Automated safety check: PassAGPL-3.0
Impeccablebestofjs/bestofjs3.1k27 repos~2.6kAutomated safety check: PassMIT
Figma Design System Builderwarpdotdev/warp65k2 repos~4.4kAutomated safety check: PassAGPL-3.0
Web Interface Guidelines Reviewervercel-labs/openreview1.7k98 repos~308Automated safety check: PassNone

Similar skills

  • Web Artifacts Builder

    anthropics/skills

    Official

    Builds multi-component claude.ai HTML artifacts as a small React, TypeScript and Tailwind project, then bundles it into one shareable HTML file.

    180k GitHub starsUsed in 41 repos~769 tokens
    Frontend & DesignAuto-check passed
  • React Doctor

    makeplane/plane

    Scans React code for lint, accessibility, bundle size and architecture issues, reports a health score and checks that changes do not lower it.

    61k GitHub starsUsed in 12 repos~657 tokens
    Frontend & DesignAuto-check passed
  • Impeccable

    bestofjs/bestofjs

    A skill your agent uses when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a…

    3.1k GitHub starsUsed in 27 repos~2.6k tokens
    Frontend & DesignAuto-check passed
  • Builds or updates a design system in Figma from a codebase in ordered phases: discovery, variables and tokens, components, theming and documentation, with checkpoints.

    65k GitHub starsUsed in 2 repos~4.4k tokens
    Frontend & DesignAuto-check passed
  • Web Interface Guidelines Reviewer

    vercel-labs/openreview

    Official

    Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my…

    1.7k GitHub starsUsed in 98 repos~308 tokens
    Frontend & DesignAuto-check passed
  • 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

More from wot-ui/wot-ui

All 10 skills in this repo
  • Create Component

    wot-ui/wot-ui

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

    384 GitHub stars~2.1k tokensUpdated 13 days ago
    Auto-check passed
  • 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

Questions about Create Test

How do I install Create Test in Claude Code?

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

How do I install Create Test in Codex?

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

Can I use Create Test 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-test -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-test, .gemini/skills/create-test, .github/skills/create-test and .opencode/skills/create-test in your project.

What does Create Test need to run?

Going by SKILL.md and its folder, Create Test needs the command-line tools its instructions call (npm and npx).

Does Create Test access the network?

SKILL.md contains no URLs. Its commands use npm and npx, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Create Test 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 Test use?

Create Test 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 Test use?

About 690 tokens (SKILL.md is roughly 2.8k 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 Test?

Skills that share tags, products or a category with Create Test: Web Artifacts Builder (anthropics/skills, 180k stars), React Doctor (makeplane/plane, 61k stars), Impeccable (bestofjs/bestofjs, 3.1k stars) and Figma Design System Builder (warpdotdev/warp, 65k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Create Test?

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.