Token导航 LogoToken导航TokenDH.com
开发只读github未标认证来源可访问许可证需确认审计通过

ui-data-testidui 数据 testid

Agent Skill

用于辅助数据整理、表格处理、CSV/Excel 分析、指标计算和图表准备。它适合让 Agent 清洗字段、汇总数据、发现异常、生成统计口径或把分析结果转成可读说明。使用时需要确认数据来源、字段含义和时间范围,避免把样本数据当全量事实;涉及敏感数据、导出文件或批量写回时,应先确认权限和脱敏边界。

总安装

364

周安装

15

GitHub Stars

4,820

下载量

119
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/dtyq/magic --skill ui-data-testid

简介

用于辅助数据整理、表格处理、CSV/Excel 分析、指标计算和图表准备。

  • 适合清洗字段、汇总数据、发现异常或生成统计口径,并将分析结果转为可读说明。
  • 使用时需确认数据来源、字段含义和时间范围,避免将样本数据当作全量事实;涉及敏感数据时应先确认权限和脱敏边界。
  • 安装方式:通过 npx skills add 命令从指定 GitHub 仓库添加。
  • 注意:需确认宿主环境支持 Codex、Claude、Cursor 或 Gemini CLI。

SKILL.md

UI Data-testid

Overview

Add predictable data-testid attributes to UI code as part of implementation, not as a later patch. Keep selectors stable across i18n text changes and visual refactors. Follow project testing rules in .cursor/rules:

  • preserve existing data-testid during refactor/migration
  • use data-testid-first query strategy in project tests

Workflow

  1. Determine the scope prefix from feature/module context (for example: user-menus, organization-switch, settings-profile).
  2. Add data-testid to the component root container.
  3. Add data-testid to all primary interactive nodes:

- button/link triggers - input/select/checkbox/radio controls - tabs/menu items/submenu triggers - modal/drawer open and confirm actions

  1. For config-driven UI (for example menu.items), add "data-testid" in config and forward it to the real clickable DOM node in renderer/wrapper components.
  2. For repeated list rows/items, prefer one shared id queried with getAllByTestId; if uniqueness is required, append a stable business key (never array index when order can change).
  3. Keep existing ids unchanged unless user explicitly asks to rename; never remove existing ids in migration tasks.
  4. For interaction changes, add or update Vitest/RTL tests in colocated __tests__ where feasible.

Naming Rules

  • Use lowercase kebab-case only.
  • Use semantic format: <scope>-<entity>-<action>.
  • Keep IDs text-agnostic (do not depend on i18n labels).
  • Avoid dynamic/random values (Date.now, UUID, translated text).
  • Do not embed secrets, emails, phone numbers, or tokens.
  • Use stable suffixes when applicable: trigger, content, button, input, option, item, row, loading, empty, error.

Minimum Coverage Checklist

For every newly created UI component, include at least:

  • one root container test id
  • one primary CTA test id
  • test ids for each secondary action button
  • test ids for each form field group/control
  • test ids for menu item triggers when menus are present
  • preserved historical data-testid in touched files
  • loading/empty/error test ids for async UIs

Query Priority

When writing or updating tests:

  • prefer getByTestId for stable selectors in this project
  • use getByRole, getByLabelText, getByText as complementary assertions
  • avoid container.querySelector(...) selectors for user-facing behavior tests

This keeps alignment with .cursor/rules/testing-guide.mdc.

Scenario Playbook

Apply these patterns for stable and accurate element targeting:

  1. Forms

- add ids for form container, inputs, submit/cancel buttons, and validation errors

  1. Lists and tables

- add list container id and row container id - use stable business key for row id suffix when uniqueness is required - query child actions with within(row) scope

  1. Menus and dropdowns

- add ids for trigger, popup content, and each actionable menu item - if menu is config-driven, forward item-level data-testid to rendered node

  1. Modal and drawer

- add ids for open trigger, modal content, primary action, and close/cancel action

  1. Async states

- add ids for loading, empty, and error states

Stability Rules

  • Never generate ids from array index if order may change.
  • Never generate ids from random values or timestamps.
  • Keep singleton ids unique on a page.
  • For repeated components, keep shared child ids and scope with within(...).

Patterns

Component markup

<div data-testid="user-menus-organization-info">
  <button type="button" data-testid="user-menus-upgrade-button" />
  <button type="button" data-testid="user-menus-recharge-button" />
</div>

Config + renderer forwarding

const items = [
  { key: "logout", label: t("logout"), "data-testid": "user-menus-logout" },
]

<ItemComponent data-testid={menuItem["data-testid"]}>{menuItem.label}</ItemComponent>

Done Criteria

Complete only when all new interactive nodes in touched UI files have stable data-testid values and any wrapper layer correctly forwards them to rendered DOM elements. Confirm no existing data-testid was removed unintentionally in migration/refactor diffs.

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

36.81%
按下载量换算44

Claude

29.88%
按下载量换算36

Cursor

19.94%
按下载量换算24

Gemini CLI

9.59%
按下载量换算11

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

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

来源信息

继续浏览同类 Skills