you-might-not-need-an-effect
GitHub用于分析代码中 React useEffect 的反模式,依据官方指南提供修复建议或直接应用更改,支持指定作用域。
触发场景
安装
npx skills add simstudioai/sim --skill you-might-not-need-an-effect -g -y
SKILL.md
Frontmatter
{
"name": "you-might-not-need-an-effect",
"description": "Analyze and fix useEffect anti-patterns in your code",
"argument-hint": "[scope] [fix=true|false]"
}
You Might Not Need an Effect
Arguments:
- scope: what to analyze (default: your current changes). Examples: "diff to staging", "PR #123", "src/components/", "whole codebase"
- fix: whether to apply fixes (default: true). Set to false to only propose changes.
User arguments: $ARGUMENTS
Steps:
- Read https://react.dev/learn/you-might-not-need-an-effect to understand the guidelines
- Analyze the specified scope for useEffect anti-patterns
- If fix=true, apply the fixes. If fix=false, propose the fixes without applying.
Query-backed forms
When query data supplies the initial values for an editable form, do not copy it into draft state in an Effect. Render loading chrome in an outer component, then mount a keyed form child once data exists and initialize its state lazily from props. Key by the resource identity so every related draft, dialog, and upload state resets together when the resource changes. Keep independent queries in the outer component to preserve parallel fetching.
版本历史
-
c6cef5f
当前 2026-10-20 02:39
将默认分析范围从 'diff to main' 更新为 'diff to staging'
- 336ec07 2026-08-29 03:07
- ceda457 2026-08-20 15:29


