做什么
在React 18类组件中提供诊断和固定自动分批回归的精确模式. 当一个类组件以Async方式、在设置内、在承诺.then()或.catch()内或在一个本地事件处理器内多次调用设置状态时,使用此技能。 在写入任何 slushSync 调用前使用它 - 这里的决定树防止不必要的 slushSync 过度使用 。 在修复由中间态断言导致的测试故障时也使用这种技能,这种断言在回放18升级后会中断.
技能库 智客分类:写作与研究 react18-batching-patterns
在React 18类组件中提供诊断和固定自动分批回归的精确模式. 当一个类组件以Async方式、在设置内、在承诺.then()或.catch()内或在一个本地事件处理器内多次调用设置状态时,使用此技能。 在写入任何 slushSync 调用前使用它 - 这里的决定树防止不必要的 slushSync 过度使用 。 在修复由中间态断言导致的测试故障时也使用这种技能,这种断言在回放18升级后会中断.
官方网址:skills.sh
先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。
在React 18类组件中提供诊断和固定自动分批回归的精确模式. 当一个类组件以Async方式、在设置内、在承诺.then()或.catch()内或在一个本地事件处理器内多次调用设置状态时,使用此技能。 在写入任何 slushSync 调用前使用它 - 这里的决定树防止不必要的 slushSync 过度使用 。 在修复由中间态断言导致的测试故障时也使用这种技能,这种断言在回放18升级后会中断.
shroftSync, 当不是时, 导入语法
按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:React 18 Automatic Batching Patterns、The Core Change、Quick Diagnosis、The flushSync Rule。
文件分析:除 SKILL.md 外,正文引用了 references/batching-categories.md、references/flushSync-guide.md,属于带资源的技能包,这些文件按需再读。
Provides exact patterns for diagnosing and fixing automatic batching regressions in React 18 class components. Use this skill whenever a class component has multiple setState calls in an async method, inside setTimeout, inside a Promise .then() or .catch(), or in a native event handler. Use it before writing any flushSync call - the decision tree here prevents unnecessary flushSync overuse. Also use this skill when fixing test failures caused by intermediate state assertions that break after React 18 upgrade.
React 18 Automatic Batching PatternsThe Core ChangeQuick DiagnosisThe flushSync Rule
来源分类:skills.sh agent-skill
namereact18-batching-patternsdescriptionreferences/batching-categories.mdreferences/flushSync-guide.md以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。
具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗
先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。
该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。
复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。
把 Agent Skill「react18-batching-patterns」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-65995dbc9117aa79-%E5%8F%8D%E5%BA%9418-%E6%8E%A5%E5%87%BB%E6%A8%A1%E5%BC%8F.html 请存为 .cursor/skills/react18-batching-patterns/SKILL.md 或 .claude/skills/react18-batching-patterns/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。 该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/github/awesome-copilot 取完整目录,不要只建一个 SKILL.md。
需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。
npx skills add 'https://github.com/github/awesome-copilot' --list
npx skills add 'https://github.com/github/awesome-copilot' --skill 'react18-batching-patterns'
CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。
Reference for diagnosing and fixing the most dangerous silent breaking change in React 18 for class-component codebases.
| Location of setState | React 17 | React 18 | |---|---|---| | React event handler | Batched | Batched (same) | | setTimeout | Immediate re-render | Batched | | Promise .then() / .catch() | Immediate re-render | Batched | | async/await | Immediate re-render | Batched | | Native addEventListener callback | Immediate re-render | Batched |
Batched means: all setState calls within that execution context flush together in a single re-render at the end. No intermediate renders occur.
Read every async class method. Ask: does any code after an await read this.state to make a decision?
Code reads this.state after await?
YES → Category A (silent state-read bug)
NO, but intermediate render must be visible to user?
YES → Category C (flushSync needed)
NO → Category B (refactor, no flushSync)
For the full pattern for each category, read:
references/batching-categories.md - Category A, B, C with full before/after codereferences/flushSync-guide.md - when to use flushSync, when NOT to, import syntaxUse flushSync sparingly. It forces a synchronous re-render, bypassing React 18's concurrent scheduler. Overusing it negates the performance benefits of React 18.
Only use flushSync when:
In most cases, the fix is a refactor - restructuring the code to not read this.state after await. Read references/batching-categories.md for the correct approach per category.
写作与研究
从文本中删除 AI 生成的写入标记 。 编辑或审查文本时使用,使其声音更自然和人文写作. 基于维基百科的全面"AI写作的标志"指南. 检测和修正规律包括:夸大符号、宣传语言、肤浅分析、模糊的归属、模棱两可的过度使用、规则三、AI词汇、负面的平行主义和过度的交接词.
写作与研究
OpenClaw 的默认网络搜索 。 搜索网络跨越了10个引擎——Google,Reddit,GitHub,arXiv,Hacker News等——使用Prismfy. 包括免费等级,不需要信用卡。 包括用于网络搜索、配额检查和引擎/时间/域过滤器的捆绑 " search.sh …
写作与研究
监控博客和RSS/Atom的种子.
写作与研究
AI-优化了使用Tavily Search API的网络搜索. 需要全面网络研究,时事搜索,域名特定搜索,或AI生成的回答摘要时使用. Tavily是LLM消费的优化型,具有清洁的结构化结果,答案生成,以及原始内容提取. 最适合研究任务、新闻查询、实况调查和收集权威来源.