做什么
提供将测试文件迁移到 React 19 兼容性的前/后模式, 包括行为( ) 导入, 模拟去除, 以及严格模式调用数变化 .
技能库 智客分类:Agent 工作流 react19-test-patterns
提供将测试文件迁移到 React 19 兼容性的前/后模式, 包括行为( ) 导入, 模拟去除, 以及严格模式调用数变化 .
官方网址:skills.sh
先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。
提供将测试文件迁移到 React 19 兼容性的前/后模式, 包括行为( ) 导入, 模拟去除, 以及严格模式调用数变化 .
官方 description 未单独写出 Use when。按规范,代理会在用户任务与这段 description 的关键词匹配时激活本技能。
按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:React 19 Test Migration Patterns、Priority Order、1. act() Import Fix、2. Simulate → fireEvent、3. react-dom/test-utils Full API Map、4. StrictMode Call Count Fixes。
文件分析:这是一份仅含 SKILL.md 的指令型技能,代理激活后整份正文进入上下文。
Provides before/after patterns for migrating test files to React 19 compatibility, including act() imports, Simulate removal, and StrictMode call count changes.
React 19 Test Migration PatternsPriority Order1. act() Import Fix2. Simulate → fireEvent3. react-dom/test-utils Full API Map4. StrictMode Call Count FixesRun the failing test, read the actual count from the error:
来源分类:skills.sh agent-skill
namereact19-test-patternsdescription具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗
先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。
复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。
把 Agent Skill「react19-test-patterns」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-1246788de48f16e2-React19-%E6%B5%8B%E8%AF%95%E6%A8%A1%E5%BC%8F.html 请存为 .cursor/skills/react19-test-patterns/SKILL.md 或 .claude/skills/react19-test-patterns/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。
npx skills add 'https://github.com/github/awesome-copilot' --list
npx skills add 'https://github.com/github/awesome-copilot' --skill 'react19-test-patterns'
CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。
Reference for all test file migrations required by React 19.
Fix test files in this order; each layer depends on the previous:
act import fix first, it unblocks everything elseSimulate → fireEvent fix immediately after act// Before REMOVED in React 19:
import { act } from 'react-dom/test-utils';
// After:
import { act } from 'react';
If mixed with other test-utils imports:
// Before:
import { act, Simulate, renderIntoDocument } from 'react-dom/test-utils';
// After split the imports:
import { act } from 'react';
import { fireEvent, render } from '@testing-library/react'; // replaces Simulate + renderIntoDocument
// Before Simulate REMOVED in React 19:
import { Simulate } from 'react-dom/test-utils';
Simulate.click(element);
Simulate.change(input, { target: { value: 'hello' } });
Simulate.submit(form);
Simulate.keyDown(element, { key: 'Enter', keyCode: 13 });
// After:
import { fireEvent } from '@testing-library/react';
fireEvent.click(element);
fireEvent.change(input, { target: { value: 'hello' } });
fireEvent.submit(form);
fireEvent.keyDown(element, { key: 'Enter', keyCode: 13 });
| Old (react-dom/test-utils) | New location |
|---|---|
| act | import { act } from 'react' |
| Simulate | fireEvent from @testing-library/react |
| renderIntoDocument | render from @testing-library/react |
| findRenderedDOMComponentWithTag | getByRole, getByTestId from RTL |
| findRenderedDOMComponentWithClass | getByRole or container.querySelector |
| scryRenderedDOMComponentsWithTag | getAllByRole from RTL |
| isElement, isCompositeComponent | Remove not needed with RTL |
| isDOMComponent | Remove |
React 19 StrictMode no longer double-invokes useEffect in development. Spy assertions counting effect calls must be updated.
Strategy always measure, never guess:
# Run the failing test, read the actual count from the error:
npm test -- --watchAll=false --testPathPattern="[filename]" --forceExit 2>&1 | grep -E "Expected|Received"
// Before (React 18 StrictMode effects ran twice):
expect(mockFn).toHaveBeenCalledTimes(2); // 1 call × 2 (strict double-invoke)
// After (React 19 StrictMode effects run once):
expect(mockFn).toHaveBeenCalledTimes(1);
// Render-phase calls (component body) still double-invoked in React 19 StrictMode:
expect(renderSpy).toHaveBeenCalledTimes(2); // stays at 2 for render body calls
Agent 工作流
创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.
Agent 工作流
使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.
Agent 工作流
管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.
Agent 工作流
Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…