帮助你在使用组件浏览器的项目中高效处理 UI 变更、截图与视觉测试。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "use-component-explorer" 技能: 1. 下载 https://raw.githubusercontent.com/microsoft/vscode-team-kit/main/component-explorer/skills/use-component-explorer/SKILL.md 2. 保存为 ~/.claude/skills/use-component-explorer/SKILL.md 3. 装好后重载技能,告诉我可以用了
项目使用组件浏览器。我刚新增了一个按钮组件,请告诉我应该如何添加 fixture,用于展示默认态、禁用态和加载态,并给出示例结构。
说明应在组件浏览器中如何新增展示用例,并给出多状态 fixture 的组织方式与示例。
我修改了卡片组件的样式。请根据组件浏览器的工作流,列出我需要更新的截图、视觉测试检查点,以及如何避免遗漏回归问题。
一份围绕截图更新与视觉回归检查的操作清单,帮助完成 UI 变更后的验证。
组件浏览器里的视觉测试失败了,差异出现在弹窗组件。请帮我分析常见原因,并给出按优先级排序的排查步骤。
按优先级整理的排查建议,涵盖环境差异、数据状态、样式变更和截图基线更新等可能原因。
Fixture files end in .fixture.ts or .fixture.tsx and are auto-discovered by the Vite plugin.
Every fixture has a render function that receives a container DOM element and a RenderContext:
import { defineFixture } from '@vscode/component-explorer';
export default defineFixture({
render: (container) => {
// Render your component into container
return { dispose: () => { /* cleanup */ } };
},
});
The second argument to render provides:
signal — AbortSignal for cancellation (check signal.aborted or listen to 'abort')defineFixture({
render: async (container, { signal }) => {
const data = await fetch('/api/data', { signal });
container.textContent = await data.text();
},
});
import { createRoot } from 'react-dom/client';
import { defineFixture } from '@vscode/component-explorer';
import { MyComponent } from './MyComponent';
export default defineFixture({
render: (container) => {
const root = createRoot(container);
root.render(<MyComponent />);
return { dispose: () => root.unmount() };
},
});
Group related fixtures in a single file:
import { defineFixture, defineFixtureGroup } from '@vscode/component-explorer';
export default defineFixtureGroup({
Default: defineFixture({ render: (c) => { /* ... */ } }),
WithError: defineFixture({ render: (c) => { /* ... */ } }),
Disabled: defineFixture({ render: (c) => { /* ... */ } }),
});
Groups can have metadata (path prefix, labels):
export default defineFixtureGroup({ path: 'Forms/', labels: ['forms'] }, {
Primary: defineFixture({ /* ... */ }),
Secondary: defineFixture({ /* ... */ }),
});
For closely related variants rendered side-by-side:
import { defineFixture, defineFixtureGroup, defineFixtureVariants } from '@vscode/component-explorer';
export default defineFixtureGroup({
Sizes: defineFixtureVariants({
Small: defineFixture({ render: (c) => { /* ... */ } }),
Medium: defineFixture({ render: (c) => { /* ... */ } }),
Large: defineFixture({ render: (c) => { /* ... */ } }),
}),
});
Set background: 'dark' for components designed for dark backgrounds:
defineFixture({
background: 'dark',
render: (container) => { /* ... */ },
});
Fixtures must not mutate global state. Each fixture's render function should only modify the provided container element and return a dispose function that fully cleans up. No writes to document.body, global variables, localStorage, shared singletons, or other state outside the container. This ensures fixtures can be rendered in any order, in parallel, and multiple times without interference.
Do not use global CSS selectors like :root, html, body, or *. Every style must be scoped to a class name (e.g. .app-root, .my-component). Components are rendered in isolation inside the explorer — global styles leak across fixtures and break the isolated rendering model.
App-level CSS files (resets, CSS variables on :root, etc.) are fine for the app itself, but they must not be imported by components or fixture files. Keep app-level styles in separate entry points (e.g. index.css imported only by the app's main.ts) so they are never loaded during fixture rendering. If a component needs shared variables or resets, apply them within the fixture's container element or via the project-local wrapper (see below).
defineFixture Directly…
帮助用户通过 gh 命令获取并查看 GitHub 通知列表,快速处理仓库动态。
帮助 AI 代理读写记忆与规则,并按环境自动选择可用存储方案
调用多模型交叉审查代码变更、PR与高风险修改,辅助发现缺陷与争议点
帮助你快速检索 GitHub 中分配给你、待分诊或自定义条件的议题与 PR。
汇集多模型独立方案与辩论,辅助实现路径和架构决策
为 GitHub 议题或拉取请求快速添加表情反应,提升协作反馈效率。
帮助开发者创建和维护组件截图测试夹具,并优化组件的可测试性。
帮助你构建、调试并验证各类 Web 应用前端功能与交互问题
帮助你完整搭建 Component Explorer,配置 CLI、MCP、VS Code 任务与调试环境。
帮助你实现与迭代界面和交互体验,完成前端集成与设计优化。
帮助用户设计并生成高质量、可生产的前端界面与网页组件代码
帮助你为复杂问题编写调试测试并反复验证,快速定位异常根因。