you-might-not-need-an-effect
GitHub分析并修复React代码中的useEffect反模式,提供优化建议或直接应用修改,提升组件状态管理效率。
Trigger Scenarios
Install
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 main", "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.
Version History
- 336ec07 Current 2026-08-29 03:07
- ceda457 2026-08-20 15:29


