Token导航 LogoToken导航

Agent Skill · 研究检索

use-effect-killer(使用效果杀手)

use-effect-killer 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

use-effect-killer 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 43,364。

总安装 989周安装 40GitHub Stars 10下载 310核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/victor36max/use-effect-killer --skill use-effect-killer

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

use-effect-killer 用于查找、检索和筛选相关信息。适合在 Codex、Claude、Cursor、Gemini CLI 中根据关键词或任务场景快速定位候选结果。通过 npx skills add 命令从指定 GitHub 仓库安装并使用。

安装前需确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。建议结合来源仓库和原始 README 核验具体用法和功能边界。

来源仓库内路径:skills/use-effect-killer

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/victor36max/use-effect-killer --skill use-effe…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

use-effect-killer 怎么安装?

在终端执行 npx skills add https://github.com/victor36max/use-effect-killer --skill use-effect-killer。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

use-effect-killer 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

use-effect-killer 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

use-effect-killer 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

use-effect-killer 用的人多吗?

公开数据是累计安装 989 次,近一周安装 40 次,下载 310 次,GitHub 10 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

use-effect-killer 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
use-effect-killer

使用效果杀手 · 本页

98910接触敏感数据未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

useEffect Killer

Audit a React codebase for unnecessary or misused useEffect calls and propose idiomatic alternatives.

Reference: https://react.dev/learn/you-might-not-need-an-effect

Workflow

  1. Find all useEffect usages. Grep for useEffect across $ARGUMENTS (or the entire repo if no path given). Filter to .tsx, .ts, .jsx, .js files.
  2. Read each file containing useEffect. For every useEffect call, classify it against the anti-pattern catalog below. Skip effects that are legitimate (event listeners with cleanup for component-scoped DOM, animation setup, true synchronization with external systems).
  3. For each finding, record:

- File path and line number - Which anti-pattern it matches - The problematic code snippet - A concrete suggested fix using the recommended alternative

  1. Report findings using the output format at the bottom. Group by anti-pattern. Include a summary with counts.
  2. If $ARGUMENTS is empty, scan all React component files in the project.

Anti-Pattern Catalog

Use these patterns to classify each useEffect you encounter.

1. Derived State

State that is computed from other state or props, updated via useEffect.

Detect: useEffect body calls a setter, and the value being set can be expressed as a pure function of state/props already available during render.

Bad:

const [firstName, setFirstName] = useState('');
const [lastName, setLastName] = useState('');
const [fullName, setFullName] = useState('');
useEffect(() => {
  setFullName(firstName + ' ' + lastName);
}, [firstName, lastName]);

Fix: Remove the extra state and effect. Compute inline.

const fullName = firstName + ' ' + lastName;

2. Expensive Derived Computation

Same as #1 but the computation is expensive, so the developer reached for useEffect + state to "cache" it.

Detect: useEffect that transforms or filters data from props/state into another state variable. Often involves .filter(), .map(), .sort(), .reduce().

Bad:

const [visibleTodos, setVisibleTodos] = useState([]);
useEffect(() => {
  setVisibleTodos(getFilteredTodos(todos, filter));
}, [todos, filter]);

Fix: Use useMemo.

const visibleTodos = useMemo(
  () => getFilteredTodos(todos, filter),
  [todos, filter]
);

3. Reset All State on Prop Change

Using useEffect to reset state variables when an identity prop (e.g., userId, itemId) changes.

Detect: useEffect whose body sets one or more state variables to initial values, with a prop in the dependency array.

Bad:

function ProfilePage({ userId }) {
  const [comment, setComment] = useState('');
  useEffect(() => {
    setComment('');
  }, [userId]);

Fix: Extract into a child component and use key to reset.

function ProfilePage({ userId }) {
  return <Profile userId={userId} key={userId} />;
}
function Profile({ userId }) {
  const [comment, setComment] = useState('');

4. Adjust Some State on Prop Change

Using useEffect to partially update state when props change, but not a full reset.

Detect: useEffect with a prop dependency that conditionally updates state — often nulling out a selection or resetting a sub-field.

Bad:

function List({ items }) {
  const [selection, setSelection] = useState(null);
  useEffect(() => {
    setSelection(null);
  }, [items]);

Fix (preferred): Derive the value during render instead of storing it.

function List({ items }) {
  const [selectedId, setSelectedId] = useState(null);
  const selection = items.find(item => item.id === selectedId) ?? null;

Fix (alternative): Store previous props and adjust during render. Note: the items!== prevItems guard is mandatory — without it, you get an infinite render loop. This pattern also triggers one extra re-render.

const [prevItems, setPrevItems] = useState(items);
if (items !== prevItems) {
  setPrevItems(items);
  setSelection(null);
}

5. Event Logic in Effect

Side effects (toast, notification, navigation, analytics for a user action) placed in useEffect instead of in the event handler that triggered them.

Detect: useEffect that calls functions like showNotification, toast, navigate, router.push, alert, or logs analytics — triggered by a state variable that was set in an event handler.

Bad:

useEffect(() => {
  if (product.isInCart) {
    showNotification(`Added ${product.name} to cart!`);
  }
}, [product]);

Fix: Move into the event handler.

function handleBuyClick() {
  addToCart(product);
  showNotification(`Added ${product.name} to cart!`);
}

6. POST / Mutation in Effect

Using a state variable as a trigger to fire a network request from useEffect.

Detect: useEffect that calls fetch, post, axios, mutate, useMutation, tRPC mutations, or similar — where the dependency is a state variable set by an event handler (often a "submit payload" state).

Bad:

const [jsonToSubmit, setJsonToSubmit] = useState(null);
useEffect(() => {
  if (jsonToSubmit !== null) {
    post('/api/register', jsonToSubmit);
  }
}, [jsonToSubmit]);

Fix: Call directly from the event handler.

function handleSubmit(e) {
  e.preventDefault();
  post('/api/register', { firstName, lastName });
}

7. Effect Chains

Multiple useEffects where one sets state that triggers the next, forming a cascade.

Detect: Two or more useEffect calls in the same component where the dependency of one includes a state variable set inside another. Look for sequential state-setting patterns.

Bad:

useEffect(() => { if (card?.gold) setGoldCardCount(c => c + 1); }, [card]);
useEffect(() => { if (goldCardCount > 3) { setRound(r => r + 1); setGoldCardCount(0); } }, [goldCardCount]);
useEffect(() => { if (round > 5) setIsGameOver(true); }, [round]);

Fix: Derive what you can (const isGameOver = round > 5), consolidate the rest into the event handler.

const isGameOver = round > 5;

function handlePlaceCard(nextCard) {
  setCard(nextCard);
  if (nextCard.gold) {
    if (goldCardCount < 3) {
      setGoldCardCount(goldCardCount + 1);
    } else {
      setGoldCardCount(0);
      setRound(round + 1);
    }
  }
}

8. App Initialization in Effect

One-time setup code (auth checks, localStorage reads, config loading) inside a useEffect([],...) that breaks under Strict Mode double-mount.

Detect: useEffect with [] dependency array that runs init-style logic: auth token checks, localStorage reads, global config. Especially problematic if the logic has side effects that shouldn't run twice.

Bad:

useEffect(() => {
  loadDataFromLocalStorage();
  checkAuthToken();
}, []);

Fix: Guard with a module-level flag so it runs once, even under Strict Mode double-mount.

let didInit = false;

function App() {
  useEffect(() => {
    if (!didInit) {
      didInit = true;
      loadDataFromLocalStorage();
      checkAuthToken();
    }
  }, []);
}

For code that truly has no side effects and doesn't need React lifecycle, module-level execution is also valid:

if (typeof window !== 'undefined') {
  // Only for pure reads — not for auth tokens or anything with side effects
  const cachedTheme = localStorage.getItem('theme');
}

9. Notify Parent via Effect

Calling a parent callback (like onChange) inside useEffect after a state update, instead of alongside it.

Detect: useEffect whose body calls a prop callback (onChange, onUpdate, onSelect, etc.) passing the current state value.

Bad:

function Toggle({ onChange }) {
  const [isOn, setIsOn] = useState(false);
  useEffect(() => {
    onChange(isOn);
  }, [isOn, onChange]);

Fix: Call the callback in the event handler.

function handleClick() {
  const nextIsOn = !isOn;
  setIsOn(nextIsOn);
  onChange(nextIsOn);
}

Or make the component fully controlled (remove local state, let parent own it).

10. Pass Data to Parent via Effect

Child fetches or computes data, then pushes it up to the parent through an effect callback.

Detect: useEffect calling a prop callback like onFetched, onData, onLoaded with data obtained from a hook or fetch inside the child.

Bad:

function Child({ onFetched }) {
  const data = useSomeAPI();
  useEffect(() => {
    if (data) onFetched(data);
  }, [onFetched, data]);

Fix: Lift the data fetching to the parent. Pass data down, not up.

function Parent() {
  const data = useSomeAPI();
  return <Child data={data} />;
}

11. External Store Subscription

Manual addEventListener/removeEventListener or subscription logic inside useEffect to sync with browser APIs or external stores.

Detect: useEffect with addEventListener/removeEventListener on window, document, or navigator (not on a component ref) that syncs external state into React state. Also .subscribe() / .unsubscribe() patterns for global stores. Do NOT flag ref-scoped DOM listeners with proper cleanup — those are legitimate.

Bad:

useEffect(() => {
  function update() { setIsOnline(navigator.onLine); }
  window.addEventListener('online', update);
  window.addEventListener('offline', update);
  return () => {
    window.removeEventListener('online', update);
    window.removeEventListener('offline', update);
  };
}, []);

Fix: Use useSyncExternalStore.

const isOnline = useSyncExternalStore(
  (cb) => {
    window.addEventListener('online', cb);
    window.addEventListener('offline', cb);
    return () => {
      window.removeEventListener('online', cb);
      window.removeEventListener('offline', cb);
    };
  },
  () => navigator.onLine,
  () => true
);

12. Initialize State from Props via Effect

Using useEffect to set state from props on first render, instead of passing the prop to useState directly.

Detect: useEffect with [] dependency that calls a setter with a prop value, or useEffect with [prop] where the state has a different initial value (like null) and is immediately overwritten.

Bad:

function Editor({ initialContent }) {
  const [content, setContent] = useState(null);
  useEffect(() => {
    setContent(initialContent);
  }, []);
}

Fix: Pass the prop directly as the initial state value.

function Editor({ initialContent }) {
  const [content, setContent] = useState(initialContent);
}

This eliminates the flicker where the component first renders with null, then immediately re-renders with the prop value.

13. Fetch Without Cleanup

Data fetching in useEffect without handling stale responses (race conditions).

Detect: useEffect containing fetch, axios, or async calls that set state on completion — without a cleanup function that sets an ignore flag or calls AbortController.abort().

Bad:

useEffect(() => {
  fetchResults(query).then(json => {
    setResults(json);
  });
}, [query]);

Fix: Add an ignore flag or abort controller. Better yet, use a data-fetching library (TanStack Query, SWR, etc.).

useEffect(() => {
  let ignore = false;
  fetchResults(query).then(json => {
    if (!ignore) setResults(json);
  });
  return () => { ignore = true; };
}, [query]);

Legitimate useEffect Usages (Do NOT Flag)

Skip these — they are valid uses of useEffect:

  • Subscribing to ref-scoped DOM events with proper cleanup (e.g., ResizeObserver on a specific element ref, IntersectionObserver on a ref). Note: window/document-level subscriptions that drive render state should use useSyncExternalStore instead (see #11).
  • Running animations or timers scoped to component mount
  • Synchronizing with truly external systems (WebSocket connections, third-party widget initialization)
  • Analytics/logging that should fire on component display (not on a user action)
  • Focus management on mount

Output Format

Structure your report as follows:

## useEffect Audit Results

### Summary
- **Files scanned:** N
- **useEffect instances found:** N
- **Anti-patterns detected:** N
- **Legitimate usages (skipped):** N

### Findings

#### 1. Derived State (X found)

**`src/components/UserProfile.tsx:42`**
(show the current code)
**Problem:** fullName is derived from first and last — no effect needed.
**Fix:** `const fullName = first + ' ' + last;` and remove the `fullName` state.

---
(repeat for each finding, grouped by anti-pattern)

### Clean Files
Files with useEffect that passed review — list briefly so the user knows they were checked.

平台分布

Codex

35.34%
按下载量换算110

Claude

31.47%
按下载量换算98

Cursor

18.93%
按下载量换算59

Gemini CLI

10.15%
按下载量换算31

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

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

继续浏览同类 Skills